Re: [xsl] axis for self and 2 following siblings

Subject: Re: [xsl] axis for self and 2 following siblings
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 3 Jan 2003 01:19:44 +0000
Hi Xiaocun,

>   I currently have the following in one of my
> template, basically processes the self and the 2
> following sibling cells with the same template:
>
> <xsl:apply-templates select="."
> mode="InlineAttachment"/>
> <xsl:apply-templates
> select="following-sibling::cell[@column=current()/@column+1]"
> mode="InlineAttachment"/>
> <xsl:apply-templates
> select="following-sibling::cell[@column=current()/@column+2]"
> mode="InlineAttachment"/>
>
> Is there a more elegent way to group them use axis and
> process them via xsl:for-each?

You can combine these three apply-templates into one:

<xsl:apply-templates select=". |
                             following-sibling::cell
                               [@column=current()/@column+1 or
                                @column=current()/@column+2]"
                     mode="InlineAttachment"/>

You could use positional predicates instead if you wanted, from the
sounds of it.
                     
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread