This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: how to store attribute value?
- From: "Vasu Chakkera" <vasucv at hotmail dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 06 Aug 2002 12:46:15 +0000
- Subject: Re: [xsl] how to store attribute value?
- Reply-to: xsl-list at lists dot mulberrytech dot com
<xsl:variable name="test_var" select="<xsl:value-of
select="@root_attribute"/>"></xsl:variable>
** The above is incorrect **
you should try instead, the following
<xsl:variable name="test_var">
<xsl:value-of select="@root_attribute"/>
</xsl:variable>
and if you want to make use of a variable in another template, you may wish
to pass that variable as a parameter to the template..
and u can then use that variable.
Hope this helps
Vasu
From: Vinoth Palaniappan <vinoth@mihy.mot.com>
Reply-To: xsl-list@lists.mulberrytech.com
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] how to store attribute value?
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
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list