[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Inserting Elements with XSL
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|