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

An issue with XPath 2.0 sequences (Was Re: RE: Muenchi

Subject: An issue with XPath 2.0 sequences (Was Re: RE: Muenchian method, and keys 'n stuff)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 30 Jan 2002 11:30:24 -0800 (PST)
unicode to char
> > It's interesting that you can build a sequence of integers in XPath
> > 2.0 with the 'to' operator, but not a sequence of characters. For
this
> > situation, it would be really nice to be able to do:
> >
> >   <xsl:for-each select="'a' to 'z'">
> >     ...
> >   </xsl:for-each>
> >
> 
> It's often been suggested that there should be char-to-unicode and
> unicode-to-char functions, which would allow you to write
> 
> <xsl:for-each
>     select="for $i in char-to-unicode('a')
>                    to char-to-unicode('z')
>             return unicode-to-char($i)">
> ...
> </xsl:for-each>
> 
> That would be explicitly based on Unicode values; finding all the 
characters
> that are between 'a' and 'z' in your default collating sequence
sounds like
> a more difficult challenge.


This challenge is a result from the inability in XPath 2.0 to regard a
string as a sequence of characters, and this is a consequence of the
decision not to allow a sequence to have elements, which themselves are
sequences.

As can be seen, the last decision is the logical result of another 
decision to regard every simple value as a sequence consisting of one
element.

I already provided an example of a problem, which could be efficiently
solved in case we could have a sequence of sequences. This problem is
to produce simultaneously (in one pass) two sequences -- e.g. one that
contains all the elements of a sequence, which satisfy a given
predicate, and the other containing the rest.

Several people already expressed their curiosity about what was the
reason to forbid a sequence to have an element-sequence.

I think that these examples show it would be better to allow
elements-sequences and to treat simple values only as such and not as
sequences. The latter also fits better the idea of type-checking as it
gives a single value exactly one type, as opposed to two types now --
its true type and its type as a sequence.

Cheers,
Dimitre Novatchev.




__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.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.