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

Re: Re: XPath incompatibilities

Subject: Re: Re: XPath incompatibilities
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 2 Jan 2002 11:28:57 +0000
schemaless document 2007
Happy New Year :)

Mike wrote:
> I think we still have some work to do on schema-less documents and
> untyped nodes.

I guess that one possibility that would help in the case of < would be
to convert the nodes to whatever type they look like. If they look
like numbers, treat them as numbers; if they look like dates, treat
them as dates and so on.

The major benefit of this would be that it would mean you wouldn't
have to do explicit casts in many cases - it keeps XPath simple for
those of us that don't want to worry about what types things are all
the time. The major headaches come in the specification of how you
recognise a type - how do you tell whether something is a decimal or a
gYear, a string or a QName (though I think that these are details that
could be worked out) - and I guess that it would slow down the
implementation.

But this already seems to be used in arithmetic expressions (Section
2.5 of the XPath 2.0 WD). Point 4 there states:

  If any operand is an untyped simple value (such as character data in
  a schemaless document), it is cast to the type suggested by its
  lexical form. For example, the untyped value 12 is cast to the type
  xs:integer.

If you can do it with arithmetic expressions, why not with
comparisons?

>> I think that there are lots and lots and lots of stylesheets that
>> use the implicit conversion to numbers when doing comparisons, and
>> that it would be very confusing to have lexicographic comparison.
>
> My own guess is that most examples will do comparison against a
> numeric literal, e.g. @max>3. If one of the operands is numeric, the
> comparison will be numeric.

Both guesses can be true, of course. There are probably also a lot of
a stylesheets that have something like:

  <xsl:variable name="min">3</xsl:variable>
  <xsl:if test="@number > $min">...</xsl:if>

because people commonly use the body of xsl:variable rather than the
select attribute. I think these would lead to lexicographic
comparisons as well.

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.