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

RE: Calculating column widths

Subject: RE: Calculating column widths
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 16 May 2001 00:27:11 +0100
calculate column width from html
> My question:
> how can I do this calculation in one parse?
> The sum() function requires a node-set
> and numeric values to function properly,
> and I have been unable to do the stripping
> and the calculation in one template.

You could do the summation "by hand" in a recursive template, rather than
using the sum() function, but I'm not sure I'd recommend this. It rather
depends what you're trying to achieve.

You can of course do a two-pass transformation using a result-tree-fragment
for the intermediate results and using RTF-to-nodeset conversion for the
second pass.

Alternatively, Saxon has the extension function saxon:sum(node-set,
expression) which allows you to sum over the result of an XPath expression
applied to the context node. This expression can also contain a call on a
saxon:function() defined in the stylesheet. (But you could strip off the
units part of your numbers using a standard expression based on translate(),
converting all alpha characters to spaces).

I'm not sure any of these is a real improvement on what you're currently
doing.

Mike Kay


 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.