xsl-list
[Top] [All Lists]

Dynamic XPath

2003-05-23 07:08:42
I want to create an XSLT expressions so that I can vary which nodes I
select,
I can't use [name() = $nodeName] because the depth of the path may change -
and I want to use paths not nodenames...

What I would like to do is:
        <!--<xsl:variable name="dynamicPath" select="/document/*[position()
= 2]" />-->
        <xsl:variable name="dynamicPath"
select="/document/section/keep/pear" />
        <xsl:variable name="textContent" select="{$dynamicPath}/text()" />
Which is not valid :( - so how can I create a dynamic path? Is it possible?
I'm using MSXML 4.0 under .Net

<document>
        <section>
                first section
                <keep>
                        first sub-section
                        <apple>
                        </apple>
                        <pear>
                        </pear>
                </keep>
                <house sid="1.2">
                        first sub-section
                        <fish>
                                <jumping>hello</jumping>
                        </fish>
                        <dog></dog>
                </house>
                <castle sid="1.3">
                        first sub-section
                </castle>
        </section>
</document>


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



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