Hi,
> As I'm not a guru of XSLT, I am surely missing a point but
> why would I should
> use xsl:text?
>
> Look at the following example :
> http://www.w3.org/TR/xslt#result-element-stylesheet
>
> Would it make more sense to use :
> <p><xsl:text>Total Amount: </xsl:text></p>
>
> Instead of :
> <p>Total Amount: </p>
>
> I've red the doc but I'm still not confident on when to use xsl:text.
The spec's pretty clear, I think. <http://www.w3.org/TR/xslt#element-text>
says:
"This wrapping may change what whitespace characters are stripped (see [3.4
Whitespace Stripping]) but does not affect how the characters are handled by
the XSLT processor thereafter."
and <http://www.w3.org/TR/xslt#strip>:
"For stylesheets, the set of whitespace-preserving element names consists of
just xsl:text."
I.e. if you have
<p>
<p>
The whitespace text node child of the p element will be stripped. However, if
you have
<p><xsl:text>
</xsl:text></p>
the whitespace will be preserved.
Cheers,
Jarno
|