[Bug 1824] Functions return xs:NCName, but xs:NCName is not support in XSLT 2.0 Basic

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1824





------- Additional Comments From mike@saxonica.com  2005-09-06 10:38 -------
I think we can solve this as follows: (for the benefit of WG members, the white
horse comes to our rescue).

XPath says in 2.5.4:

 "An unknown schema type might be encountered, for example, if a source document
has been validated using a schema that was not imported into the static context.
In this case, an implementation is allowed (but is not required) to provide an
implementation-dependent mechanism for determining whether the unknown schema
type is derived from the expected schema type."

The situation that's occuring here is that a function (such as
local-name-from-QName) is returning a value of dynamic type xs:NCName, which in
a Basic XSLT Processor is an "unknown type". So all we have to do is to say that
a Basic XSLT Processor MUST provide a mechanism for determining whether an
unknown schema type is derived from a given schema type in the case where the
unknown schema type is a built-in type. In other words, a basic XSLT processor
needs to know that xs:NCName is derived from xs:string, even though it offers no
other support for xs:NCName.

Once we say that, I believe everything else falls into place and the problem
disappears. This is enough to ensure that the returned NCName can be used as a
string.

I think we can handle this with the following addition to XSLT section 21.1:

<new>
For a Basic XSLT Processor, schema built-in types that are not included in the
static context (for example, xs:NCName) are "unknown types" in the sense of
XPath section 2.5.4. In the language of that section, a Basic XSLT Processor
MUST be able to determine whether these unknown types are derived from known
schema types such as xs:string. The purpose of this rule is to ensure that
system functions such as fn:local-name-from-QName(), which is defined to return
an xs:NCName, behave correctly. A stylesheet that uses a Basic XSLT Processor
will not be able to test whether the returned value is an xs:NCName, but it will
be able to use it as if it were an xs:string.
</new>

Michael Kay

Received on Tuesday, 6 September 2005 10:38:31 UTC