[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] XPath expr on generated nodeset


Subject: RE: [xsl] XPath expr on generated nodeset
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Fri, 25 Oct 2002 10:54:37 -0400

[Al Byers]
> 
> I generated a nodeset by assigning elements to a variable and 
> then converting the fragment to a nodeset, but normal XPath 
> expressions do not seem to work. I would appreciate any help 
> on figuring out what I am doing wrong. I am using Xalan 2.4.0. TIA Al
> 

If all you are doing is building a fixed set of nodes, there is no need
to convert RTFs to nodesets.  You can create a nodeset by putting them
in a named template and access them using document("").  This
illustrates how to construct your example -

<xsl:variable name='aNd' 
 
select='document("")/xsl:stylesheet/xsl:template[@name="fragment"]/aaa'/
>

....

<xsl:template name='fragment'>
    <aaa>
        <bbb>Stuff</bbb>
    </aaa>
</xsl:template>

This way works fine and does not depend on extension functions, so it is
fully portable.  Of course, it cannot be dynamically constructed, but it
works well for lookup tables and such.

Cheers,

Tom P

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



Current Thread
Keywords