xsl-list
[Top] [All Lists]

Re: Two-level grouping problem

2005-05-10 17:27:01
At 2005-05-10 22:47 +0000, Aron Bock wrote:
Given that "we could as well use the value of the last() node of
$rows[...] above to same effect", why is document order important?

Thank you for bringing this up. What I was getting at was that $rows[...] brings back nodes in a predictable order--document order in this case.

XSLT 1.0 looks at *all* node sets returned by XPath 1.0 in document order, regardless of the proximity order used by the steps to select the nodes, and regardless of the XPath expression. Of course XSLT may choose then to sort them, but the set returned by XPath is always regarded in document order.

The predictable order is important if our reference node on the RHS ( first(), last(), whatever) is to serve as a predictably-locatable node among its like-valued ilk.

Isn't the important bit that one and only one of the possibly multiple
items be picked up by the expression, regardless of where in the document
order the one we match may be?

Yes, this is the goal, but to achieve this using generate-id() we're relying on an [implicit] order to $rows, no?

No, grouping works using any test that succeeds only once for each unique value. Since there is always a node with the true predicate [last()] and there is always a node with the true predicate [1] then either one could be used ... and in XSLT 1.0 functions like generate-id() will act on only the first node in document order.

But, the point was already made, "the important bit ... only one ... regardless of where in the document orer" ... so, it really is regardless of where in the document order, as long as it is a test that can be calculated for each unique value found in a set. For example, the predicate [2] would not work because there could be values in the set for which there is but one member.

I hope this helps.

. . . . . Ken


--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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>