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

Re: getting the text nodes from a set of attribute nod

Subject: Re: getting the text nodes from a set of attribute nodes
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 4 Sep 2003 21:53:51 +0200
 Re: getting the text nodes from a set of attribute nod
> since i probably explained myself badly (still getting used to the
> terminology), i did clarify the semantics of comparing two nodes,
> involving the arithmetic operators and number(), so i guess the point i
> was making was that the actual nodes in question could have been simply
> text nodes whose string values represented the numeric values of interest,
> that's all.

Or, generally, nodes, whose string value can be interpreted as a number,
that is, for every node nd in the node-set

number(string(nd)) = number(string(nd))

The string() function above can be omitted, so the necessary pre-condition
for the meaningfulness of finding minimum with the XPath expression:

   $nodes[not($nodes &lt; .)]

is:

   not($nodes[not( number(.) = number(.) )])


BTW, the expression

   $nodes[not($nodes &lt; .)]

looks elegant, but it is evaluated in O(N^2) in the average and in the worst
cases.

There is a linear ( O(N) ) algorithm with primitive or DVC recursion and an
O(N*log(N)) algoritm using xsl:sort.

For anyone, who'd prefer to save their time by not having to re-implement
max() and min() again and again due to small differences in the way the ">"
operator is defined, I would recommend using the "minimum" and "maximum"
templates from FXSL, which accept a "greater-than" function as parameter.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 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.