Re: [xsl] Node vs TreeFragment

Subject: Re: [xsl] Node vs TreeFragment
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 8 Jun 2001 14:07:57 -0600 (MDT)
> > > <xsl:variable name="theData" select="someParent/someNode[@a='aKey' and
> > > @b='bKey' and @c='cKey']/data" />
>
> On another note ... I'm trying to get at the node/treefragment that
> would be represented by "data" above.  FOP balks, saying that I can't
> convert a treefragment into a nodelist.

That's correct, you can't look inside a result tree fragment. XSLT 1.1
will eliminate the distinction, but in XSLT 1.0 you have to use an
extension function to convert a result tree fragment to a node-set.
Fortunately, vendors supply a foo:node-set() function with their XSLT
processors. The namespace and typical prefix for the "foo" is dependent on
the processor; check the docs for the one you are using.

However in your case, you have not created a result tree fragment with the 
code above. You have only identified a node-set. It should not cause any 
problems as-is. I suspect you are actually trying to do something like

<xsl:variable name="copiedData">
  <xsl:copy-of select="$theData">
</xsl:variable>
<xsl:value-of select="$copiedData/path/to/some/descendant/of/data"/>

when you should just be doing

<xsl:value-of select="$theData/path/to/some/descendant/of/data"/>


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


Current Thread