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

RE: Merging Data

Subject: RE: Merging Data
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Fri, 30 Apr 2004 22:31:20 +0200
xslt merge data match
> -----Original Message-----
> From: James Paul [mailto:jpaul@xxxxxxxxxxx]
>  
<snip />
> Does anyone have a recommended approach for tackling this issue?
>
>

Hi,

In plain English:
Define an xsl:key to approach the items by their item_number, apply
templates to those items whose generate-id() matches that of the first node
returned by the key when given that particular item_number, and inside the
items matching template, copy the item_number and then copy all other
children of the nodes returned by the key.

In XSLT, something in this direction:

<xsl:stylesheet ...>

<xsl:key name="by-number" match="ITEMS"
         use="ITEM_NUMBER" />

<xsl:template match="/">
  <xsl:apply-templates select="ITEMS[generate-id()=
                         generate-id(key('by-number',ITEM_NUMBER))]" />
</xsl:template>

<xsl:template match="ITEMS">
  <xsl:copy-of select="ITEM_NUMBER" />
  <xsl:copy-of select="key('by-number',ITEM_NUMBER)/*[
                 not(name()='ITEM_NUMBER')]" />
</xsl:template>

</xsl:stylesheet>

HTH!

Greetz,

Andreas

Current Thread
  • Merging Data
    • James Paul - Fri, 30 Apr 2004 16:05:02 -0400 (EDT)
      • Andreas L. Delmelle - Fri, 30 Apr 2004 16:23:38 -0400 (EDT) <=

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-2007 All Rights Reserved.