W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2009

[XML Schema 1.1] Using doc() in xs:assert ... the referenced document needs a schema?

From: Costello, Roger L. <costello@mitre.org>
Date: Mon, 27 Apr 2009 10:18:22 -0400
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5003F245AA74@IMCMBX3.MITRE.ORG>

Hi Folks,

Here's a simple schema that uses xs:assert to check that the value of the <country> element matches one listed in an instance document (countries.xml):

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"

    <element name="Example">
                <element name="country">
                        <restriction base="string">
                            <assert test="$value = doc('countries.xml')//country" />


While running this example, I discovered these requirements:

   - the instance document referenced by xs:assert (countries.xml) 
     must have a schema, and 

   - I have to import that schema. 


These requirements don't seem reasonable to me. 

I should be able to reference any instance document (under my control or otherwise) and use it as a data source.

These requirements mean:

   - I can't reference instance documents that don't have a schema

   - I can't reference instance documents that uses some other
     schema language, such as DTD or RELAX NG.

   - Everything is tightly coupled: the schema, the referenced 
     instance document and its schema. I can't easily switch to 
     another instance document and use it as a data source.

Would someone please explain the rationale for these requirements?

Received on Monday, 27 April 2009 14:18:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:51 UTC