Stylus Studio XML Editor

Table of contents

Appendices

7.2 Creating Text

Creating Text

A template can also contain text nodes. Each text node in a template remaining after whitespace has been stripped as specified in [Whitespace Stripping] will create a text node with the same string-value in the result tree. Adjacent text nodes in the result tree are automatically merged.

Note that text is processed at the tree level. Thus, markup of &lt; in a template will be represented in the stylesheet tree by a text node that includes the character <. This will create a text node in the result tree that contains a < character, which will be represented by the markup &lt; (or an equivalent character reference) when the result tree is externalized as an XML document (unless output escaping is disabled as described in [Disabling Output Escaping]).

< text
   disable-output-escaping= >
   <-- Content: -->
< /text>

Literal data characters may also be wrapped in an xsl:text element. This wrapping may change what whitespace characters are stripped (see [Whitespace Stripping]) but does not affect how the characters are handled by the XSLT processor thereafter.

NOTE: 

The xml:lang and xml:space attributes are not treated specially by XSLT. In particular,

  • it is the responsibility of the stylesheet author explicitly to generate any xml:lang or xml:space attributes that are needed in the result;

  • specifying an xml:lang or xml:space attribute on an element in the XSLT namespace will not cause any xml:lang or xml:space attributes to appear in the result.