Jump to content

Attribute value of of a node based on its attribute

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...