[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] grouping adjacent siblings
Subject: RE: [xsl] grouping adjacent siblings From: utah@xxxxxxxxxxxxxxx Date: Thu, 3 May 2001 13:02:18 -0400 (EDT) |
On Thu, 3 May 2001, Michael Kay wrote: > > I am trying to transform the following... > > > > <frag> > > <b>house</b> > > <a>door</a> > > <a>wall</a> > > <a>room</a> > > <b>barn</b> > > <a>hay</a> > > <a>cow</a> > > <a>poo</a> > > </frag> > > > You can do this with something like > > <xsl:for-each select="b"> > <xsl:variable name="id" select="generate-id()"/> > <xsl:apply-templates/> > <xsl:for-each > select="following-sibling::a[generate-id(preceding-sibling::b[1])=$id]"> > <xsl:apply-templates/> > </xsl:for-each> > </xsl:for-each> > > Mike Kay > Software AG thanks Michael... just to make sure i understand before i proceed... so I generate a unique id for the current context of <<b>>... (which defines a local variable named $id) then I select following <<a>> siblings using the condition that the preceding <<b>> sibling must have the same id. Therefore if the following <<a>> occurs after the following <<b>> it is not included in the result... thanks again.. Utah Ingersoll utah@xxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] grouping adjacent sibling, Michael Kay | Thread | Re: [xsl] Â / em dash bug?, David Carlisle |
Re: [xsl] creating a toc with links, Patricia Quintin | Date | RE: [xsl] How can i transform outpu, Larry_Mason |
Month |