|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Beginner's question: Mathematical Calculations in
[Ami D. Yanero] > 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! > First of all, you need to use an actual xslt processor as others have said. Then your example works fine (after you use the correct namespace for xslt). Here's a slightly modified version of your example and stylesheet: <?xml version = "1.0" encoding = "UTF-8"?> <numbers> <one>2</one> <two>3</two> <three>5</three> </numbers> Here is a working stylesheet and the results: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <results> <xsl:apply-templates select='numbers'/> </results> </xsl:template> <xsl:template match='numbers'> Addition:<xsl:value-of select='number(one)+number(two)+number(three)'/> Multiplication:<xsl:value-of select='number(one)*number(two)*number(three)'/> </xsl:template> </xsl:stylesheet> ============= results ============= <results> Addition:10 Multiplication:30</results> Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








