xsl-list
[Top] [All Lists]

RE: [xsl] Calculating Column Total

2010-03-28 20:13:47

All,

It looks like I have made it look very simple.
Actually the variable "Num_Docs_Missing" perform some calculation and from 
there I get different values.

<xsl:template match="/">


        <xsl:value-of select="fns:sumMissing_
template(event)"/>

 </xsl:template>



<xsl:function name="fns:sumMissing_template">

  <xsl:param name="everyEvent" as="element()*"/>

    <xsl:variable name="Num_Docs_Missing">

         <xsl:choose>

                <xsl:when test="@complete='Y'">

                    *****Some Calculations**********

                </xsl:when>

                <xsl:otherwise>

                      *****Some Calculations**********

                </xsl:otherwise>

         </xsl:choose>

    </xsl:variable>

<xsl:sequence select="sum(for $x in $everyEvent 
return($Num_Docs_Missing))"/>

</xsl:function>

Thanks again.
Shashank

----------------------------------------
From: shashankjain(_at_)live(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Sun, 28 Mar 2010 19:57:12 -0500
Subject: RE: [xsl] Calculating Column Total


All,



I am stuck in calculating total of another column.



My XML is







<data>

  

<event_template sp_doctypes="Research Note, Prior Stock Report, Stock
 Report">



      <event  complete='Y' />



      <event  complete='N' />



  </event_template>



  <event_template sp_doctypes=" Prior Stock Report, Stock Report">



      <event  complete='Y' />



      <event  complete='N' />



      <event  complete='N' />



      <event  complete='Y' />

 

</event_template>

</data>





This is the xsl I am using



<xsl:template match="/">

        <xsl:value-of select="fns:sumMissing_template(event)"/>

 </xsl:template>



<xsl:function name="fns:sumMissing_template">

  <xsl:param name="everyEvent" as="element()*"/>

    <xsl:variable name="Num_Docs_Missing">

         <xsl:choose>

                <xsl:when test="@complete='Y'">

                    <xsl:value-of select="0"/>

                </xsl:when>

                <xsl:otherwise>

                     <xsl:value-of select="1"/>

                </xsl:otherwise>

         </xsl:choose>

    </xsl:variable>

<xsl:sequence select="sum(for $x in $everyEvent 
return($Num_Docs_Missing))"/>

</xsl:function>



I am trying to calculate the sum of $Num_Docs_Missing for all the 
events.

Please let me know where I am doing wrong.



Thanks

Shashank

From: shashankjain(_at_)live(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Fri, 26 Mar 2010 07:30:06 -0500
Subject: RE: [xsl] Calculating Column Total


Thanks a lot Mukul.

Its working.

Shashank

From: gandhi(_dot_)mukul(_at_)gmail(_dot_)com
Date: Thu, 25 Mar 2010 09:07:54 +0530
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Calculating Column Total

you may write a XSLT function as following, for this need:







and call it as following:



PS: this is not tested.

On Thu, Mar 25, 2010 at 1:03 AM, Shashank Jain  wrote:

HI All,



I am trying to calculate the total of all the columns which I am

creating dynamically.



My XML is







      

      

      

  


      

      

       

      

 

 



and this is the template I am using





         

        

        

        

    

    





What I am trying to achieve is the total of events*(test) for all the

event_template.

I am able to do it for individual event_template but not able to add
them all.



Thanks



--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
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: 
--~--


_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_2
--~------------------------------------------------------------------
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: 
--~--


_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_1
--~------------------------------------------------------------------
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: 
--~--

                                          
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_2
--~------------------------------------------------------------------
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>
--~--