This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Beginner's question: Mathematical Calculations in XSL Template
- From: "Ami D. Yanero" <amiy at mcgeecorp dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 21 Nov 2001 10:26:00 -0500
- Subject: [xsl] Beginner's question: Mathematical Calculations in XSL Template
- Reply-to: xsl-list at lists dot mulberrytech dot com
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@McGeeCorp.com
**********************************************
"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