Subject: RE: Selecting nodes based on previous node values
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Dec 2008 09:29:25 -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
Sorry, I missed the status element. That should be
select="demo/library[criteria/status/@value='active']/books/book
Michael Kay
http://www.saxonica.com/
|