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

RE: Calculating cumulative values and min/max

Subject: RE: Calculating cumulative values and min/max
From: "Simon Shutter" <simon@xxxxxxxxxxx>
Date: Wed, 13 Jun 2007 07:06:26 -0700
RE:  Calculating cumulative values and min/max
Thanks, Andrew!

-----Original Message-----
From: Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx] 
Sent: June 13, 2007 2:00 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Calculating cumulative values and min/max

On 6/13/07, Simon Shutter <simon@xxxxxxxxxxx> wrote:
> a) in the predicate [@x = current()/@x], why is current node used and not
> the context node used?  I guess I'm confused at to which @x is which in
the
> predicate.

current() returns the current node from outside of the the XPath, so
if you have:

parent::*[@x = current()/@x]

then you are comparing @x on the parent node (the first @x in the
predicate), and @x on the node thats currently being matched (the
second @x).

Its the same as maintaining the pointer yourself:

<xsl:variable name="this" select="."/>
<xsl:value-of select="parent::*[@x = $this/@x"/>

> b) is it possible to calculate min/max values is this only possible in
> XSLT/XPATH 2.0?

You can do it in 1.0 by sorting the values and picking the first/last:

http://www.dpawson.co.uk/xsl/sect2/N5121.html#d7114e427

...but yes in 2.0 there's min() and max()

cheers
andrew

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.