I'd like to select the max (and
min) closing price for each equity. I've been
searching through the zvon.org xslt reference and i
could'nt find max or min functions. Does anyone know
how to do this?
Use the "maximum" and "minimum" templates from FXSL.
True enough Demitre, but as you are already using vendor:node-set you may as
use exsl's max() and min() functions...
I'm all for using FXSL, but in the case of simple exsl functions, why not use
First a small correction: for XSLT 1.0 the latest FXSL version 1.2 uses
ext:node-set(), where the prefix "ext" is associated with
FXSL for XSLT 2.0 does not use any extension functions and does not need
separate implementation for a particular XSLT 2.0 processor like EXSLT will
The question should be more properly formulated like this: why one would choose
use FXSL's minimum() and maximum() over EXSLT's min() and max() and vice versa
more generally why and in what cases one would choose the FXSL's functions over
EXSLT's functions and vice versa.
The answer is that this depends on the needs of the user.
In FXSL minimum() and maximum() are higher-order functions. They accept a
function as a parameter. This makes them usable in a variety of situations
simple min() or max() function will not be applicable.
One group of examples is where the maximum should be produced for values that
calculated from each node -- FXSL provides a single, linear, one-pass solution
The use of a comparison function passed as parameter makes it possible to
the minimum/maximum even in the extreme case for such types of values, which
be directly converted to numbers.
It is generally incorrect to compare a library of higher order functions to a
library of non-higher-order functions, as the former is much more powerful and
have huge scope, and can provide solutions (new functions) to an unlimited
problems, not known in advance.
Take for example such generic functions as foldl and foldr.
One can create an indefinite number of new, useful list-processing functions
feeding foldl and foldr with different parameters -- functions and initial
sum = foldl (+) 0
product = foldl (*) 1
someTrue = foldl or false
allTrue = foldl and true
maximum = foldl1 max
minimum = foldl1 min
append as bs = foldr (:) bs
map f = foldr ((:) . f) 
. . . . . . . . . . . . . . .
and so on. The list of such functions is unlimited.
Therefore, if I need to solve just a single problem I might use a simple set of
non-higher-order functions if this set happens to provide a solution. If it
happen to provide a solution I will be out of luck.
On the other side, if I need a powerful, generic toolkit,which does not rely on
extension functions, and which when parameterised will provide solutions to a
unanticipated class of problems, then I will choose the library of generic
higher-order functions, that provides exactly these capabilities.
http://fxsl.sourceforge.net/ -- the home of FXSL
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list