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

RE: Combining two node Sets into one

Subject: RE: Combining two node Sets into one
From: "Williamson, Chris" <cwilliamson@xxxxxxxxx>
Date: Tue, 5 Apr 2005 17:05:54 -0400
concat two nodesets
Figured I would post the solution that finally created my output.  Any
comments are welcome.. As I'm sure this is not the greatest solution.
These are just the two main templates/for-each.  The "bottom" template that
is called just prints a bottom to the row that contains some form
components. 

<xsl:for-each select = "$uniqueCodes">
	<xsl:variable name = "sumOfDisb" select = "sum(../../CAProgram[@code
=
current()]/AwdDetail/AwdSchools/AwdSchool/AwdTerm/Disbs/DisbDetail/DAmount)"
/>
				<xsl:variable name = "sumOfRef" select =
"sum(../../CAProgram[@code =
current()]/AwdDetail/AwdSchools/AwdSchool/AwdTerm/Refunds/RefDetail/RAmount)
"/>
				<xsl:apply-templates select =
"../../CAProgram[@code = current()]/pathreplaced/DisbDetail |
../../CAProgram[@code = current()]/pathreplaced/RefDetail">
					<xsl:sort select = "RDate | DDate"/>
				</xsl:apply-templates>
			    <xsl:call-template name = "bottom">
    				<xsl:with-param name = "totalDisb" select =
"$sumOfDisb - $sumOfRef"/>
    			</xsl:call-template>
			</xsl:for-each>


<xsl:template match = "/fullpathreplaced/DisbDetail |
/fullpathreplaced/RefDetail">
        	<xsl:param name = "sumOfDisb"/>
        	<xsl:param name = "sumOfRef"/>
        	<tr>
        		<xsl:choose>
        			<xsl:when test = "position() = 1">
   						<td class = "bg_1">
 
<strong><xsl:value-of select = "../../../../../../@code"/></strong>
   						</td>
   					</xsl:when>
   					<xsl:otherwise>
   						<td>&#160;</td>
   					</xsl:otherwise>
   				</xsl:choose>
   				<xsl:if test = "local-name() =
'DisbDetail'">
    				<td class = "bg_1" align =
"right"><xsl:value-of select = "DAmount"/></td>
    				<td class = "bg_1" align =
"center"><xsl:value-of select = "DDate"/></td>
    			</xsl:if>
    			<xsl:if test = "local-name() = 'RefDetail'">
    				<td class = "bg_1" align =
"right"><xsl:value-of select = "concat('(-) ', RAmount)"/></td>
    				<td class = "bg_1" align =
"center"><xsl:value-of select = "RDate"/></td>
    			</xsl:if>
   			</tr>
	</xsl:template>

-----Original Message-----
From: Williamson, Chris [mailto:cwilliamson@xxxxxxxxx] 
Sent: Friday, April 01, 2005 5:40 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE:  Combining two node Sets into one


Who should I sue for my wasted time? ;)

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
Sent: Friday, April 01, 2005 5:37 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Combining two node Sets into one


> You can probably tell my inexperience with this because I probably 
> opted to take the most complex path possible.  I will give this a try
> on Monday and
> see what I can come up with.  

No, writing pipelines of simple transformations is in general an excellent
way of breaking up a problem into simple reusable parts. Your instincts were
right. It's just a darned nuisance that XSLT 1.0 doesn't support this
approach properly.

Michael Kay
http://www.saxonica.com/

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.