[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Request help in understanding: node instance of schema-element(node)
Subject: RE: [xsl] Request help in understanding: node instance of schema-element(node)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 27 Jan 2008 10:28:50 -0000
|
> But I have a personal curiosity, related to Roger's question
> in this thread.
>
> I would have preffered a syntax
>
> <xsl:value-of select="if (//test instance of
> schema-element(test)) then
> //test * 2
> else 'Error'"/>
>
> Without doing, <xsl:import-schema
> schema-location="test.xsd"/> in the 2.0 stylesheet.
Many of the benefits of schema-awareness come from being able to use the
information at compile-time, to do static checking of the stylesheet and
compile-time optimization. While it would be theoretically possible to do
all checking at run-time, and thus to refer to type names whose meaning is
not known until run-time, you would lose most of these benefits.
Of course there are languages like Java that supplement compile-time type
information with run-time introspection. I would certainly like it if XSLT
were able to do introspection of the schema information at run-time. But
there are a lot of debates about how this is best achieved.
> Does Saxon-SA support
> xsi:schemaLocation method as well (and I don't do -val /
> -val:strict) ? If Saxon doesn't support xsi:schemaLocation
> method, my curiosity is, why not?
Saxon uses xsi:schemaLocation where appropriate to identify where a schema
can be found. It doesn't use it as a signal to tell you whether validation
is wanted or not. I don't think that is the intended purpose of
xsi:schemaLocation, and I don't think it's a useful way of doing it - I
think it's common for users to want validation even when there is no
xsi:schemaLocation, or to want no validation even when there is an
xsi:schemaLocation.
To be honest, even though Saxon does use xsi:schemaLocation for the limited
purpose of locating a schema once validation has been requested, I don't
think it's a good idea to use it. If you are validating a document then
that's probably because you don't trust it, and if you don't trust it, then
why should you trust its schemaLocation attribute?
Michael Kay
http://www.saxonica.com/
|