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

RE: Testing the following element

Subject: RE: Testing the following element
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 18 Jul 2002 08:07:12 +0300
following element xsl
Hi,

> If I'm understanding you correctly, that you're interested in d's that
> are immediately followed by a c, simply add a predicate on the
> following-sibling axis:
> 
> d[following-sibling::*[1]=c]
> 
> This will select your first d, but not your second...

That will actually select all d elements whose first following sibling element has the same string value as one of the child c elements of d.

You want

  d[following-sibling::*[1][self::c]]

Santtu

> -----Original Message-----
> From: Philippe Figon [mailto:philippe.figon@xxxxxxxxxxxx] 
> Sent: Wednesday, July 17, 2002 6:37 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Testing the following element
> 
> Hello,
> 
> In a book I transform from xml to LaTeX using xslt, I have a 
> hierachical
> structure of this kind :
> 
> <Chapter>
>  <a><a1>hello</a1>
>   <b>
>    <c>blah blah</c>
>    <d>
>     <c>blah blah</c>
>    </d>
>    <c>blah blah</c>
>   <d>
>    <c>blah blah</c>
>   </d>
>   <e>
>    <c>blah blah</c>
>   </e>
>  </b>
> </a>
> </Chapter>
> 
> And I want to test if the <d>..</d> element is followed immediately
> (that's
> the point) by an <c>..</c> element. The case of a <c>..</c> element
> included
> in something else (an <e>..</e> here) mustn't validate the 
> test. To put
> it
> simple, with the example above, I want the first <d>...</d> element to
> match
> a certain template, while the second <d>...</d> must match another
> template.
> Using test="following-sibling::c" doesn't work for it's always valid
> when a
> <c>..</c> element is included in one of the following brother of
> <d>..</d>.
> I've tried to add some position test but I can't make it work 
> properly.
> 
> Can anyone help ?
> 
> Thanks
> 
> Philippe
> 
> philippe.figon@xxxxxxxxxxxx
> 
> Philippe
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.