This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Inserting Elements with XSL
- To: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- Subject: Re: [xsl] Inserting Elements with XSL
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Mon, 4 Jun 2001 09:20:46 +0100
- CC: XSL List <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <3B17CB57.CBF813D1@zkb.ch>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Joerg,
> I tried
>
> <xsl:template match="(a|b|c|d|e)[not(following-sibling::b|following-sibling::c|
> following-sibling::d|following-sibling::e|following-sibling::f)]">
> <xsl:copy-of select="."/>
> <f/>
> </xsl:template>
>
> but this is apparently not a valid match pattern (saxon 6.3 complains).
> And it's not really more comprehensible.
>
> Using
> <xsl:template match="*[(name()='a' or name()='b' or ...)
> and not(following-sibling::*[name()='b' or ...])]">
> <xsl:copy-of select="."/>
> <f/>
> </xsl:template>
>
> isn't all that much more attractive either.
Well, your match pattern above is the same as:
*[self::a or self::b or self::c or self::d or self::e or self::f]
[not(following-sibling::*
[self::a or self::b or self::c or self::d or self::e or
self::f])]
This will match any a, b, c, d, e or f element that doesn't have a
following a, b, c, d, e or f element as a sibling. In other words, it
matches the last a, b, c, d, e or f element within its parent. A
simpler way of doing that would be:
*[self::a or self::b or self::c or self::d or self::e or self::f]
[last()]
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list