[xsl] accessing attributes at different nodes

Subject: [xsl] accessing attributes at different nodes
From: "Clifford, Karen" <Karen.Clifford@xxxxxxxxxxxx>
Date: Fri, 20 Sep 2002 14:58:46 +0100
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


Current Thread