XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Structure controls processing / Default rules for text and attribute nodes

(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)

When text or attribute nodes are part of a sequence to be processed, the default behavior is to extract their string value and output it as a text node in the result sequence.

This can be expressed by the following default template rule:

<xsl:template match="text()|@*">
  <xsl:value-of select="."/>
</xsl:template>

For a text node, a copy is essentially created. For an attribute, its string value, the string assigned to it as its value, is copied as a text node. Note that this string is not normalized for either attribute values or text nodes. Even whitespace nodes are copied to the result document by this rule!

   

back to top