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

XML Schema/XSL conflict (can't differentiate unqualifi

Subject: XML Schema/XSL conflict (can't differentiate unqualified locals)?
From: Brian Atkins <brian_atkins@xxxxxxxxxxxxxx>
Date: Mon, 08 Oct 2001 11:49:33 -0600
brian atkins
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@xxxxxxxxxxxxxx         (970) 288-2114
Agilent Technologies     4800 Wheaton Drive        Ft. Collins, CO 80525

 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.