| 
 
Subject: RE: [xsl] Make Hirachy from flat file From: Jarno.Elovirta@xxxxxxxxx Date: Tue, 14 Oct 2003 09:20:59 +0300  | 
Hi,
> So far I have only managed to get items grouped by the 
> row/data[1] element,
> but it is the "nested" gruoping by the row/data[2] element there is
> bothering me.
Did you want something in the lines of
  <xsl:key name="maingroup" match="row" use="data[1]"/>
  <xsl:key name="prodgroup" match="row" use="concat(data[1], ' ',data[2])"/>
  <xsl:template match="test">
    <xsl:copy>
      <xsl:for-each select="row[generate-id() = generate-id(key('maingroup', data[1]))]">
        <xsl:variable name="main" select="data[1]"/>
        <maingroup name="{$main}">
          <xsl:for-each select="../row[generate-id() = generate-id(key('prodgroup', concat($main, ' ',data[2])))]">
            <prodgroup name="{data[2]}">
              <xsl:for-each select="key('prodgroup', concat($main, ' ',data[2]))">
                <rows>
                  <itemno>
                    <xsl:value-of select="data[3]"/>
                  </itemno>
                  <description>
                    <xsl:value-of select="data[4]"/>
                  </description>
                </rows>
              </xsl:for-each>
            </prodgroup>
          </xsl:for-each>
        </maingroup>
      </xsl:for-each>
    </xsl:copy>
  </xsl:template>
Cheers,
Jarno - Smashing Pumpkins: Eye
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
  | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] Make Hirachy from flat file, Thomas V. Nielsen | Thread | SV: [xsl] Make Hirachy from flat fi, Thomas V. Nielsen | 
| Re: [xsl] Copying XML file over usi, Jarkko . Moilanen | Date | Re: [xsl] Copying XML file over usi, Mukul Gandhi | 
| Month |