Re: [xsl] would like to simplify my XSLT

Subject: Re: [xsl] would like to simplify my XSLT
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 30 Jan 2007 16:54:08 +0100
David Carlisle wrote:
but it's rather more readable to say
key('x','a') intersect key('x','b')

I think I need to practice it a little as soon as I have a use case, to see it in action, so I can *really* understand its use ;)


That woudl get very confusing, especially for text nodes (which many
people use interchangeably with strings). You want it to be clear in the
syntax wheter you are doing identity-equality (so two nodes are ony
equal if they are the same node, or value-equality, where two items are
equal if they have the same string value.

Michael Kay wrote:
You may have noticed that there are example user-written functions to do
value-based union, intersection, and difference of sets of atomic values in
an appendix of the F+O spec.


[...]

Furthermore, (d)
it's not exactly obvious what the spec should be, e.g. ordering of the
result, promotion of numeric types, handling of NaN, etc, especially in
corner cases for example where you have two decimals that are not-equal to
each other but both equal to the same double.
hmm, imo, (d) could've been taken from the description of deep-equal, which defines such equality.

But I agree to both that for clarity there must be a difference between identity equality and value-equality (though clarity was my original reason for broadening the intersect parameter types).

Btw, I find myself often encountering the situation where I have an operation on a sequence of strings and I first have to promote them to text nodes (I usually don't, I just end up using a for-in-return loop). I'll have a look at them to see if that can be done more easily using simpler xpath operators that I often overlook, like David suggests.

Thanks,
-- Abel

Current Thread