Advanced XML Schema Patterns for Databinding Version 1.0: Schematron improvements

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 UTC