Re: Node-set vs. Result tree fragment

Subject: Re: Node-set vs. Result tree fragment
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 10 Jul 2000 17:56:56 -0600 (MDT)
Michael J. Hudson wrote:
> What exactly is the difference between a node-set and result tree 
> fragment. 

node-set: non-repeating set of nodes from anywhere in the source tree(s);

result tree fragment: hierarchical branch of nodes created for the result tree

Yout get node-sets from a source tree (which is usually derived from an
XML document), and you tell the XSLT processor to create, in steps (a
fragment at a time, in a nested fashion), a result tree, via the
instructions and literal result elements you put in the stylesheet.
Output, such as an XML or HTML document, may be derived from the result
tree.

> If I have a node-set, will I be able to access the children
> of the nodes in that node-set?

No; not in pure XSLT. This is what the node-set extensions in various
implementations are for, though, as you guessed. These are functions that
supplement the standard XPath & XSLT functions, taking a result tree
fragment argument and returning a node-set. You can use the function call
as the first LocationStep in an expression, like:

<xsl:variable name="aFragment">
  <div style="font-weight: bold">
    <p>hi!</p>
  </div>
</xsl:variable>
<xsl:value-of select="xt:node-set($aFragment)/div/p"/>

These convert-to-node-set functions are generally used for sorting and
grouping operations, although they may not be necessary now that key-based
methods have been devised. (see the FAQ)

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread