![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Get the value based on Previous Node value [Thread Next] Re: Get the value based on Previous Node valueTo: 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.
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
