[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Beginner's question: Mathematical Calculations in XSL Template


Subject: Re: [xsl] Beginner's question: Mathematical Calculations in XSL Template
From: Michael Case <mecase@xxxxxxxxxxx>
Date: Wed, 21 Nov 2001 10:02:06 -0800

also, even in XSL, wouldn't number('abc1') return NaN in at least some
processors?

"Ami D. Yanero" wrote:
> 
> I'm attempting to do multiplication and additon calculations in my XSL
> template.  I've seen several posts to various newsgroups about this same
> scenario, and I've tested my calculations using the examples and
> corrected answers posted.
> 
> However, I'm getting the same error when I do the calculations with the
> examples as I'm getting when I use my 'live' documents.  Everything that
> I've read says that what I've got should work.  Please help!
> 
> Thanks in advance.
> 
> Ami D. Yanero, MCP
> Software Developer, McGee Corporation
> P: 704.882.1500 x409
> F: 704.882.0219
> E: AmiY@xxxxxxxxxxxxx
> **********************************************
> "Man is still the most extraordinary computer."
>                            --John F. Kennedy
> +-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/
> +-*/+-*/+-*/+-*/+-*/
> 
> Error:
> ======
> Expected token 'eof' found '*'. number(one) -->*<-- number(two) *
> number(three)
> 
> XML Doc:
> ========
> <?xml version = "1.0" encoding = "UTF-8"?>
> <?xml-stylesheet href = 'file:///P:/Projects/QuickQuote/test.xsl' type =
> 'text/xsl'?>
> <numbers>
>         <one>abc1</one>
>         <two>2</two>
>         <three>3</three>
> </numbers>
> 
> XSL Doc:
> ========
> <?xml version="1.0" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> <xsl:template match="/">
> <html>
> <body>
> <font face="arial">
> <xsl:for-each select="numbers">
> <table width="100%" cellpadding="1" cellspacing="0"
> bordercolor="#c0c0c0">
>     <tr>
>         <td valign="top"><strong>One: </strong></td>
>         <td valign="top"><xsl:value-of select="one" /></td>
>     </tr>
>     <tr>
>         <td valign="top"><strong>Two: </strong></td>
>         <td valign="top"><xsl:value-of select="two" /></td>
>     </tr>
>     <tr>
>         <td valign="top"><strong>Three: </strong></td>
>         <td valign="top"><xsl:value-of select="three" /></td>
>     </tr>
>     <tr>
>         <td valign="top"><strong>Added: </strong></td>
>         <td valign="top">
> <xsl:value-of select="number(one) * number(two) * number(three)"/>
>         </td>
> 
>     </tr>
> </table>
> </xsl:for-each>
> </font>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 

Michael E. Case
UC Davis
case@xxxxxxxxxxxxxxxxxx
(530) 754-7226

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords