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

RE: Compute sum of a computed node list

Subject: RE: Compute sum of a computed node list
From: vsubramanian@xxxxxxxxxx
Date: Thu, 6 May 2004 09:43:39 -0400
xslt compute
"Could you provide a small sample input and template that generates the
error where you would have expected otherwise?

Regards,
Ragulf Pickaxe :) "

THE XSLT FILE
===================    

<xsl:template match="abcd_list">
        <abcd_list>
            <xsl:for-each select="abcd">
                <abcd>                 
                    <xsl:variable name="state_local_salary"
select="state_local_salary"/>
                    <xsl:variable name="quarterly_sessions"
select="quarterly_sessions"/>
                    <xsl:variable name="non_medicaid_sessions"
select="non_medicaid_sessions"/>                    
                    <xsl:variable name="var_state_local_match"
select="$state_local_salary * ($quarterly_sessions div
($non_medicaid_sessions))"/>
                     
              
                    <state_local_match>
                        <xsl:value-of
select="format-number($var_state_local_match,'###,###.##','MyFormat')"/>
                    </state_local_match>

                </abcd>
            </xsl:for-each>
            <state_local_match_total>
            <xsl:value-of
select="format-number(sum(rehab/state_local_match[number(.)!='-']),'###,###.
##','MyFormat')"/>
        </state_local_match_total>
        </abcd_list>
    </xsl:template>

SAMPLE FILE
===============

<?xml version="1.0" encoding="UTF-8"?>
<abcd_list>
    <abcd num="1">        
        <state_local_salary>1600.0</state_local_salary>
        <quarterly_sessions>12</quarterly_sessions>
        <non_medicaid_sessions>2</non_medicaid_sessions>        
    </abcd>
    <abcd num="2">        
        <state_local_salary null="true"/>
        <quarterly_sessions>9</quarterly_sessions>
        <non_medicaid_sessions>2</non_medicaid_sessions>        
    </abcd>
    <abcd num="3">        
        <state_local_salary>1700.0</state_local_salary>
        <quarterly_sessions>7</quarterly_sessions>
        <non_medicaid_sessions>2</non_medicaid_sessions>       
    </abcd>
    <abcd num="4">       
        <state_local_salary>1700.0</state_local_salary>
        <quarterly_sessions>5</quarterly_sessions>
        <non_medicaid_sessions>2</non_medicaid_sessions>        
    </abcd>
</abcd_list>

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.