This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to specify a path to a node in a nodeset using a variable


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]