Subject: Re: [xsl] Referencing Multiple Schemas via a Single Schema From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Sun, 29 Dec 2002 13:47:05 +0000 |
Hi Garvin, > My problem is that I have an instance document pointing to multiple > Schemas and have to reference each schema in the instance document. > Is there anyway I can wrap the contents of multiple schemas into > once schema and reference that schema which would then import the > required schemas? These schemas are all defined in their own > namespaces. I find the schemaLocation attribute in my instance > document a bit messy. This is an XML Schema question rather than an XSL question, so you should really direct it to xmlschema-dev@xxxxxxx However, to answer it here, you should create a schema for one of your namespaces that includes the schema for that namespace and imports the schemas from the other namespaces. If a schema imports a schema from another namespace, you don't have to explicitly refer to the imported schema in the instance document. For example, you could use: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="file:///c:/xerces-2_0_1/data/msg/base"> <xs:include href="base/xmlsi_base.xsd" /> <xs:import namespace="file:///c:/xerces-2_0_1/data/msg/aOrder" href="aOrder/aOrder.xsd" /> <xs:import namespace="file:///c:/xerces-2_0_1/data/msg/header" href="header/xmlsi_header.xsd" /> <xs:import namespace="file:///c:/xerces-2_0_1/data/msg/common" href="common/xmlsi_common.xsd" /> <xs:import namespace="file:///c:/xerces-2_0_1/data/msg/bOrder" href="bOrder/bOrder.xsd" /> </xs:schema> Then you can reference this schema (at file:///c:/xerces-2_0_1/data/msg/msg.xsd, for example) from your instance document as follows: <?xml version="1.0"?> <bs:AMsg xmlns:mpo="file:///c:/xerces-2_0_1/data/msg/aOrder" xmlns:eqo="file:///c:/xerces-2_0_1/data/msg/bOrder" xmlns:bs="file:///c:/xerces-2_0_1/data/msg/base" xmlns:com="file:///c:/xerces-2_0_1/data/msg/common" xmlns:hdr="file:///c:/xerces-2_0_1/data/msg/header" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="file:///c:/xerces-2_0_1/data/msg/base file:///c:/xerces-2_0_1/data/msg/msg.xsd"> ... </bs:AMsg> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Referencing Multiple Schemas , Garvin Franco | Thread | [xsl] document identity test styles, Mike Brown |
[xsl] document identity test styles, Mike Brown | Date | [xsl] processing certain xml ,xsl f, Hubert Holtz |
Month |