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

Re: To self or not to self

Subject: Re: To self or not to self
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Fri, 27 Jan 2012 10:25:10 -0500
Re:  To self or not to self
> //figure/preceding-sibling::*[1][figure]

The default axis is "child::", so this should be the same as

//figure/preceding-sibling::*[1][child::figure]


But you said you want the <figure> that has an immediate preceeding
sibling. The path

//figure/preceding-sibling::*[1][self::figure]

picks up the preceding sibling itself, not the <figure> that has the
preceding sibling. Perhaps you want something like

//figure[preceding-sibling::*[1][self::figure]]


> I wanted to isolate the figure element that has a figure as an
> immediate preceding sibling.
> 
>        <section role="All_models">
>             <title>All models</title>
>             <figure role="Harness_multi-plug">
>                 <title>ECU harness multi-plug</title>
>                 <mediaobject>
>                     <imageobject>
>                         <imagedata fileref="78650"/>
>                     </imageobject>
>                 </mediaobject>
>             </figure>
>             <figure role="Circuit_diagram">
>                 <title>System circuit diagram</title>
>                 <mediaobject>
>                     <imageobject>
>                         <imagedata fileref="31544"/>
>                     </imageobject>
>                 </mediaobject>
>             </figure>
>         </section>
> 
> I settled on //figure/preceding-sibling::*[1][figure] but it gave back
> nothing and would only work when I used the explicit form of the self
> axis.
> 
> I settled on //figure/preceding-sibling::*[1][self::figure]
> 
> However if I want the title element immediately preceding figure I
> don't need to use the explicit form. This works
> 
> //figure/preceding-sibling::*[1][title]
> 
> So what is going on in this particular case (because I don't
> understand the difference), and in general when is explicit self
> required.

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.