[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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/ACORD1.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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|