xsl-list
[Top] [All Lists]

RE: String manipulation & Line Breaks

2003-03-25 08:36:35
Hi,

I have a need to preserve line breaks in a string of text 
rendered to html
output.  I'm not sure exactly how to accomplish this, but was hoping
something along the lines of the following might work:

<xsl:call-template name="replace">
<xsl:with-param name="str" select="bio"/>
<xsl:with-param name="from">\n</xsl:with-param>
<xsl:with-param name="to"><br/></xsl:with-param>
</xsl:call-template>

"\n" would be LINE FEED in e.g. Java, but not in XML.
 
It doesnt.
Neither does:

<xsl:call-template name="replace">
<xsl:with-param name="str" select="bio"/>
<xsl:with-param name="from"><xsl:text>
</xsl:text></xsl:with-param>
<xsl:with-param name="to"><br/></xsl:with-param>
</xsl:call-template>

Well, this should work. Are you sure you don't have extra whitespace inside 
xsl:text? Anyhow, try

  <xsl:with-param name="from" select="'&#xA;'" />

Cheers,

Jarno - Linnunradan käsikirja liftareille: Osa 14

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



<Prev in Thread] Current Thread [Next in Thread>