Re: [xsl] Plain Text Handling in XSLT Output

Subject: Re: [xsl] Plain Text Handling in XSLT Output
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 7 Jun 2006 11:07:19 +0100
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