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

Re: Conditional Merging of the node based child valu

Subject: Re: Conditional Merging of the node based child value match
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Sat, 16 Sep 2006 09:55:10 +0200
Re:  Conditional Merging of  the node based  child valu
Senthilkumaravelan Krishnanatham wrote:

Hi All,
I have following xml as my input and I need to group the item number with the corresponding line item number and form the out as mentioned below.
I would like to how to group the nodes based the condition and form the output.
Hi Senthil,

I don't see such a thing as a line item number in your code, but it appears to me you are actually talking about ITEM_NUMBER that must equal, and you want to group the CTO_INFO elements inside the CTOS section, when these ITEM_NUMBER match. Something like that. If that's so, here's a stylesheet that (almost) produces that output you have. You probably want to tweak it a bit. For instance, it currently outputs an empty CTOS element when there are no matchin ITEM_NUMBER nodes.

Have fun with it,

Cheers,
Abel Braaksma
http://abelleba.metacarpus.com

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />
<xsl:template match="/">
<ORDER>
<xsl:apply-templates select="ORDER/TAB_ITEM" />
</ORDER>
</xsl:template>
<xsl:template match="TAB_ITEM">
<xsl:variable name="nr" select="ITEM_NUMBER" />
<TAB_ITEM>
<xsl:copy-of select="*" />
<CTOS>
<xsl:apply-templates select="../TAB_CTO[ITEM_NUMBER = $nr]/CTO_INFO" />
</CTOS>
</TAB_ITEM>
</xsl:template>
<xsl:template match="CTO_INFO">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>


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.