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

Re: following-sibling question

Subject: Re: following-sibling question
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sat, 22 Dec 2007 15:20:53 +0530
Re:  following-sibling question
Please try this

/items/item[(@id='a') or (@id='c') or (@id='f') or
(preceding-sibling::item[@id='a'] and
following-sibling::item[@id='c'] and not(@id='d'))]

(not tested)

On Dec 22, 2007 11:18 AM, Ken Tam <kentam@xxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I have the following XML sample data:
>
> <items>
>   <item id="a"/>
>   <item id="b"/>
>   <item id="c"/>
>   <item id="d"/>
>   <item id="e"/>
>   <item id="f"/>
> </items>
>
> and a search requirement to select nodes starting with id="a" passing id="c"
> with anything in between and ending in "f" but must not pass through "d".
> Thus, the above sample is not a match. Here is a sample that is a match:
>
> <items>
>   <item id="a"/>
>   <item id="b"/>
>   <item id="b"/>
>   <item id="e"/>
>   <item id="c"/>
>   <item id="e"/>
>   <item id="f"/>
> </items>
>
> I am not sure how to write the XPATH expression to filter on the "must not
> pass through "d" requirement. For example,
>
> /items/item[@id="a"]/following-sibling::item[@id="c"]/following-sibling::ite
> m[@id != "d"]/following-sibling::item[@id="f"]
>
> doesn't work as "e" is picked up.
>
> Thanks,
> Ken


-- 
Regards,
Mukul Gandhi

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.