This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
XML Schema/XSL conflict (can't differentiate unqualified locals)?
- To: xsl-list at lists dot mulberrytech dot com, xmlschema-dev at w3 dot org
- Subject: [xsl] XML Schema/XSL conflict (can't differentiate unqualified locals)?
- From: Brian Atkins <brian_atkins at firehunter dot com>
- Date: Mon, 08 Oct 2001 11:49:33 -0600
- Organization: Firehunter Operation - Agilent Technologies
- Reply-To: xsl-list at lists dot mulberrytech dot com
Here is a scenario I can't find a solution for, given the schema
definitions and capabilities of XSL. It appears that the XML schema
and the capabilities of XSL are incompatible, at least in this case.
I felt, since this could be a problem/issue with either the XML Schema,
XSL, or both (or, most likely, my understanding of both), that a
cross post was in order.
The schema below specify that locals *cannot* be qualified. Thus,
specifying t1:spam or t2:spam in the instance document will cause
the elements to be not found.
Thus, in the following document, there is, to my knowledge (such as it is), no
way to differentiate the two 'spam' elements from different namespaces
(at least without including enough of the ancestors to get back to a
qualified global) in an XSL stylesheet. Am I missing something?
Perhaps the answer is that the author of schema doc.xsd must realize that
anyone who wanted to differentiate spam elements (a possible conflict
due to that authors definition of the "any" namespaces) would need to qualify
locals and set elementFormDefault, or form, accordingly. I don't think this
is reasonable, however, since they may not know the other schema that well
(imagine the schema author wanted to allow HTML or WML to be the content,
but not being an expert at either).
Instance Document:
------------------
<?xml version="1.0" encoding="utf-8"?>
<d:doc xmlns:d='http://www.test.com/doc'
xmlns:t1='http://www.test.com/test1'
xmlns:t2='http://www.test.com/test2'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.test.com/doc doc.xsd
http://www.test.com/test1 test1.xsd
http://www.test.com/test2 test2.xsd'>
<t1:test>
<spam>Test1</spam>
</t1:test>
<t2:test>
<spam>Test2</spam>
</t2:test>
</d:doc>
Top level schema:
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace='http://www.test.com/doc'
xmlns='http://www.test.com/doc'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name="doc">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://www.test.com/test1
http://www.test.com/test2"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Schema Test1:
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace='http://www.test.com/test1'
xmlns='http://www.test.com/test1'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="spam" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Schema Test2:
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace='http://www.test.com/test2'
xmlns='http://www.test.com/test2'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="spam" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Thanks
Brian Atkins
--
Brian Atkins brian_atkins@firehunter.com (970) 288-2114
Agilent Technologies 4800 Wheaton Drive Ft. Collins, CO 80525
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list