Subject: Re: [xsl] Updating XML From: Marko Petersen <lg002237@xxxxxxxxxxxxxxxx> Date: Tue, 17 Dec 2002 21:21:58 +0100 |
thanks for your reply. I tried your idea using the self:: axis and it works pretty good while using a smaller select statement. I think I will use this one.
Hi Marko,
> <!-- apply all elments except section, simplesect, index and > bibliography, but also apply index and bibliography, if > they are followed by an element which is not index or > bibliography --> > <xsl:apply-templates select="*[( > not(name() = 'section') and > not(name() = 'simplesect') and > not(name() = 'index') and > not(name() = 'bibliography') > ) or ( > ( > name() = 'index' or > name() = 'bibliography' > ) and > following-sibling::*[ > not(name() = 'index') and > not(name() = 'bibliography') > ])]"/>
You could simplify this by using the self:: axis rather than testing using the name() function (the self:: axis is also better because it's namespace-aware):
<xsl:apply-templates select="*[not(self::section or self::simplesect or self::index or self::bibliography)] | (index | bibliography) [not(following-sibling::index or following-sibling::bibliography)]" />
Alternatively, you could use a mode. Apply templates in "non-section" mode:
<xsl:apply-templates mode="non-section" />
and then have templates in that mode that do nothing for the section etc. elements:
<xsl:template match="section | simplesect | index | bibliography" mode="non-section" />
<xsl:template match="index[not(following-sibling::index or following-sibling::bibliography)] | bibliography[not(following-sibling::index or following-sibling::bibliography)]"> ... </xsl:template>
Cheers,
Jeni
--- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Updating XML, Jeni Tennison | Thread | [xsl] incrementing dates with varia, Mac Rost |
Re: [xsl] combining two variables t, Jeff Kenton | Date | RE: [xsl] combining two variables t, Wendell Piez |
Month |