[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to store attribute value?

Subject: Re: how to store attribute value?
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 06 Aug 2002 12:46:15 +0000
xslt store a value
<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@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.