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

Re: Is there another way to do this?

Subject: Re: Is there another way to do this?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 3 Mar 2004 10:47:48 GMT
reccursive sql
> This works but I'm just wondering is there a simpler method for doing this?

Not much, I would probably pass the node rather than the node number, and
recurse by passing following-sibling::*[1] rather than adding 1, this
might save the system indexing into the list repeatedly (although
passing a node rather than an integer may also have costs,
implementation details...) and is more "the xslt way", however what you
have is fine.

In Xslt2 drafts this is much simpler as you can just do

<xsl:value-of select="format-number(sum(for $i in item return $i/units * $i/unit.price), '#0.00')"/>

The need to introduce a variable here, and the fact that for does not
change the current node, so you have to do $i/item is a bit ugly, 
I still hope to see a more xpath like iterator in xpath2 which would be
something like

<xsl:value-of select="format-number(sum(item ?? (units * unit.price), '#0.00')"/>

where ?? is some operator like / but allowing values. However even with
the for expression that wandered into xpath by mistake from sql, it is
still a lot simpler than xslt1.


David

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 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.