[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Node Set and Node List differentiation

Subject: RE: Node Set and Node List differentiation
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 15 Jun 1999 10:09:08 +0100
share node list
> I inferred the following based on the context. Can somebody 
> please confirm or clarify the following.
> 
> Node Set: Nodes that have common parent element type in the 
> hierarchy. This is essential when using UnionExpr since subsequent filters

> would require consistency in the element type of input nodes.

No. A node set is any set of nodes, they do not have to share a parent and
they don't need to be nodes of the same type or elements with the same
element name. For example, "//H1 | //comment()" is a node set containing all
H1 elements and all comments in the document.

> 
> Node List: Could be a 'Node set' but not necessarily. This is 
> a context list of nodes that contain nodes of different types from
arbitrary 
> levels (in the document order).

A node list is a collection of nodes that has a defined order. The order is
not necessarily document order.

Example:

from-ancestors(.) generates a node list containing all the ancestors of the
current node in reverse document order

from-ancestors(.)[position()&lt;4] selects the first three nodes in that
list, returning a new node list containing the parent, grandparent, and
greatgrandparent of
the current node, in that order (reverse document order)

xsl:variable name="elders" expr="from-ancestors(.)[position()&lt;4]"
converts this
node list to a node set (i.e. it loses the ordering information and
potentially eliminates duplicates), so the value of elders is a node set.
 
xsl:apply-templates select="$elders" (in the absence of an xsl:sort
specification) sorts this node set into document order before applying the
relevant template to each node in the sorted list: so the order of
processing is greatgrandparent, grandparent, parent.

Mike Kay


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.