[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Selecting nodes based on previous node values


Subject: RE: [xsl] Selecting nodes based on previous node values
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Dec 2008 09:25:17 -0000

> Assume the following XML snippet.
> 
> <demo>
>     <library>
>         <criteria><status  value="active"/></criteria>
>         <books><book title="test"/></books>
>     </library>
>     <library>
>         <criteria><status  value="notActive"/></criteria>
>         <books><book title="this may not be visible"/></books>
>     </library>
> </demo>
> 
> I want to print all book titles in library with criteria 
> status = "active".

Try:

select="demo/library[criteria/@value='active']/books/book

Michael Kay
http://www.saxonica.com/


Current Thread
Keywords
xml