xsl-list
[Top] [All Lists]

RE: XPath expr on generated nodeset

2002-10-25 07:54:37
[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[(_at_)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



<Prev in Thread] Current Thread [Next in Thread>