[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Make Hirachy from flat file

Subject: RE: Make Hirachy from flat file
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 14 Oct 2003 09:20:59 +0300
data hirachy
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.