Re: [xsl] Plain Text Handling in XSLT Output

Subject: Re: [xsl] Plain Text Handling in XSLT Output
From: "Georg Hohmann" <georg.hohmann@xxxxxxxxx>
Date: Wed, 7 Jun 2006 12:16:54 +0200
Thanks for your quick response.
I'm currently reading Michael Kay's "XSLT2.0" and i didn't made it to
page 459 yet so i was not aware of the element xsl:text. :-) This is
exactly what i need, thanx!

GH.



2006/6/7, David Carlisle <davidc@xxxxxxxxx>:

white space nodes in a stylesheet are stripped by default) (so you can indent your xsl code without affecting the result. various ways to change the default the easiest is to use <xsl:text>...</xsl:text> so <xsl:value-of select="Firstname"/> <xsl:value-of select="Lastname"/>

could be
<xsl:value-of select="Firstname"/>
<xsl:text> </xsl:text>
<xsl:value-of select="Lastname"/>
or
<xsl:value-of select="concat(Firstname,' ',Lastname)"/>
or (in XSLT2)

<xsl:value-of select="Firstname,Lastname"/>


"> (<

That node is not white space it;s a newline a bunch of spaces and a ( so
is not stripped and appears as is in the result. Golden rule is always
put all text in an xsl:text element if you are indenting code

           ">
    <xsl:text>(</xsl:text>
   <xsl:value-of ...

now the indentation spaces are in white space text nodes and so are
ignored.


David



________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________

Current Thread