[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How to unflatten the source XML ?


Subject: RE: [xsl] How to unflatten the source XML ?
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 6 Nov 2003 08:51:14 +0200

Hi,

> Would you please tell me how to group fixed number (say 3) of 
> consecutive node together?

  <xsl:template match="*[item]">
    <xsl:for-each select="item[position() mod 3 = 1]">
      <group id="{position()}">
        <xsl:copy-of select=". | following-sibling::item[position() &lt; 3]"/>
      </group>
    </xsl:for-each>
  </xsl:template>

Cheers,

Jarno - Project Pitchfork: Carrion

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



Current Thread