Florent Georges wrote:
Abel Braaksma wrote:
the parent node if the current node is its first child,
and the preceding sibling, if the current node is not the
first child of its parent.
Which reads the following in XPath:
( parent::*[1]|preceding-sibling::*[1] )[last()]
Nice shortcut! I like it much better than my original solution (which
looks awkward with generate-id). The predicate [1] is not needed on
parent::, it always returns one node.
The OP wanted to test for 'test1' or 'text' nodes, which, when added to
your solution, becomes:
(parent::* | preceding-sibling::*[1] )[last()][self::test1 | self::text]
-- Abel
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--