W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2002

RE: Comparisons in XPath 2.0

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Mon, 7 Jan 2002 13:42:11 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210622B8CA@softwareag.com>
To: "'Jeni Tennison'" <jeni@jenitennison.com>, www-xpath-comments@w3.org
Cc: xsl-list@lists.mulberrytech.com
Jeni Tennison wrote:

> For all that there are lots of ways of comparing values in XPath 2.0,
> there doesn't seem to be one that compares sequences.
> 
> If you have something like:
> 
>   <line start="0 300" end="300 0" />
> 
> where start and end both have typed values - @start is the sequence of
> two integers (0, 300) and @end is the sequence of two integers (300,
> 0). In this particular language, @start and @end are x,y coordinates.
> How can you work out whether start and end have the same value?

I think you're right, this is an omission that we need to remedy. I'd
suggest a function compare-sequences(sequence, sequence), perhaps with an
optional collation argument, that returns -1, 0, or +1, in the same way as
compare(). It should be based on pairwise comparison of items in the two
sequences, each pair being compared using the eq and lt operators. Phil
Wadler has referred to this as "lexicographic comparison", but I'm not sure
most people would understand that term correctly.

Mike Kay
Received on Monday, 7 January 2002 07:42:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:54 GMT