[xsl] how to store attribute value?

Subject: [xsl] how to store attribute value?
From: Vinoth Palaniappan <vinoth@xxxxxxxxxxxx>
Date: Tue, 6 Aug 2002 16:17:29 +0530
Hi all,
I have a xml document as:
	<myroot  root_attribute="test_val">
		<a1/>
		<a1/>
	</myroot>
While processing the node "a1" using XSL, i need to access the value of
attribute "root_attribute" of it's parent. I tried to do in the following
way, but could not have a value-of construct within variable construct.
	<xsl:template match="myroot">
	<xsl:variable name="test_var" select="<xsl:value-of
select="@root_attribute"/>"></xsl:variable>
	<xsl:for-each select="child::*">
		<xsl:apply-templates select="*"></xsl:apply-templates>
	</xsl:for-each>
	</xsl:template>

	<xsl:template match="a1">
	<xsl:copy-of select="$test_var"/>
	</xsl:template>

How can i access the attribute of some node in the template match of another
node? Any help is appreciated. 
____________________________________________________________________________
___________
Vinoth
iDEN OMC Software, GSG
Motorola, India
voice: 91-040-3308090 extn:3208
____________________________________________________________________________
___________

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


Current Thread