[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Generating the xml: namespace from XSLT into a sch

Subject: RE: Generating the xml: namespace from XSLT into a schema
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 22 Jul 2002 10:45:25 +0100
xml ns.xsd
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@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Danny Vint
> Sent: 20 July 2002 17:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.