[xsl] How to specify a path to a node in a nodeset using a variable

Subject: [xsl] How to specify a path to a node in a nodeset using a variable
From: "Shakeel Mahate" <shakeelmahate@xxxxxxxxxxx>
Date: Thu, 8 Mar 2001 11:39:19 -0500
I have the following scenario

INPUT.XML
<document>
  <group>
     <row>
        <label>User Id:</label>
        <entryfield name="/Person/UserId/@name"/>   <!-- Value of name is an
XPath expr -->
     </row>
  </group>
</document>

STYLESHEET.XSL
<xsl:stylesheet ...OMITTED...>
<xsl:param name="container" select= "document('container.xml')" />
...OMITTED...
<xsl:template match="entryfield">
  <xsl:variable name="path" select="string(@name)"/>
  <INPUT TYPE="text" NAME="{@name}">
     <xsl:attribute name="VALUE">
        <xsl:value-of select="$container/$path"/>
<!-- Here I want to fetch value of a node from nodeset $container identified
by $path -->
<!-- I know I can say $container/A/B/C/@D  which will fetch my value of
attribute D of C which is a child of B ...>
     </xsl:attribute>
  </INPUT>
</xsl:template>
...OMITTED...
</xsl:stylesheet>

I want to specify a path to a node in a nodeset using a variable.

I am at my wits end on how to acheive this functionality.  I went through
XSLT Programmer's reference and have not been able to figure out a solution.

Please help

Shakeel Mahate

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


Current Thread