Subject: Re: [xsl] Schema-aware validation of XHTML result-document|
From: "Jesper Tverskov" <jesper@xxxxxxxxxxx>
Date: Fri, 9 Mar 2007 23:55:29 +0100
The problem is that it is possible to specify that the result-document should have a DTD and at the same time validate the same result-document against a schema allowing namespace related attributes not declared in the DTD.
It would be nice if the XSLT processors could warn you about a possible conflict. As far as I know it is the only one that we could have for XHTML, and XHTML is an important use case. The schema is stricter than the DTD, several things are allowed in the DTD but not in the schema. But not the other way except for those namespace related attributes.
For that reason it ought to be possible and easy for the XSLT stylesheet to warn you. Not that validation against the schema has failed but that the output will not be valid validated against the DTD specified in the result-document element in the stylesheet. Yes it is a little confusing.
I agree that I could make my article more clear about this issue, and I will do so.
Your article says
> It is unacceptable that both AltovaXML and Saxon accept illegal > namespace declarations in the result-document making the XHTML not > valid,
and says the same thing in different ways in other places.
I think it's very misleading to use "valid" in two completely different ways in the same article without prefixing the term to show the meaning intented.
validation in a schema-aware XSLT system means XSD Schema validation and if the system reports no errors that gives an assurance that the result is schema-valid. The extra namespace declarations have no effect on schema validity (or for that matter on an XHTML rendering agent).
they do mean that the docuemnt is not DTD-valid, but the XSLT spec gves no guarantees about that. As Michael has said, given that xhtml output is mainly aimed at targetting xhtml towards legacy browsers that don't understand xhtml and want to treat it as html, a system could perhaps make a warning here,, but to characterise it as producing invalid output after reporting no validation errors is misleading as it masks the fact that you changed the definition of validity mid sentence. Your example though uses the xml output method, so there I don't see that there is anything that you could really do, other than output the pre-validated tree, as shown earlier.
> Both AltovaXML and Saxon have forgotten this problem and are not > reporting those validation errors.
No, they are using a schema validator and they are not errors to a schema valdator. There is no provision in XSL to initiate DTD validation from within the stylesheet.
-- Jesper Tverskov