RE: [xml-dev] Nasty XPath expressions

From
Michael Kay <>
To
'Michael Brennan' <>, , 'bob mcwhirter' <>, 'Kelvin Yeow' <>
Date
2001-12-14T09:43:01
ID
<000301c18483$b9d23d70$465169d5@pcukmka>
Thread
RE: [xml-dev] Nasty XPath expressions
> I think confusion has come in due to an inconsistency between
> the notion of
> a node-set being unordered, and the fact that XSLT can
> process node-sets as if they are ordered.
>
> This seems odd that XSLT can treat node-sets as if they are
> ordered, even though they are not.

Yes, people get very confused by this: I've even seen some trained
mathematicians get confused by it.

The key point is that the ordering is a property of the nodes, not of the
collection. If you have three nodes N1, N2, and N3, you can only define one
node-set containing these nodes, just as you can only define one set
containing the integers (1, 2, 3). But it's perfectly reasonable to define a
function that operates on sets-of-integers whose effect is to list the
integers in numeric order, and it's equally reasonable to define a function
that operates on sets-of-nodes whose effect is to apply templates to them in
document order.

The existence of an ordering (or of several orderings!) over a domain
doesn't stop you defining sets of objects from that domain.

Of course, it's all going to change in XPath 2.0, so this debate will soon
be history.

Mike Kay