This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Testing the following element
- From: "Dion Houston" <dionh at microsoft dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 17 Jul 2002 17:53:55 -0700
- Subject: RE: [xsl] Testing the following element
- Reply-to: xsl-list at lists dot mulberrytech dot com
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...
HTH!
Dion
-----Original Message-----
From: Philippe Figon [mailto:philippe.figon@passager.org]
Sent: Wednesday, July 17, 2002 6:37 PM
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] 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@passager.org
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