[xsl] With or without PSVI

Subject: [xsl] With or without PSVI
From: Dan Holmsand <holmsand@xxxxxxxxxxxxx>
Date: Wed, 15 May 2002 10:38:16 +0200
I've been trying to understand XSLT 2 (with some success). But I'm having trouble seeing exactly what difference the PSVI information makes.

An example. Suppose the instance document accidentally looks like this:

<foobar xmlns:xsi="http://www.w3.org/2000/11/XMLSchema-instance";
	. . .

and the XSLT Processor decides to accept unvalidated input, and exclusively uses schemaLocations to assign schema to an instance document (and the "type exception policy" is "flexible").

What are the conditions on the stylesheet and the instance document for this transformation to produce the same result as if the correct namespace for "xsi" had been used?

It seems to me that if you stay away from "instance of", "cast" (and perhaps a few other related functions/operators), and if your source document doesn't contain any XSD list types, you would get essentially the same output (thanks to "automatic" casts). You could also maybe lose some precision in numerical calculations if a PSVI is produced (since the calculations could use e.g. xs:float precision instead of xs:double).

Otherwise, all you'd get is a few warnings from the processor about implicit casts (if you use, say, date functions without explicit date constructors). But the stylesheet would retain the same functionality.

A couple of questions:

o Am I totally wrong about this?

o In case I'm not: Shouldn't it be possible to refactor the spec? Something like "If a PSVI is provided you may also use instance of, xf:data, and count on automagic sequence construction from XML Schema list types. See http://www.w3.org/TR/horrible-psvi-mess-in-xpath for details."

o In case I'm wrong: Isn't it incredibly dangerous if the meaning of a stylesheet changes substantially in case PSVI information is provided?

o In any case: Wouldn't it be nice to see some kind of specification of exactly what is required to produce PSVI-independent stylesheets? (and wouldn't it be nice to have an "xf:tokenize" function to be able to handle list types in the absence of PSVI?).

Dan Holmsand

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

Current Thread