W3C home > Mailing lists > Public > public-xsd-databinding-comments@w3.org > May 2009

Advanced XML Schema Patterns for Databinding Version 1.0: Schematron improvements

From: Rick Jelliffe <rjelliffe@allette.com.au>
Date: Wed, 13 May 2009 22:57:58 +1000
Message-ID: <4A0AC3D6.8050005@allette.com.au>
To: public-xsd-databinding-comments@w3.org
Very interesting note.

The Schematron schema has several errors and some improvements I would 
like to suggests:

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
    queryBinding="xslt2">
    <sch:title>Advanced XML Schema Patterns for Databinding Version 1.0<sch:title>
    <sch:ns prefix="xs" uri="http://www.w3.org/2001/XMLSchema"></sch:ns>

    <sch:pattern id="StringElement">
        <sch:rule context="/">
            <sch:report 
            test=".//xs:element/@type[resolve-QName(.,..) = xs:QName('xs:string')]"
            see="http://www.w3.org/2002/ws/databinding/patterns/6/09/StringElement">
            The StringElement pattern is known to cause errors in some databinding applications.
            </sch:report>
        </sch:rule>
    </sch:pattern>

    
    <!-- other patterns .. -->

</sch:schema>

The errors and improvements are:

1) sch:schema/@queryBinding is necessary to select using and XSLT2 processor
2) sch:schema/sch:title is required
3) sch:rule/@context is required
4) the count(...)=0 is redundant since a present node will be converted to boolean true
5) The sch:report/@see attribute is provided to allow reference to URLs
6) sch:pattern/@name is obsolete for ISO Schematron: sch:pattern/@id for ids and 
   sch:pattern/sch:title for human readable
7) You use of "pattern" seems to accord with Schematron's concept, so each pattern
can be a new sch:pattern
8) A better human readable text message. 



For a best practice, human-generated schema the .//xxx can be in the sch:rule/@context.
In that case, the following would be a better version of the schema:

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
    queryBinding="xslt2">
    <sch:title>Advanced XML Schema Patterns for Databinding Version 1.0<sch:title>
    <sch:ns prefix="xs" uri="http://www.w3.org/2001/XMLSchema"></sch:ns>

    <sch:pattern id="StringElement">
        <sch:rule context="xs:element">
            <sch:report 
            test="@type[resolve-QName(.,..) = xs:QName('xs:string')]"
            see="http://www.w3.org/2002/ws/databinding/patterns/6/09/StringElement">            
            The StringElement pattern is known to cause errors in some databinding applications.
            </sch:report>
        </sch:rule>
    </sch:pattern>

    
    <!-- other patterns .. -->

</sch:schema>


Cheers, and encouragement
Rick Jelliffe
Received on Wednesday, 13 May 2009 12:58:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 13 May 2009 12:58:46 GMT