|
Subject: RE: [xsl] Combining two node Sets into one From: "Williamson, Chris" <cwilliamson@xxxxxxxxx> Date: Tue, 5 Apr 2005 17:05:54 -0400 |
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> </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: [xsl] 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: [xsl] 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Combining two node Sets i, Williamson, Chris | Thread | [xsl] output node-set, 04083259 |
| RE: [xsl] xsl formating string, Michael Kay | Date | RE: [xsl] xsl formating string, JBryant |
| Month |