Node set and result tree fragment in xslt

Node set and result tree fragment are different types, while path evaluation can only be applied on node set, otherwise you will get error message like:

To use a result tree fragment in a path expression

Then question is how to decide the data set is a node set or result tree fragment?

For both the parameter and variable elements, if a value is assigned by the XPath expression, then one of the four basic XPath types will be returned: Boolean, string, number, or node set, it will NEVER return a result tree fragments

<xsl:param name=Qname select= XPath Expression />
<xsl:variable name=Qname select=XPath Expression />

While if you use a template to assign param or variable, and returned type is collection, then it is result tree fragment

<xsl:param name=Qname>
  template body	
</xsl:param >

<xsl:variable name=Qname>
 template body
</xsl:variable >

When node_set() is used to convert result tree fragments, and root element is added, so always returned one root element with child nodes from result tree fragments. This is also different from a node set returned by selection.

Tags:

This entry was posted on Monday, July 11th, 2011 at 2:02 am and is filed under General. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

*