Re: what are node set fragments and why are they ruining my life?

Subject: Re: what are node set fragments and why are they ruining my life?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 14 Dec 1999 10:27:35 GMT
node set fragments don't exist, which may account for your confusion.

There are two related datatypes

node sets, and result tree fragments.

> "not being well-formed",
A result tree fragment need not have a root element, so it is not a well
formed document (it could be linearised to a XML external parsed entity)

> Cannot convert value [** RESULT TREE FRAGMENT **] to
> a node-set

See, node sets are not the same thing as result tree fragments.


A node set is what you get back from a select expression
so select="aaa[@xxx]|aaa[bbb]"

gives you the set of all elements with name aaa and either a
xxx attribute or a bbb child. Note this is a set not a list
if some aaa element has both xxx attribute and bbb child, you only get
it once. The set is however ordered (in document order, normally)


A node set is what you can apply templates to

<xsl:apply-templates select="aaa[@xxx]|aaa[bbb]"/>

ie it's the relevant part of the input document (or some secondary input
document via the docyument() function)

a result tree fragment is what you produce in a template.
You can save it in a variable and while it has similar structure to a
node set (it's a bunch of XML nodes) it is essentially opaque to xsl you
can not apply templates to it or interrogate its structure.
The only thing you can do is use xsl:copy-of to put the value of the
variable holding the result tree fragment into the result tree at some
point. 

xt saxon (at least) have an extension function that converts result tree
fragments to node sets.

>     <xsl:for-each select="$members">
members holds the result tree fragment, so you can't select into it.

You could use
    <xsl:for-each select="xt:node-set($members)">

David


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


Current Thread