[xsl] Using or ignoring Types in XSLT 2.0 / XPath 2.0

Subject: [xsl] Using or ignoring Types in XSLT 2.0 / XPath 2.0
From: Andrew Watt <andrew@xxxxxxxxxxxxxx>
Date: Tue, 13 May 2003 08:29:26 +0100
[I have broken this into a new thread since we were no longer talking specifically about integers and strings.]

At 00:20 13/05/2003 -0500, Mike Haarman wrote:
This thread and another recent one regarding X(Path|SL) 2.0 has raised a few
questions for me. I am late to the party and I wonder if someone can direct me
to language in the recent drafts regarding the behavior of those functions which
rely upon


over a merely well-formed instance, that is, for which no schema is available.
In the absence of type information, the behavior of many of the functions of
XPath2.0 would seem to be indeterminate.  Where's the prose in the draft that
answers to this situation?


You might want to take a look at the questions I posed on public-qt-comments a day or two after the new Working Drafts came out and the follow-up answers from David Carlisle and Michael Kay:


A key concept seems to be that strings for which there is no schema-related information are treated as xdt:untypedAtomic - an XPath/XQuery type created in response to the need for an "untyped type", if you see what I mean.

Values of the "untyped type" can be cast automatically to the desired type. Then things work as if it had been typed in the first place, assuming that the string which is of "untyped type" is castable to the type that the function expects.



isn't castable so causes problems if you try to treat it as a date. But if you need to treat a value as xsd:date then the following untyped data,


should be automatically cast to the necessary type.

At the moment I am dipping into the specs as I have time, so I may have missed some important aspect of things but the above seems to be (a highly simplified version of) how things currently are drafted.

A (heretical?) thought that is beginning to float around in my mind ... Dave Pawson may approve of this :) .... is why can't we just treat untyped strings (which the WD proposes are treated as xdt:untypedAtomic) as ... well .... xsd:string types?

Andrew Watt

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

Current Thread