RE: [xsl] String manipulation & Line Breaks

Subject: RE: [xsl] String manipulation & Line Breaks
From: "Koes, Derrick" <Derrick.Koes@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Mar 2003 10:46:56 -0500
I don't think you can use mark-up such as <br/> as the string to replace
&#xA; because it will be treated as a string rather than a node.  Please
explain why I am wrong.



-----Original Message-----
From: Jarno.Elovirta@xxxxxxxxx [mailto:Jarno.Elovirta@xxxxxxxxx] 
Sent: Tuesday, March 25, 2003 10:37 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] String manipulation & Line Breaks

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
This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee.  It may contain information which is
covered by legal, professional or other privilege.  If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission.  If you have received this transmission in error, please
notify the sender as soon as possible and destroy this message.

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


Current Thread