Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Templates - basic usage (3/12) >

Element xsl:text

This stylesheet gives the same output as the previous one. The only difference is that the text which appears in the output is surrounded by xsl:text element. The fact that the outputs are identical is a chance. In fact, when xslt processor discovers a text which is not a part of mark-up, it automatically treats it as if surrounded by xsl:text element. This implicit treatment is based on a set of rules how to handle such a case. This implicit treatment can result in an output which differs from expected behavior as rules for merging text fragments can influence the way how spaces, line breaks and tabulators (whitespaces) are outputed.

It is better strategy to always explicitly use xsl:text for creation of text nodes (outputting text). In this way only whitespaces inside xsl:text are outputed and whitespaces appearing elsewhere inside template are ignored. This small hassle connected with writing of unnecessary elements is richly awarded by convenient finalizing of required output.


            <xsl:output  method="xml"

            <xsl:template  match="/">
                  <xsl:text>Hello, world!</xsl:text>


Hello, world!

Previous chapter: - - -
Next chapter: Sequences
Previous page: The first template
Next page: Element xsl:value-of - getting data from the source document

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver Stanton

You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks