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

Re: Finding the closest preceding element within the

Subject: Re: Finding the closest preceding element within the containing block
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Sun, 20 May 2012 22:14:41 -0400
Re:  Finding the closest preceding element within the
Did you get an answer yet?

I'm suspicious that what you want is
  preceding-sibling::c[1]


> Assume a document structure like the one below. The "c" and "d"
> elements are at the same level inside of "b" which is inside of
> "a". Currently, I can find the first "c" in the "b" that encloses
> "d". But that is too far away. I want to find the closest preceding
> "c" within the surrounding "b" when processing the template for
> element "d".
> 
> When executing the template for "d", my current path attempt is
> (ancestor::a[1]//c)[1]

> But, if there is no preceding "c" in the "b" element, I'd like to
> detect that, and not find a "c" in any other "b". If I use just
> "preceding::c", I might find a "c" in some other "b", which I don't
> want.
> <a>
>    ...
>    other elements
>    ...
> </a>
> <a>
>    ...
>    other elements
>    ...
> </a>
> <a>
>    <b>
>    ...
>    </b>
>    ...
>    <b>
>       ...
>       <c/>   <---- My path gets this "c"
>       ...
>       <c/>
>       ...
>       <c/>   <---- I want this "c" when processing "d"
>       ...
>       <d/>
>       ...
>       <c/>
>       ...
>    </b>
>    ...
>    <b>
>    ...
>    </b>
> </a>
> <a>
>    ...
>    other elements
>    ...
> </a>
> ...

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.