Subject: Re: [xsl] Calculating Column Total From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 29 Mar 2010 02:20:38 +0100 |
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
in > <xsl:template match="/"> > <xsl:value-of select="fns:sumMissing_template(event)"/>
<xsl:template match="/"> <xsl:value-of select="count(//event[@complete='N'])"/> </xsl;template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Calculating Column Total, Shashank Jain | Thread | RE: [xsl] Calculating Column Total, Shashank Jain |
RE: [xsl] Calculating Column Total, Shashank Jain | Date | RE: [xsl] Calculating Column Total, Shashank Jain |
Month |