xsl-list
[Top] [All Lists]

RE: Combining two node Sets into one

2005-04-05 14:05:54
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[(_at_)code
=
current()]/AwdDetail/AwdSchools/AwdSchool/AwdTerm/Disbs/DisbDetail/DAmount)"
/>
                                <xsl:variable name = "sumOfRef" select =
"sum(../../CAProgram[(_at_)code =
current()]/AwdDetail/AwdSchools/AwdSchool/AwdTerm/Refunds/RefDetail/RAmount)
"/>
                                <xsl:apply-templates select =
"../../CAProgram[(_at_)code = current()]/pathreplaced/DisbDetail |
../../CAProgram[(_at_)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(_at_)kheaa(_dot_)com] 
Sent: Friday, April 01, 2005 5:40 PM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] Combining two node Sets into one


Who should I sue for my wasted time? ;)

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Friday, April 01, 2005 5:37 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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/





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>