|
Subject: RE: [xsl] Validating source documents, with schema aware XSLT From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sun, 6 Aug 2006 21:20:49 +0100 |
> The source XML is books.xml, and Schema is books.xsd found in
> the folder samples\data of Saxon distribution.
>
> The example works fine with the following command line:
>
> java com.saxonica.Transform -val books.xml books.xsl
>
> The source document gets validated, and I get the proper output.
>
> However, I am curious what is happening in the following cases:
>
> 1) I give the command line as, java com.saxonica.Transform
> books.xml books.xsl (i.e. no -val option)
>
> The following message comes from the stylesheet:
>
> Source document is not a validated book list
The "instance of" test fails because it is testing the type annotation of
the element node, and the type annotation is "xs:untyped" if the document
has not been validated.
>
> 2) I give the command line as, java com.saxonica.Transform
> -val books.xml books.xsl
>
> but I remove the line <xsl:import-schema schema-location="books.xsd"
> /> from the stylesheet,
>
> I get message,
>
> XPST0003: XPath syntax error at char 42 on line 4 in {...e of
> schema-element(B
> OOKLIS...}:
> No schema has been imported for namespace ''
You can't use the name of a schema-defined type in your stylesheet unless
you import the schema. The "instance of" test won't even compile in this
situation; it never gets as far as reading the source document.
>
> According to my testing, it seems that to validate source
> document, -val option is a must, and also xsl:import-schema
> is a must to include in the stylesheet. i.e. both these
> conditions must be fulfilled for the source document to get
> validated by the schema, and is usable by the stylesheet.
-val is necessary to create the type annotations; import-schema is necessary
to refer to the type in your stylesheet.
Michael Kay
http://www.saxonica.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Validating source documen, Florent Georges | Thread | Re: [xsl] Validating source documen, Mukul Gandhi |
| RE: [xsl] Passing an XSLT param to , Michael Kay | Date | Re: [xsl] Validating source documen, Mukul Gandhi |
| Month |