J
Jesper Stocholm
I have som XML that link to an XSL-file to enable on-the-fly
HTML-generation by e.g. IE or FireFox. The transformation actually works
like a charm, but I have problems with changing line breaks in the XML to
their html-equivilant <br/>.
I use the XSL:
<xsl:template name="break">
<xslaram name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '
')">
<xsl:value-of select="substring-before($text, '
')"/>
<br/>
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'
')"/>
</xsl:call-template>
</xsl:when>
<xsltherwise>
<xsl:value-of select="$text"/>
</xsltherwise>
</xsl:choose>
</xsl:template>
And I apply it to the specific XML-element with the code
<xsl:call-template name="break">
<xsl:with-param name="text" select="description"/>
</xsl:call-template>
When I display the XML-file in IE, it all looks fine and dandy - but when I
load the page in FireFox (1.0 PR), the linebreaks are not converted to
html-<br>-tags.
What am I doing wrong?
And - are there some programs out there that will allow me to supply a
XML-file and a XSL-stylesheet - and then display the result of the
XSL(T)-transaformation?
HTML-generation by e.g. IE or FireFox. The transformation actually works
like a charm, but I have problems with changing line breaks in the XML to
their html-equivilant <br/>.
I use the XSL:
<xsl:template name="break">
<xslaram name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '
')">
<xsl:value-of select="substring-before($text, '
')"/>
<br/>
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'
')"/>
</xsl:call-template>
</xsl:when>
<xsltherwise>
<xsl:value-of select="$text"/>
</xsltherwise>
</xsl:choose>
</xsl:template>
And I apply it to the specific XML-element with the code
<xsl:call-template name="break">
<xsl:with-param name="text" select="description"/>
</xsl:call-template>
When I display the XML-file in IE, it all looks fine and dandy - but when I
load the page in FireFox (1.0 PR), the linebreaks are not converted to
html-<br>-tags.
What am I doing wrong?
And - are there some programs out there that will allow me to supply a
XML-file and a XSL-stylesheet - and then display the result of the
XSL(T)-transaformation?