Project

Profile

Help

Namespace removal & type validation

Added by Anonymous almost 18 years ago

Legacy ID: #3935591 Legacy Poster: C. ARNOUX (carnoux)

Good morning, I've got an issue, concerning SaxonSA and output document validation. My XSLT has the following pattern <xsl:stylesheet version="2.0" xmlns:outns="someuri" xmlns="someuri" [...] <xsl:import-schema namespace="someuri" /> [...] and all the following element declarations will have the type="outns:SomeType" attribute The thing is I must provide an output document that : * has no namespace * is valid according to the schema associated with the namespace. With the afore mentioned XSLT, my output document will start with <root namespace="someuri"> and if I remove the default xlmns in the xsl:stylesheet element, I obtain the output XML I want... full of validation error comments such as !-- VALIDATION ERROR: The content model does not allow element <element> to appear here. Expected: {someuri}element --> and with no way to be sure this document is valid automatically. Some colleague of mine has been suggested (and forwarded to me) to use URIResolvers, but I quite do not see how that could help me. Any idea ? thx, C. Arnoux


Replies (2)

RE: Namespace removal &amp; type validation - Added by Anonymous almost 18 years ago

Legacy ID: #3935707 Legacy Poster: Michael Kay (mhkay)

>The thing is I must provide an output document that : * has no namespace * is valid according to the schema associated with the namespace. Sorry, but this is a contradiction in terms. If the output is in namespace X, then by definition it can't be valid according to the schema for namespace Y. The best I can suggest is that you generate output in namespace Y, validate it, and then transform it by changing all the names to be in namespace X. You could also try playing around with "chameleon includes", which allow you to create a schema for one namespace as a redefinition of a schema for a different namespace. However, I wouldn't advise this route - it can get terribly confusing for everyone concerned.

RE: Namespace removal &amp; type validation - Added by Anonymous almost 18 years ago

Legacy ID: #3936003 Legacy Poster: C. ARNOUX (carnoux)

Thanks Michael

    (1-2/2)

    Please register to reply