This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Generating the xml: namespace from XSLT into a schema
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Danny Vint <dvint at mindspring dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Sat, 20 Jul 2002 17:51:43 +0100
- Subject: Re: [xsl] Generating the xml: namespace from XSLT into a schema
- Organization: Jeni Tennison Consulting Ltd
- References: <5.1.0.14.2.20020720091437.00a6d838@pop.mindspring.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Danny,
> I have a stylesheet that builds a Schema. In this schema I need to
> output the xml:lang attribute on some elements in this schema. My
> stylesheet creates the schema import statement as well as creating
> the xml:lang attributes at the right place. The problem is I don't
> get a namespace declaration at the top of the schema which the IBM
> quality checker and MSV complain about.
The Namespaces in XML Rec. states:
The namespace prefix, *unless it is xml* or xmlns, must have been
declared in a namespace declaration attribute in either the
start-tag of the element where the prefix is used or in an an
ancestor element (i.e. an element in whose content the prefixed
markup occurs). The prefix xml is by definition bound to the
namespace name http://www.w3.org/XML/1998/namespace.
http://www.w3.org/TR/REC-xml-names/#nsc-NSDeclared
(my emphasis)
So MSV and the IBM quality checker should not complain about the fact
that the xml prefix has not been declared; they are buggy.
Unfortunately, the only work-around around their bugginess in XSLT is
to revert to disable-output-escaping to create the xs:schema element,
which is very ugly and might not even work (it depends on how you're
calling the transformation). There's no clean way to force the XSLT
processor to output a namespace declaration for the XML namespace.
What I recommend you do, therefore, is use your stylesheet as is, and
either write a custom serialiser to add a namespace declaration for
the XML namespace or do a bit of search-and-replace text processing on
the output of the transformation to add the namespace declaration. Oh,
and I recommend that you write bug reports to the MSV and SQC
developers.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list