W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

XML Schema/XSL conflict (can't differentiate unqualified locals)?

From: Brian Atkins <brian_atkins@firehunter.com>
Date: Mon, 8 Oct 2001 13:48:00 -0400 (EDT)
Message-ID: <3BC1E72D.A855D2DC@firehunter.com>
To: xsl-list@lists.mulberrytech.com, xmlschema-dev@w3.org
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
Received on Monday, 8 October 2001 15:13:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:24 GMT