[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Need help OR'ing in XPATH.

Subject: Re: Need help OR'ing in XPATH.
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 22 Mar 2006 14:25:38 +0530
Re:  Need help OR'ing in XPATH.
Please try this

<xsl:apply-templates select="book[(owner = 'aaa') or (chapter/owner =
'aaa')]" />

Regards,
Mukul

On 3/22/06, Glen Mazza <grm7793@xxxxxxxxxxx> wrote:
> Hello,
>
> For my contrived example below, I would like to select all book nodes
> whose owner is "aaa" *or* which have a chapter whose owner is "aaa", and
> I would like the books to be retrieved in the same general order as the
> xml document, i.e., the query for the example below would process books
> with id's 1, 3, 4 (in that order), not 1, 4, 3.
>
> I can do the XPATH for *either* of the two cases, but don't know how to
> combine the two for an OR search in my xsl:apply-templates select
statement.
>
> <xsl:a-t select="book[owner='aaa'] or book/chapter[owner='aaa']"/>
>
> is kind of what I want, but Xalan is complaining that my select
> attribute is just returning a boolean, so my syntax is apparently wrong.
>
> Any help would be much appreciated.
>
> Thanks,
> Glen
>
>
> <book id="1">
>     <owner>aaa</owner>
>     <chapter>
>         <owner>bbb</owner>
>     </chapter>
>     <chapter>
>         <owner>ccc</owner>
>     </chapter>
> </book>
> <book id="2">
>     <owner>bbb</owner>
>     <chapter>
>         <owner>bbb</owner>
>     </chapter>
>     <chapter>
>         <owner>ccc</owner>
>     </chapter>
> </book>
> <book id="3">
>     <owner>ccc</owner>
>     <chapter>
>         <owner>aaa</owner>
>     </chapter>
>     <chapter>
>         <owner>ccc</owner>
>     </chapter>
> </book>
> <book id="4">
>     <owner>aaa</owner>
>     <chapter>
>         <owner>bbb</owner>
>     </chapter>
>     <chapter>
>         <owner>ccc</owner>
>     </chapter>
> </book>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.