|
Subject: RE: [xsl] Selecting a range of siblings between specified elements. From: Jarno.Elovirta@xxxxxxxxx Date: Mon, 8 Mar 2004 16:26:26 +0200 |
Hi,
> I'm currently a little puzzled on how to select a range of
> siblings between
> specified elements, e.g.
>
> <?xml version="1.0"?>
> <doc>
> <a>cont1</a><b/><b/>
> <a>cont2</a><b/><b/>
> <a>cont3</a><b/><b/><c/><c/>
> <a>cont4</a><b/><b/><c/><c/>
> </doc>
>
>
> I would like to select firstly the <b/><b/> of
>
> <a>cont1</a><b/><b/>
e.g. a[. = 'cont1']/following-sibling::b[position() <= 2]
> then the <b/><b/> of
>
> <a>cont2</a><b/><b/>
>
> then the <b/><b/> of
>
> <a>cont3</a><b/><b/><c/><c/>
>
> and finally the <b/><b/> of
>
> <a>cont4</a><b/><b/><c/><c/>
Erm... I wonder if you mean
<xsl:for-each select="a">
<xsl:apply-templates select="following-sibling::b[generate-id(preceding-sibling::a[1]) = generate-id(current()) ]"/>
</xsl:for-each>
I.e. you want to group b elements according to their previous a element. See Jeni's pages on grouping <http://jenitennison.com/xslt/grouping/>.
Cheers,
Jarno - KiEw: Graograman (Leæther Strip remix)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Selecting a range of sibl, Kenny Akridge | Thread | [xsl] Selecting a range of siblings, David Holden |
| RE: [xsl] Selecting a range of sibl, Andrew Welch | Date | Re: [xsl] Selecting a range of sibl, David Carlisle |
| Month |