[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Comparisons in XPath 2.0

Subject: Re: Comparisons in XPath 2.0
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 8 Jan 2002 08:23:57 +0000
sequence comparison xpath
Mike 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.

There are two functions that do compare sequences:

  xf:sequence-deep-equal()
  xf:sequence-node-equal()

Following the same scheme, the one I'm after here would have the
signature:

  xf:sequence-value-equal(item* $parameter1, item* $parameter2)
    => boolean?

  xf:sequence-value-equal(item* $parameter1, item* $parameter2,
                          anyURI $collationLiteral)
    => boolean?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.