8.2. Result Tree Fragments

When a variable declaration element contains a template, the content of the template is instantiated and the resulting object is an RTF. This creates a new kind of object, different from the four standard object types (node-set, string, Boolean, and number). An RTF is a node-set that contains one node, whose children are the nodes that are produced by the instruction elements in the template.

Although an RTF is technically a node-set, there are restrictions on how this new type of node-set can be accessed or used. The way in which the variable is referenced in subsequent template rules determines how that RTF will be written to the actual output result tree. If the RTF is output using <xsl:copy-of>, the nodes in the ...

Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.