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

RE: accessing attributes at different nodes

Subject: RE: accessing attributes at different nodes
From: "Clifford, Karen" <Karen.Clifford@xxxxxxxxxxxx>
Date: Fri, 20 Sep 2002 16:42:25 +0100
accessing attributes in xsl
Hi All, 

Ive sorted this by discovering finally the <xsl:variable> command.

Thanks

Karen

-----Original Message-----
From: Clifford, Karen [mailto:Karen.Clifford@xxxxxxxxxxxx]
Sent: Friday, September 20, 2002 2:59 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject:  accessing attributes at different nodes 


Hi there,

I have an accessing question.....my xml file is similar to the following:


<sect1>
	<sect2 attrA = 'a'  />
	<sect2 attrA = '2'  />
	<sect2 attrA = 'ab'  />

	<sect3>
		<sect4>
			<sect5> Value</sect5>
			<sect5 attr1='ab' attr2='cd'> Value</sect5>
					.................etc..............

I am in a section of XSL code beginning with....

<xsl:template match="sect5">

Within this code I must do....
 If sect5 contains attr1 and attr2 then  
		Create a html attribute        
	for each <sect2> check if attrA=attr1 or attr2
		if so then attrA is the attribute value


<xsl:template match="sect5">
	 <xsl:if test="@attr1 and @attr2">
			<xsl:attribute name="temp">
				<xsl:for-each select="../../../sect2">
					<xsl:if test="@attrA = @attr1 or
@attr2"> ****Problem Here*****
						<xsl:value-of
select="@attrA">

My problem is that the <xsl:for-each select="../../../colspec"> is puts
<sect2> as the context node and I am unable to access the attr1 attribute.
Im a newbie so I dont really know how to access this yet....Ive tried
//attr1 and putting in the whole path (and a number of other crazy things).
Any pointers would be appreciated.

Thanks

Karen




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

 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.