Welcome to WebmasterWorld Guest from 54.205.108.212

Forum Moderators: open

Message Too Old, No Replies

Why can I not get back a number from any of these methods

XSL adding two numbers

     
2:12 pm on Oct 24, 2006 (gmt 0)

New User

10+ Year Member

joined:Oct 24, 2006
posts:3
votes: 0


Why can I not get back a number from any of these methods adding the two variables defined here.

Since the first example returns values, I know my variables are not null.

<!--VARIBALE1 -->
<xsl:variable name="CountedSubTotal">
<xsl:value-of select="format-number(sum(SummaryReportSection1/Counted), '$##########0.00')"></xsl:value-of>
</xsl:variable>

<--!VARIABLE2 -->
<xsl:variable name="CountedTotal">
<xsl:value-of select="format-number(sum(SummaryReportSection2/Counted), '$##########0.00')"></xsl:value-of>
</xsl:variable>

<!--This returns the two numbers but as a string - example: $1689.19 + $859.37 -->
<xsl:copy-of select="$CountedTotal"/> + <xsl:copy-of select="$CountedSubTotal"/>

<!--All these other return NaN -->
<xsl:variable name="CountedTotalLine">
<xsl:value-of select="$CountedTotal + $CountedSubTotal"/>
</xsl:variable>
<xsl:copy-of select="$CountedTotalLine"/>

<xsl:value-of select="format-number($CountedTotal + $CountedSubTotal, '$##########0.00')" />

<xsl:variable name="CountedTotalLine" select="$CountedTotal + $CountedSubTotal"/>
<xsl:value-of select="$CountedTotal + $CountedSubTotal"></xsl:value-of>
<xsl:copy-of select="$CountedTotalLine"/> -->

2:28 pm on Oct 24, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 16, 2003
posts:971
votes: 0


Hmmm. How about the expression:

"substring-after($CountedTotal,'$')+substring-after($CountedTotalLine,'$')"

2:36 pm on Oct 24, 2006 (gmt 0)

New User

10+ Year Member

joined:Oct 24, 2006
posts:3
votes: 0


Wow do I feel like the idiot. That did it. I was considering taking off the $ in the format statement, but like usuall I made an assumption about XSL.

Warning to all never think XSL is very smart. :)

m

2:40 pm on Oct 24, 2006 (gmt 0)

New User

10+ Year Member

joined:Oct 24, 2006
posts:3
votes: 0


BTW - Thank you so much. I was getting very frustrated, couldn't see the tree because of the forrest syndrom.

m

5:51 pm on Oct 24, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 16, 2003
posts:971
votes: 0


Well, it is the most syntactically tedious programming language ever created by man, so it's kinda custom made to encourage not being able to see the forest for the trees :-).
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members