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

RE: XML merge

Subject: RE: XML merge
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 14 May 2003 12:16:04 +0300
merge column in xslt
Hi,

> So I have an XML, which contains many same nodes:
> <TABLE_NAME>ConnectionTemp</TABLE_NAME>, and each of them have a
> <COLUMN_NAME>, which are different.
> 
> I'd like make a new XML file from this above, which contains the
> TABLE_NAME node only one for every value of this, and the 
> children of this
> are the COLUMN_NAME nodes. Like this:

Your's is a grouping problem--see Jeni's pages <http://jenitennison.com/xslt/grouping>.

  <xsl:key name="name" match="Table" use="TABLE_NAME" />  
  <xsl:template match="Tables">    
    <xsl:copy>      
      <xsl:for-each select="Table[generate-id(.) = generate-id(key('name', TABLE_NAME))]">        
        <Table name="{TABLE_NAME}">          
          <xsl:for-each select="key('name', TABLE_NAME)">            
            <Column name="{COLUMN_NAME}"/>          
          </xsl:for-each>        
        </Table>      
      </xsl:for-each>    
    </xsl:copy>  
  </xsl:template>

Cheers,

Jarno - Covenant: Speed (Live)

 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.