[opensource-dev] [IDEA] built-in chatlog wikification (was: Esbee Linden's OH Transcript Posted for 09/01/2010)

Ricky kf6kjg at gmail.com
Thu Sep 2 14:43:59 PDT 2010


Thanks Joshua!  I'd forgotten about following-sibling.  You might
remember our conversation in early 2009 when I was fighting through
using an XPath query on install.xml... That was fun, but it worked
well for me for a long while; I still use it in my Linux build script!

To accomodate future issues, maybe entries for UUID, SourceType
(Agent, Object, Error, etc.), and more could be integrated?

Here's a better listing of the fields we might be looking at:
* timestamp - need I say more?
* uuid - the UUID/key of the "speaker"
* type - Agent/Object/Error/...
* name - Object name or Display Name (if Agent)
* text - what was said

If the type is an agent, then the following field would be convenient:
* account - The avatar's account name (assuming this is public
information, as I currently understand it to be. Not a judgement on
whether or not it should be public however!)

Another bonus of this approach is that it should be fairly easy to
convert the XSLT for going to HTML into one that generates WikiMarkup.
 Then it's standard XSLT tools to build an export-to-wiki process.

So... Should this be a JIRA feature request now?  Any other comments?

Ricky
Cron Stardust

On Thu, Sep 2, 2010 at 12:34 PM, Joshua Bell <josh at lindenlab.com> wrote:
> On Thu, Sep 2, 2010 at 10:49 AM, Ricky <kf6kjg at gmail.com> wrote:
>>
>> Could even be
>> potentially possible with LLSD since it is based in xml, but may be
>> more difficult to make a good XSL document due to the fact that LLSD
>> is not context-free. (The descriptor and content are sibling nodes.
>> This caused me much headache many months ago!)
>
> You can use XPaths like key[text()='KEYNAMEHERE']/following-sibling::* to do
> key/value processing over XML-serialized LLSD in XSLT.
> For example, given this XML-serialized LLSD:
> <?xml version="1.0" encoding="utf-8"?>
> <llsd>
>   <array>
>     <map>
>       <key>speaker</key>
>       <string>Joshua Linden</string>
>       <key>text</key>
>       <string>Hello, world</string>
>       <key>timestamp</key>
>       <date>2010-09-02T12:11:44Z</date>
>     </map>
>     <map>
>       <key>speaker</key>
>       <string>Joshua Linden</string>
>       <key>text</key>
>       <string>It's lonely here</string>
>       <key>timestamp</key>
>       <date>2010-09-02T12:12:32Z</date>
>     </map>
>   </array>
> </llsd>
> You can process it with this XSLT:
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="html" />
> <xsl:template match="/llsd/array">
>   <html>
>     <title>Chat Log</title>
>     <table>
>       <xsl:for-each select="map">
>         <xsl:call-template name="entry" />
>       </xsl:for-each>
>     </table>
>   </html>
> </xsl:template>
> <xsl:template name="entry">
>   <tr>
>     <td>
>        <xsl:value-of select="key[text()='timestamp']/following-sibling::*"
> />
>     </td>
>     <td>
>        <xsl:value-of select="key[text()='speaker']/following-sibling::*" />
>     </td>
>     <td>
>        <xsl:value-of select="key[text()='text']/following-sibling::*" />
>     </td>
>   </tr>
> </xsl:template>
> </xsl:stylesheet>
> To get this HTML output:
> <html>
> <title>Chat Log</title>
> <table>
> <tr>
> <td>2010-09-02T12:11:44Z</td>
> <td>Joshua Linden</td>
> <td>Hello, world</td>
> </tr>
> <tr>
> <td>2010-09-02T12:12:32Z</td>
> <td>Joshua Linden</td>
> <td>It's lonely here</td>
> </tr>
> </table>
> </html>
>
> _______________________________________________
> Policies and (un)subscribe information available here:
> http://wiki.secondlife.com/wiki/OpenSource-Dev
> Please read the policies before posting to keep unmoderated posting
> privileges
>


More information about the opensource-dev mailing list