xsl-list
[Top] [All Lists]

RE: [xsl] Calculating cumulative values and min/max

2007-06-13 07:06:19
Thanks, Andrew!

-----Original Message-----
From: Andrew Welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com] 
Sent: June 13, 2007 2:00 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Calculating cumulative values and min/max

On 6/13/07, Simon Shutter <simon(_at_)schemax(_dot_)com> wrote:
a) in the predicate [(_at_)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::*[(_at_)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::*[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>