[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Testing using XPath


Subject: Re: [xsl] Testing using XPath
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 6 Sep 2001 14:55:29 +0100

Hi Stuart,

> How can I test from with the current node as element2, whether its parent's
> following-sibling[1] is element3?

When you test a node set then if there are any nodes in the node set
it returns true; if it's empty it returns false. The easiest test is
one that tries to select the immediately following sibling of the
current element's parent, but only if it's an element3 element.

Go to the parent with ..
Go to its immediately following sibling element with
following-sibling::*[1]
Only select it if it's an element3 element with the predicate
[self::element3]

Steps are separated by /s and predicates are placed at the end of the
step. So the path is:

  ../following-sibling::*[1][self::element3]

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



Current Thread