This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Generating the xml: namespace from XSLT into a schema
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 22 Jul 2002 10:45:25 +0100
- Subject: RE: [xsl] Generating the xml: namespace from XSLT into a schema
- Reply-to: xsl-list at lists dot mulberrytech dot com
I have hit the same problems with SQC, and they tell me it is a known
bug.
Note that there is an erratum to the XML Namespaces spec that makes it
clear that it is never necessary, but always permissible, to include a
declaration of the xml Namespace in an XML document. However, an XSLT
processor will not generally output such a declaration, because the
XPath model of a document is identical whether the namespace is declared
or not.
Some current XML parsers reject an explicit declaration of the xml
Namespace: the versions of Crimson and MSXML3 that I have installed on
my system do so, for example.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Danny Vint
> Sent: 20 July 2002 17:26
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Generating the xml: namespace from XSLT into a schema
>
>
> 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. Here's what I get in the output:
>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.ACORD.org/
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/"
> <!-- I need an xmlns:xml='xxx' here to make
> this correct -->
> elementFormDefault="unqualified"
> attributeFormDefault="unqualified"
> targetNamespace="http://www.ACORD.org/s
> attributeFormDefault="unqualified"
> targetNamespace="http://www.ACORD.org/standards/PC_Surety/ACOR
> D1.1.1/xml/"
> version="1.1.1">
> <xsd:annotation>
> <xsd:appinfo>
> <version>1.1.1</version>
> <genDate>Sun Jul 14 11:03:53 EDT 2002</genDate>
> </xsd:appinfo>
> </xsd:annotation>
> <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml-ns.xsd">
> <xsd:annotation>
> <xsd:documentation>Get access to the xml: attribute
> groups for
> xml:lang
> </xsd:documentation>
> </xsd:annotation>
> </xsd:import><!--Start of Data types-->
>
> ....
>
> <xsd:complexType>
> <xsd:simpleContent>
> <xsd:extension base="C-255">
> <xsd:attribute ref="xml:lang"/>
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
> </xsd:element>
> ...
> </xsd:schema>
>
> And the stylesheet has this:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
> xmlns:xml="http://www.w3.org/XML/1998/namespace"
>
> xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/"
> xmlns:saxon="http://icl.com/saxon"
> extension-element-prefixes="saxon">
>
> <!-- Adding this seems to cause problems with validation!
> xmlns="http://www.acord.org"
> -->
>
> <xsl:output method="xml" indent="yes" />
>
> ...
>
> <xsl:template match="/">
>
> <!-- START Schema Output -->
>
> <xsl:call-template name="notice"/>
>
> <xsd:schema>
> <xsl:attribute
> name="elementFormDefault">unqualified</xsl:attribute>
> <xsl:attribute
> name="attributeFormDefault">unqualified</xsl:attribute>
> <xsl:attribute name="targetNamespace"><xsl:value-of
> select="$target"/></xsl:attribute>
> <xsl:attribute name="version"><xsl:value-of
> select="ACORD-XML-DOC/@version"/></xsl:attribute>
>
> <!-- Information about the whole spec -->
> <xsd:annotation>
> <xsd:appinfo>
> <version><xsl:value-of
> select="ACORD-XML-DOC/@version"/></version>
> <genDate><xsl:value-of
> select="ACORD-XML-DOC/@genDate"/></genDate>
> </xsd:appinfo>
> </xsd:annotation>
>
> <!-- Support for the xml:lang attribute -->
> <xsd:import>
> <xsl:attribute
> name="namespace">http://www.w3.org/XML/1998/namespace</xsl:attribute>
> <xsl:attribute
> name="schemaLocation">xml-ns.xsd</xsl:attribute>
> <xsd:annotation>
> <xsd:documentation>Get access to the
> xml: attribute groups for xml:lang
> </xsd:documentation>
> </xsd:annotation>
> </xsd:import>
>
> <!-- If include_codes = no, then I need to include
> the external
> file -->
> <xsl:if test="$include_codes!='yes' and $code_types='yes'">
> <xsd:include schemaLocation="{$codelistfile}"/>
> </xsl:if>
> <xsl:apply-templates/>
> </xsd:schema>
>
> <!-- END Schema Output -->
>
> </xsl:template>
>
> .....
>
> plus other stuff
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list