Derek
the main reason you want to use this is when whitespace is significant in
the result document. For instance, consider this snippet of xsl
<h1>
details for user
<xsl:value-of select="@username"/>
in group
<xsl:value-of select="@groupname"/>
</h1>
the text node for the phrase 'details for user' starts just after the
closing > of <h1> and ends just before the opening < of <xsl:value-of>. All
this extra whitespace will be copied into the resulting output. This doesn't
normally matter with HTML but you might be using an output format where
whitespace is significant or you maybe want the HTML to look nice. in this
case you can do this:
<h1>details for user<xsl:value-of select="@username"/>in group<xsl:value-of
select="@groupname"/></h1>
but this can get unwieldy (and if you use a pretty printer to reformat your
XSL it might break it up again). Here's where xsl:text comes in:
<h1>
<xsl:text>details for user</xsl:text>
<xsl:value-of select="@username"/>
<xsl:text>in group</xsl:text>
<xsl:value-of select="@groupname"/>
</h1>
now you have no whitespace within those text nodes. Instead you have created
some new text nodes which just contain the whitespace but fortunately the
XSLT processor will ignore those.
Dealing with whitespace in XSL is a pain the butt and you usually don't need
to bother. on those occasions where you need to control the whitespace that
gets generated, xsl:text is the way to do it
HTH
Andy