Jump to content

Attribute value of of a node based on its attribute


rnv
 Share

Recommended Posts

Hi, I have to find an attribute value of an element based on its another attribute. example xml: <catalog> <cd id="1" title="xxx" related="3"> <artist>Bob Dylan</artist> </cd> <cd id="2" title="xxx" related="1"> <artist>xxxx</artist> </cd></catalog> for example when parsing through the second node i got the related item specified by the attribute (related="1"). Based on this value I need to get the title of the CD. that is - Find the element CD with id="1"- get the title of that element I am able to get the element using the following xpath: <xsl:template name="get-title-from-id"> <xsl:param name="id" /> <xsl:value-of select="//catalog/cd[@id=1]"/></xsl:template> but how do I get the title? will really appreciate regards,rnv

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...