Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Get the value based on Previous Node value

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 2/1/2007 2:23:00 PM


"christy" <christy@d...> wrote in message
news:CF703BF5-2503-418B-AEA4-04DCF3A104FA@m......
> <root>
>   <A>
>   ....
>   </A>
>   <B>
>      ....
>      <ID>123</ID>
>      <DESC>test123..</DESC>
>      <ID>456</ID>
>      <DESC>test456..</DESC>
>      ....
>   </B>
> </root>
>
> I am matching A:
>
> <xsl:template match="A">
>    ...
>    <xsl:element name="newDesc">
>       ***
>       *** I need help to select the value of DESC only if /root/B/ID = 456
***
>       ***
>    </xsl:element>
>    ...
> </xsl:template>
>
> I tried
>
> <value-of select="/root/B/DESC[root/B/ID/text('456')]
>
> but it didn't seem to work.

If you have the option (and the XML is a representative of the real XML)
change the input XML to:-

<DESC @ID="123">test123...</DESC>
<DESC @ID="456">test456...</DESC>

The xpath becomes:-

/root/B/DESC[@ID='456']

Good XML design would not associate elements the occur multiple times by
their position in relation to each other.  The whole point of having a
heiarchical structure is to be able to group related elements together under
a parent element.

Anthony


>
> Thanks.




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent