[xsl] Line endings fix ( &#0A to =0D=0A= conversion)

Subject: [xsl] Line endings fix ( &#0A to =0D=0A= conversion)
From: Neil Smith <neil@xxxxxxxxxxxxxxx>
Date: Tue, 08 Apr 2003 21:34:38 +0100
Hi all - fixed my 2nd problem thansk to a url here :

Which was to convert newline characters to content-transfer encoded output for email & calendar files. The fix was to use those darn substring-before calls as below :-)

<xsl:template match="description">
	<xsl:call-template name="break">
		<xsl:with-param name="text" select="." />

<xsl:template name="break"> <xsl:param name="text" select="."/> <xsl:choose> <xsl:when test="contains($text, '&#xA;')"> <xsl:value-of select="substring-before($text, '&#xA;')"/> <xsl:text>=0D=0A=&#xA;</xsl:text> <xsl:call-template name="break"> <xsl:with-param name="text" select="substring-after($text,'&#xA;')"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> </xsl:template>

Nice trick :-)

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread