This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Testing using XPath
- To: Stuart Brown <Stuart dot Brown at helicon dot co dot uk>
- Subject: Re: [xsl] Testing using XPath
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 6 Sep 2001 14:55:29 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <6B7D48F33E62D511AE0900B0D0E1BB49020867@erato>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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