[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Calculating

Subject: Re: Calculating
From: Lawrence Mielniczuk <lwm@xxxxxxxxxxxxxxx>
Date: Mon, 28 May 2001 14:03:57 +0100 (GMT Daylight Time)
calculating xsl transform time
I'm sure there are more elegant solutions but try this:

Given XML
---------------
<?xml version="1.0"?>
<thing>
	<amount>7</amount>
	<price>2.50</price>
</thing>

stylesheet
---------------
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>

<xsl:template match="thing">
	<xsl:value-of select="./amount * ./price"/>
</xsl:template>

</xsl:transform>

bash$ saxon thing.xml thing.xsl
17.5
$bash
> Hello,
> 
> in my XML file I got two elements named price and amount. Is it
> possible to multiplicate the value of these elements in a xsl
> stylesheet and display it as total amount.
> In a book I found an example, that in XSL files you can work with
> arithmetical terms, but every syntax I tried, did not work. I always
> got the error "Expected token 'eof' found '*'".
> 
> Thanks in advance
> 
> Günter Hofmann
> Systemadministration
> 
> Atson Consulting AG
> Hagäckerstrasse 4
> 73760 Ostfildern
> 
> Tel.: 0711 / 167 100
> Fax: 0711 / 167 109 9
> 
> Email: gh@xxxxxxxxxxx
> www.atson-ag.de
> 
> 
> 
> 
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

-------------------------------------
Lawrence Mielniczuk
Room 314
Bodleian Library
Oxford OX1 3BG
Tel: (01865) 277 114
Mobile: 0794 101 5689
-------------------------------------


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


Current Thread
  • Calculating
    • Günter Hofmann - Mon, 28 May 2001 07:49:22 -0400 (EDT)
      • Lawrence Mielniczuk - Mon, 28 May 2001 09:01:29 -0400 (EDT) <=
        • Tim Watts - Mon, 28 May 2001 20:08:51 -0400 (EDT)
      • <Possible follow-ups>
      • Clapham, Paul - Mon, 28 May 2001 11:17:43 -0400 (EDT)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.