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

RE: Calculations involving measurements with units

Subject: RE: Calculations involving measurements with units
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 3 Jan 2004 12:43:23 -0000
calculations in xslt
XSLT 2.0 lets you write stylesheet functions that can be called from
within an XPath expression, which solves this problem.

In 1.0 you could try breaking the expression up by using variables, but
of course these can't take arguments in the way that a template or
function can.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Paul A. Hoadley
> Sent: 03 January 2004 03:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Calculations involving measurements with units
> 
> 
> Hello,
> 
> On Fri, Jan 02, 2004 at 11:08:38PM +1030, Paul A. Hoadley wrote:
> 
> > <xsl:variable name="upper-margin" 
> > select="concat(number(translate($page-height, 
> translate($page-height, 
> > '0123456789.', ''), '')) div 3.75, translate($page-height, 
> > '012345679.', ''))"/>
> 
> How can I neaten this up?  I've written two templates:
> 
>   <xsl:template name="getUnits">
>     <xsl:param name="input"/>
>     <xsl:value-of select="translate($input, '012345679.', '')"/>
>   </xsl:template>
> 
>   <xsl:template name="stripUnits">
>     <xsl:param name="input"/>
>     <xsl:value-of select="translate($input, translate($page-height,
>                           '012345679.', ''), '')"/>
>   </xsl:template>
> 
> This would seem to only _increase_ the verbosity of what I 
> have quoted above, since now I can't call the templates 
> inside the 'select' of the variable declaration.  What is the 
> standard idiom here?
> 
> 
> -- 
> Paul.
> 
mailto:paulh@xxxxxxxxxxxxxx mailto:phoadley@xxxxxxxxxxxxxxxxxxxxx

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


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


Current Thread

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.