Re: [xsl] Grouping by key

Subject: Re: [xsl] Grouping by key
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 04 Nov 2004 18:59:00 -0500
At 05:00 PM 11/4/2004, you wrote:
Yes, in XPath 1.0 only the first node in a node-set is used when one
value is expected -- there's no distinction b/n functions and
operators in this respect.
Cheers,
Dimitre.

Oh, but that is not true. See 3.4 of XPath Rec 1.0...

Dimitre might not have phrased it with perfect strictness, but I'm pretty sure what he intended to say is true. :-> You are correct that the casting of a node-set to a Boolean casts a set to a single value (true or false depending on whether the set has any members). But no operations or functions in XPath 1.0 are defined explicitly to take Boolean arguments only (or at least my brain is drawing a blank on this), whereas a number of them (concat() etc.) do take only string values (which are necessarily each "one value"). So the casting rule for Booleans isn't really relevant here.


generate-id() is a little special since it is defined to take a node-set as its argument, but *returns* a single string (the string value of the generated id of a node), so it becomes necessary to define which node in the set will be the one whose ID is returned. Following the same logic as the casting rule of node-set to string, the function takes the first node in the set (in document order).

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread