Hi,
I'm not very experienced in XML/XSL at all (only started looking at it a couple of days ago) anyway I'm calling this stylesheet to output an XML file with <BuildLog> stuff here with newlines in it </BuildLog> to HTML and conserve the newlines so the formatting remains.
I've hacked together some code from other files I've read but I get an error, and I've spent a while on it and I'm completely stumped. Cheers for any help:
Here's the code:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:lxslt="
http://xml.apache.org/xslt">
<xsl:output method="html"/>
<xsl:template match="BuildLog" mode="buildlog">
<xsl:call-template name="newlineToHTML">
<xsl:with-param name="line" select="text()"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="newlineToHTML">
<xsl:param name="line"/>
<xsl:choose>
<xsl:when test="contains($line, '
')">
<xsl:value-of select="sul:stylesheetstring-before($line, '
')"/>
<br/>
<xsl:call-template name="newlineToHTML">
<xsl:with-param name="line">
<xsl:value-of select="substring-after($line, '
')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$line"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Thanks in advance
Carl