|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Merging Data
> -----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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






