[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Inserting Elements with XSL

Subject: Re: Inserting Elements with XSL
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 4 Jun 2001 09:20:46 +0100
saxon inserting elements
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.