Hi Merico,
I have attached a stylesheet that I use for doing this. Works for me with xalan, hopefully also with saxon.
HTH, Johannes
Merico Raffaele wrote:
Dear Community
I'm looking for a way to translate the newlines in a text into HTML-<BR> when serializing to HTML. Can anybody give me a tip. I'm using cocoon.2.1.6 and saxonb.8.1.1.
Many thanks in advance ... Raffaele
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- nl2br-�quivalent --> <xsl:template name="br-replace"> <xsl:param name="text"/> <!-- </xsl:text> on next line on purpose to get newline --> <xsl:variable name="cr"><xsl:text> </xsl:text></xsl:variable> <xsl:choose> <xsl:when test="contains($text,$cr)"> <xsl:value-of select="substring-before($text,$cr)"/> <br /> <xsl:call-template name="br-replace"> <xsl:with-param name="text" select="substring-after($text,$cr)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
