|
Subject: Re: [xsl] Calculating Column Total From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 30 Mar 2010 22:49:34 +0100 |
Thanks David for explaining what I was doing wrong.
I am still stuck in the calculation for every event.
<data> <event_template sp_mand_doctypes="Research Note, Prior Stock Report, Stock Report"> <event complete='Y' complete_percent='100.0'/> <event complete='N' complete_percent='0.0'/> </event_template> <event_template sp_mand_doctypes=" Prior Stock Report, Stock Report"> <event complete='Y'complete_percent='100.0'/> <event complete='N'complete_percent='0.0'/> <event complete='N'complete_percent='50.0'/> <event complete='Y'/> </event_template> </data>
and I am using this xsl
<xsl:template match="/"> <xsl:sequence select="sum(//event/fns:f(.))"/> </xsl:template> <xsl:function name="fns:f"> <xsl:param name="x" as="element()"/> <xsl:choose> <xsl:when test="$x/@complete='Y'"> <xsl:value-of select="number(0)"/>
</xsl:when>
<xsl:when test="$x/@complete_percent='0.0'">
*********am not able to pass value in the variable "mandatoryDocs"*********************
<xsl:variable name="mandatoryDocs" select="parent::event_template/@sp_mand_doctypes"/>
you can't evaluate parent::event_template or any relative xpath as there
is no context node in the body of a function. You want the parent of the
$x parameter so that's select="$x/../@sp_mand_doctypes<xsl:variable name="strArray" select="tokenize($mandatoryDocs,',')"/>
<xsl:value-of select="number(count($strArray))"/>again there's no point in applying number() to count() as it's already an integer, but don't apply xsl:value-of to that.
</xsl:when> </xsl:choose> </xsl:function>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Calculating Column Total, Shashank Jain | Thread | [xsl] recursive loop in XSL stylesh, George |
| RE: [xsl] Calculating Column Total, Shashank Jain | Date | [no subject], Unknown |
| Month |