homepage Welcome to WebmasterWorld Guest from 54.161.246.212
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Why can I not get back a number from any of these methods
XSL adding two numbers
mross01

5+ Year Member



 
Msg#: 3133011 posted 2:12 pm on Oct 24, 2006 (gmt 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"/> -->

 

ronburk

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3133011 posted 2:28 pm on Oct 24, 2006 (gmt 0)

Hmmm. How about the expression:

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

mross01

5+ Year Member



 
Msg#: 3133011 posted 2:36 pm on Oct 24, 2006 (gmt 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

mross01

5+ Year Member



 
Msg#: 3133011 posted 2:40 pm on Oct 24, 2006 (gmt 0)

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

m

ronburk

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3133011 posted 5:51 pm on Oct 24, 2006 (gmt 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 :-).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved