|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:attribute introducing a lot of whitespace
Vijay wrote:
Hi
> <xsl:attribute name="href">
> #<xsl:value-of select="translate($namevar,' ','_')"/>_cost
> </xsl:attribute>
When the stylesheet is compiled, the only-whitespace-nodes
(and only them) are ignored. In your above example, the
xsl:attribute has three children: 1/ one text node starting
with a newline then spaces then a '#', 2/ the xsl:value-of
element and 3/ a text node starting with '_cost' then a
newline then spaces.
Because they are not only-whitespaces-text-nodes, the text
nodes are not ignored by the XSLT processor. You have to
solutions: 1/ correct the text nodes in your stylesheet or
2/ use xsl:text:
<xsl:attribute name="href">#<xsl:value-of
select="translate($namevar,' ','_')"/>_cost</xsl:attribute>
<xsl:attribute name="href">
<xsl:text>#</xsl:text>
<xsl:value-of select="translate($namevar,' ','_')"/>
<xsl:text>_cost</xsl:text>
</xsl:attribute>
The use of xsl:text let you keep a correctly indented
code. Personnally, I *always* use xsl:text when I want to
generate a text node (except maybe in literal elements).
That helps to avoid such errors.
Regards,
--drkm
___________________________________________________________________________
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions !
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses
http://fr.answers.yahoo.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






