User:Dyrcona/Colloquy
From Apache OpenOffice Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Here is the script, just copy and paste and run it like the official one with xsltproc:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" /> <xsl:template match="/log/event | /log/envelope"> <xsl:choose> <xsl:when test="local-name() = 'event'"> <xsl:call-template name="timestamp"> <xsl:with-param name="date" select="@occurred" /> </xsl:call-template> <xsl:text>» </xsl:text> <xsl:value-of select="normalize-space(message)" /> </xsl:when> <xsl:when test="local-name() = 'envelope'"> <xsl:for-each select="message"> <xsl:call-template name="timestamp"> <xsl:with-param name="date" select="@received" /> </xsl:call-template> <xsl:value-of select="../sender" /><xsl:text>: </xsl:text> <xsl:value-of select="normalize-space()" /> <xsl:text> </xsl:text> </xsl:for-each> </xsl:when> <xsl:otherwise> <xsl:text>ERROR: can't handle "</xsl:text><xsl:value-of select="local-name()" /><xsl:text>"</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text> </xsl:text> </xsl:template> <xsl:template name="timestamp"> <xsl:param name="date" /> <xsl:text>[</xsl:text> <xsl:variable name='hour' select='substring($date, 1, 14)' /> <xsl:variable name='minute' select='substring($date, 15, 5)' /> <xsl:value-of select="concat($hour,':',$minute)" /> <xsl:text>] </xsl:text> </xsl:template> </xsl:stylesheet>