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]
Other format: [Raw text]

RE: accessing attributes at different nodes


Hi All, 

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

Thanks

Karen

-----Original Message-----
From: Clifford, Karen [mailto:Karen.Clifford@fid-intl.com]
Sent: Friday, September 20, 2002 2:59 PM
To: 'xsl-list@lists.mulberrytech.com'
Subject: [xsl] 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


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