p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: Attribute of a parent node


Message #1 by "Parimel.Selvaraju" <selvarap@b...> on Wed, 5 Jun 2002 12:15:49 -0500
> I need help in getting the an attribute of the parent node of 
> the context node.

../@ID

Michael Kay
Software AG
home: Michael.H.Kay@n...
work: Michael.Kay@s... 

 I have the following XML <EXCLUSIONS> 
> <EXCLUSION @ID="1"> <ITEM ID="1" POSITION="1">abcd</ITEM> 
> <ITEM ID="2" POSITION="2">efgh</ITEM> <ITEM ID="3" 
> POSITION="3">ijkl</ITEM> </EXCLUSION> <EXCLUSION @ID="2"> 
> <ITEM ID="1" POSITION="1">abcd</ITEM> <ITEM ID="2" 
> POSITION="2">efgh</ITEM> <ITEM ID="3" 
> POSITION="3">ijkl</ITEM> </EXCLUSION> </EXCLUSIONS>
> -------
> and the simplified XSL
> 
> <xsl:template match="EXCLUSIONS">
> 	<xsl:for-each select="EXCLUSION/ITEM">
> 		<!-- Need @ID of parent of ITEM -->
> 		<xsl:value-of select="." />
> 	</xsl:for-each>
> </xsl:template>
> 
> I need to get the ID attribute of the EXCLUSION node when I'm 
> in the for-each loop. Any help is greatly appreciated.
> 
> Thanks,
> -Parimel
> 
> 


  Return to Index