<?xml version="1.0" encoding="UTF-8"?>
<!--
  (c) International Organization for Standardization 2005.
  Permission to copy in any form is granted for use with conforming
  SGML systems and applications as defined in ISO 8879,
  provided this notice is included in all copies.
-->


<grammar 
    ns="http://purl.oclc.org/dsdl/schematron"
    xmlns:ns1="http://www.dpawson.co.uk/rss/ns#" 
    xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" 
    xmlns:rng="http://relaxng.org/ns/structure/1.0" 
    xmlns="http://relaxng.org/ns/structure/1.0" 
    xmlns:html ="http://www.w3.org/1999/xhtml"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">


  <a:documentation>
    <html:h2>  ISO /IEC 19757-3:2006</html:h2>
    <html:p>Revision 1.0 </html:p>
    <html:p> (c) International Organization for Standardization 2005.
    Permission to copy in any form is granted for use with conforming
    SGML systems and applications as defined in ISO 8879, provided
    this notice is included in all copies.  </html:p>

    <dc:identifier>http://www.dpawson.co.uk/schematron/isoSchematron.rng</dc:identifier>
         <dc:creator>Dave Pawson</dc:creator>
         <dc:dateCreated>2007-01-24T10:54:45.0Z</dc:dateCreated>
         <dc:isPartOf>ISO/IEC 19757-3:2006</dc:isPartOf>
         <dc:publisher>http://www.dpawson.co.uk</dc:publisher>
         <dc:rights>&#xA9; Dave Pawson,  2007 </dc:rights>  
         <dc:creator>Dave Pawson</dc:creator>
        <a:revhistory>
              <a:revision>
                   <a:revnumber>1.0</a:revnumber>
                   <a:date>2007-01-24T10:56:47.0Z</a:date>
                   <a:authorinitials>Dave P</a:authorinitials>
                   <a:revremark>Initial release</a:revremark>
              </a:revision>
              <a:revision>
                   <a:revnumber>1.1</a:revnumber>
                   <a:date>2007-01-30T11:51:47.0Z</a:date>
                   <a:authorinitials>Dave P</a:authorinitials>
                   <a:revremark>Cross reference errors corrected.</a:revremark>
              </a:revision>

 
        </a:revhistory>
  </a:documentation>

<div html:id="root">
    <html:h3>Document element</html:h3>
  <start>
    <ref name="Schema"/>
  </start>
</div>





<div html:id="schema"> 
<html:h3>Element schema</html:h3> 
<html:p>Document element, Root of a schematron file </html:p> 
  <define name="Schema">
    <element name="schema">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <ref name="Rich"/>
      <optional>
          <ref name="SchemaVersion"/>
      </optional>

      <optional>
	<ref name="DefaultPhase"/>
      </optional>

      <optional>
	<ref name="QueryBinding"/>
      </optional>

      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <ref name="Inclusion"/>
        </zeroOrMore>

        <group>
          <optional>
            <ref name="Title"/>
          </optional>

          <zeroOrMore>
            <ref name="Ns"/>
          </zeroOrMore>

          <zeroOrMore>
            <ref name="P"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="Let"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="Phase"/>
          </zeroOrMore>
          <oneOrMore>
            <ref name="Pattern"/>
          </oneOrMore>
          <zeroOrMore>
            <ref name="P"/>
          </zeroOrMore>
          <optional>
            <ref name="Diagnostics"/>
          </optional>
        </group>
      </interleave>
    </element>
  </define>
</div>


<div html:id="schemaVersion"> 
<html:h3>Attribute schemaVersion </html:h3> 
<html:p>An optional attribute, containing a non-empty string
indicating the version of the Schematron schema in use </html:p>
<define name="SchemaVersion"> 
 <attribute name="schemaVersion">
   <ref name="Non-empty-string"/>
 </attribute>
</define> 
</div>

<div html:id="defaultPhase"> 
<html:h3>Attribute defaultPhase </html:h3> 
<html:p>An optional attribute, containing an IDREF which links to a
phase definition </html:p>
<define name="DefaultPhase"> 
 <attribute name="defaultPhase">
   <data type='IDREF'/>
 </attribute>
</define> 
</div>


<div html:id="queryBinding"> 
<html:h3>Attribute queryBinding </html:h3> 
<html:p>An optional attribute, containing a non-empty string
indicating the query language binding in use. Could be xslt1, xslt2 or
python. Should match the implementation being used.</html:p>
<define name="QueryBinding"> 
 <attribute name="queryBinding">
   <ref name="Non-empty-string"/>
 </attribute>
</define> 
</div>



<div html:id="non-empty-string"> 
<html:h3>Data type, a non empty string </html:h3> 
<define name="Non-empty-string"> 
    <data type="token">
      <param name="minLength">1</param>
    </data>
</define> 
</div>



<div html:id="active"> 
<html:h3>Element active</html:h3> 
<html:p>A child of the <html:a href="#phase">phase</html:a> element,
the active element specifyies which patterns are to be used in this
phase of validation.  </html:p>
  <define name="Active">
    <element name="active">
      <attribute name="pattern">
        <data type="IDREF"/>
      </attribute>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <choice>
            <text/>
            <ref name="dir"/>
            <ref name="emph"/>
            <ref name="span"/>
          </choice>
        </zeroOrMore>
      </interleave>
    </element>
  </define>
</div>


<div html:id="assert"> 
<html:h3>Element assert</html:h3> 
<html:p>An assertion made within the context (of the input document)
specified by test attribute. If the test evaluates positive the
assertion succeeds. If the assertion fails, the contained text is
output. </html:p>
  <define name="Assert">
    <element name="assert">
      <attribute name="test">
        <ref name="ExprValue"/>
      </attribute>
      <optional>
        <attribute name="flag">
          <ref name="flagValue"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="diagnostics">
          <data type="IDREFS"/>
        </attribute>
      </optional>
      <ref name="Rich"/>
      <ref name="Linkable"/>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <choice>
            <text/>
            <ref name="Name"/>
            <ref name="Value-of"/>
            <ref name="emph"/>
            <ref name="dir"/>
            <ref name="span"/>
          </choice>
        </zeroOrMore>
      </interleave>
    </element>
  </define>
</div>



<div html:id="diagnostic"> 
<html:h3>Element diagnostic</html:h3> 
<html:p>An individual diagnostic message referenced from an <html:a
href="#assert">assert</html:a> or <html:a
href="#report">report</html:a> statements.  </html:p>
  <define name="Diagnostic">
    <element name="diagnostic">
      <attribute name="id">
        <data type="ID"/>
      </attribute>
      <ref name="Rich"/>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <choice>
            <text/>
            <ref name="Value-of"/>
            <ref name="emph"/>
            <ref name="dir"/>
            <ref name="span"/>
          </choice>
        </zeroOrMore>
      </interleave>
    </element>
  </define>
</div>



<div html:id="diagnostics"> 
<html:h3>Element diagnostics</html:h3> 
<html:p>A wrapper for individual <html:a
href="#diagnostic">diagnostic</html:a> messages referenced from <html:a
href="#assert">assert</html:a> or <html:a
href="#report">report</html:a> statements.  </html:p>
  <define name="Diagnostics">
    <element name="diagnostics">
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <ref name="Inclusion"/>
        </zeroOrMore>
        <zeroOrMore>
          <ref name="Diagnostic"/>
        </zeroOrMore>
      </interleave>
    </element>
  </define>
</div>

<div html:id="dir"> 
<html:h3>Element dir</html:h3> 
<html:p>Text in which the writing direction is specified, either as
ltr (left to right) or rtl(right to left)</html:p>
  <define name="dir">
    <element name="dir">
      <optional>
        <attribute name="value">
          <choice>
            <value>ltr</value>
            <value>rtl</value>
          </choice>
        </attribute>
      </optional>
      <interleave>
        <ref name="Foreign"/>
        <text/>
      </interleave>
    </element>
  </define>
  <define name="emph">
    <element name="emph">
      <text/>
    </element>
  </define>
  <define name="extends">
    <element name="extends">
      <attribute name="rule">
        <data type="IDREF"/>
      </attribute>
      <ref name="Foreign-empty"/>
    </element>
  </define>
</div>


<div html:id="let"> 
<html:h3>Element let</html:h3> 
<html:p>Declares a named variable. If within a rule, it is scoped to
the current <html:a href="rule">rule</html:a>, otherwise it is scoped
to the instance document root. The variable name is specified using
the name attribute and the value calculated using the value
attribute.</html:p>
  <define name="Let">
    <element name="let">
      <attribute name="name">
        <ref name="nameValue"/>
      </attribute>
      <attribute name="value">
        <data type="string" datatypeLibrary=""/>
      </attribute>
    </element>
  </define>
</div>


<div html:id="name"> 
<html:h3>Element name </html:h3> 
<html:p>Provides indirect access to nodes in the input document. If
the optional path attribute is used, then this node is
retrieved. Without the path attribute, the name of the current context
node is retrieved. </html:p>
  <define name="Name">
    <element name="name">
      <optional>
        <attribute name="path">
          <ref name="PathValue"/>
        </attribute>
      </optional>
      <ref name="Foreign-empty"/>
    </element>
  </define>
</div>


<div html:id="ns"> 
<html:h3>Element ns </html:h3> 
<html:p>Use this to specify a namespace and the associated namespace prefix. 
e.g. <html:code>&lt;ns prefix='dp' uri='http://www.dpawson.co.uk/ns#'/></html:code>
 </html:p> 
  <define name="Ns">
    <element name="ns">
      <attribute name="uri">
        <ref name="UriValue"/>
      </attribute>
      <attribute name="prefix">
        <ref name="nameValue"/>
      </attribute>
      <ref name="Foreign-empty"/>
    </element>
  </define>
</div>


<div html:id="p"> 
<html:h3>Element p</html:h3> 
<html:p>A basic paragraph to help with documentation. Styling can be
aided with the class attribute and the icon attribute. It may contain
foreign elements. </html:p>
  <define name="P">
    <element name="p">
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="class">
          <ref name="ClassValue"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="icon">
          <ref name="UriValue"/>
        </attribute>
      </optional>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <choice>
            <text/>
            <ref name="dir"/>
            <ref name="emph"/>
            <ref name="span"/>
          </choice>
        </zeroOrMore>
      </interleave>
    </element>
  </define>
</div>



<div html:id="param"> 
<html:h3>Element param</html:h3> 
<html:p>An element holding the name and value of a parameter passed to
an abstract <html:a href="#pattern">pattern</html:a>.  </html:p>
  <define name="Param">
    <element name="param">
      <attribute name="name">
        <ref name="nameValue"/>
      </attribute>
      <attribute name="value">
        <ref name="Non-empty-string"/>
      </attribute>
    </element>
  </define>
</div>

<div html:id="pattern"> 
<html:h3>Element pattern.</html:h3> 
<html:p>A wrapper element for <html:a href="rule">rules</html:a>. 
A pattern is said to be abstract when the abstract attribute has the
value 'true'. An abstract rule may be applied within different
contexts with <html:a href="#param">param</html:a>eters being used to
set the values retrieved in the pattern by the $name
construction. Patterns may be documented using the <html:a
href="#title">title</html:a> and <html:a href="#p">p</html:a>
children. </html:p>
  <define name="Pattern">
    <element name="pattern">
      <ref name="Rich"/>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <ref name="Inclusion"/>
        </zeroOrMore>



        <choice>

          <group>
            <attribute name="abstract">
              <value>true</value>
            </attribute>
            <attribute name="id">
              <data type="ID"/>
            </attribute>
            <optional>
              <ref name="Title"/>
            </optional>
	    <group>
	      <zeroOrMore>
                <ref name="P"/>
              </zeroOrMore>
              <zeroOrMore>
                <ref name="Let"/>
              </zeroOrMore>
              <zeroOrMore>
                <ref name="Rule"/>
              </zeroOrMore>
            </group>
          </group>

          <group>
            <optional>
              <attribute name="abstract">
                <value>false</value>
              </attribute>
            </optional>
            <optional>
              <attribute name="id">
                <data type="ID"/>
              </attribute>
            </optional>
            <optional>
              <ref name="Title"/>
            </optional>
            <group>
              <zeroOrMore>
                <ref name="P"/>
              </zeroOrMore>
              <zeroOrMore>
                <ref name="Let"/>
              </zeroOrMore>
              <zeroOrMore>
                <ref name="Rule"/>
              </zeroOrMore>
            </group>
          </group>

          <group>
            <optional>
              <attribute name="abstract">
                <value>false</value>
              </attribute>
            </optional>
            <attribute name="is-a">
              <data type="IDREF"/>
            </attribute>
            <optional>
              <attribute name="id">
                <data type="ID"/>
              </attribute>
            </optional>
            <optional>
              <ref name="Title"/>
            </optional>
            <group>
              <zeroOrMore>
                <ref name="P"/>
              </zeroOrMore>
              <zeroOrMore>
                <ref name="Param"/>
              </zeroOrMore>
            </group>
          </group>

        </choice>
      </interleave>
    </element>
  </define>
</div>



<div html:id="phase"> 
<html:h3>Element phase</html:h3> 
<html:p>A set of patterns which are run at the same time. Enables
progressive validation of an instance. The patterns are identified by
the child <html:a href="active">active</html:a> children, and the
group of patterns (the phase) is identified by the id attribute on the
phase element.  </html:p>
  <define name="Phase">
    <element name="phase">
      <attribute name="id">
        <data type="ID"/>
      </attribute>
      <ref name="Rich"/>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <ref name="Inclusion"/>
        </zeroOrMore>
        <group>
          <zeroOrMore>
            <ref name="P"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="Let"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="Active"/>
          </zeroOrMore>
        </group>
      </interleave>
    </element>
  </define>
</div>



<div html:id="report"> 
<html:h3>Element report</html:h3> 
<html:p>If the test attribute evaluates positive, then the report is
said to succeed. The output of a report statement is seen when the
report succeeds. Additional diagnostic information may be generated by
<html:a href="#diagnostics">diagnostics</html:a> element specified by
the diagnostics attribute, an IDREF link. The mixed content of the
element can include <html:a href="#name">name</html:a>, <html:a
href="#value-of">value-of</html:a>, <html:a
href="emph">emph</html:a>asis, <html:a href="#dir">dir</html:a> and
<html:a href="#span">span</html:a> elements. </html:p>
  <define name="Report">
    <element name="report">
      <attribute name="test">
        <ref name="ExprValue"/>
      </attribute>
      <optional>
        <attribute name="flag">
          <ref name="flagValue"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="id">
          <data type="ID"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="diagnostics">
          <data type="IDREFS"/>
        </attribute>
      </optional>
      <ref name="Rich"/>
      <ref name="Linkable"/>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <choice>
            <text/>
            <ref name="Name"/>
            <ref name="Value-of"/>
            <ref name="emph"/>
            <ref name="dir"/>
            <ref name="span"/>
          </choice>
        </zeroOrMore>
      </interleave>
    </element>
  </define>
</div>


<div html:id="rule"> 
<html:h3>Element rule</html:h3> 
<html:p>A wrapper for a list of <html:a href="#assert">assert</html:a>
and <html:a href="report">report</html:a> statements. The context in
which the assertions are made is defined by the context attribute. 
</html:p>
  <define name="Rule">
    <element name="rule">
      <optional>
        <attribute name="flag">
          <ref name="flagValue"/>
        </attribute>
      </optional>
      <ref name="Rich"/>
      <ref name="Linkable"/>
      <interleave>
        <ref name="Foreign"/>
        <zeroOrMore>
          <ref name="Inclusion"/>
        </zeroOrMore>
        <choice>
          <group>
            <attribute name="abstract">
              <value>true</value>
            </attribute>
            <attribute name="id">
              <data type="ID"/>
            </attribute>
            <zeroOrMore>
              <ref name="Let"/>
            </zeroOrMore>
            <oneOrMore>
              <choice>
                <ref name="Assert"/>
                <ref name="Report"/>
                <ref name="extends"/>
              </choice>
            </oneOrMore>
          </group>
          <group>
            <attribute name="context">
              <ref name="PathValue"/>
            </attribute>
            <optional>
              <attribute name="id">
                <data type="ID"/>
              </attribute>
            </optional>
            <optional>
              <attribute name="abstract">
                <value>false</value>
              </attribute>
            </optional>
            <zeroOrMore>
              <ref name="Let"/>
            </zeroOrMore>
            <oneOrMore>
              <choice>
                <ref name="Assert"/>
                <ref name="Report"/>
                <ref name="extends"/>
              </choice>
            </oneOrMore>
          </group>
        </choice>
      </interleave>
    </element>
  </define>
</div>

<div html:id="span"> 
<html:h3>Element span</html:h3> 
<html:p>An inline markup for decoration in the report message. The
differentiation is set by the class attribute, used as in HTML
</html:p>
  <define name="span">
    <element name="span">
      <attribute name="class">
        <ref name="ClassValue"/>
      </attribute>
      <interleave>
        <ref name="Foreign"/>
        <text/>
      </interleave>
    </element>
  </define>
</div>

<div html:id="title"> 
<html:h3>Element title</html:h3> 
<html:p>A decorative element, allowing the association of a
descriptive title to either an entire schema or pattern. Not required
to be implemented.</html:p>
  <define name="Title">
    <element name="title">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="dir"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
</div>


<div html:id="value-of"> 
<html:h3>Element value-of</html:h3> 
<html:p>A way of retrieving values from the instance document. Context
is the current rule context. </html:p>
  <define name="Value-of">
    <element name="value-of">
      <attribute name="select">
        <ref name="PathValue"/>
      </attribute>
      <ref name="Foreign-empty"/>
    </element>
  </define>
</div>





  <!-- common declarations -->

<div html:id="inclusion"> 
<html:h3>Element include</html:h3> 
<html:p>Include an external Schematron file (as specified by the href
attribute) appropriate to the place within the schema at which the
include is found. </html:p>
<define name="Inclusion"> 
 <element name="include">
      <attribute name="href">
        <ref name="UriValue"/>
      </attribute>
    </element>
</define> 
</div>


<div html:id="rich.att"> 
<html:h3>Rich. </html:h3> 
<html:p>A set of optional attributes which may be used to decorate some elements </html:p> 
  <define name="Rich">
    <optional>
      <attribute name="icon">
        <ref name="UriValue"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="see">
        <ref name="UriValue"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="fpi">
        <ref name="FpiValue"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="xml:lang">
        <ref name="LangValue"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="xml:space">
        <choice>
          <value>preserve</value>
          <value>default</value>
        </choice>
      </attribute>
    </optional>
  </define>
</div>

<div html:id="linkable.att"> 
<html:h3>linkable attribute </html:h3>
<html:p>Optional attributes (role and subject). If the subject is
present, the role attribute labels the arc between the context node
and any nodes which match the subject value (an xpath expression).
</html:p>
  <define name="Linkable">
    <optional>
      <attribute name="role">
        <ref name="RoleValue"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="subject">
        <ref name="PathValue"/>
      </attribute>
    </optional>
  </define>
</div>

 





  <!-- Data types -->
<div html:id="uriValue.dat"> 
<html:h3>Datatype uriValue </html:h3> 
<html:p>A URI, used as the value of an attribute to specify, for
example, an inclusion, an icon file, or simply a namespace URI
</html:p>
  <define name="UriValue">
    <data type="anyURI"/>
  </define>
</div>

<div html:id="pathValue.dat"> 
<html:h3>Datatype pathValue </html:h3> 
<html:p>An xpath expression returning a node value or name (dependent
on context) </html:p>
  <define name="PathValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>

<div html:id="exprValue.dat"> 
<html:h3>Datatype exprValue </html:h3> 
<html:p>An xpath expression returning a boolean value. See <html:a
href="#assert">assert</html:a> and <html:a
href="#report">report</html:a> which both use the test
attribute. </html:p>
  <define name="ExprValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>

<div html:id="fpiValue.dat"> 
<html:h3>Datatype  fpiValue </html:h3> 
<html:p>A formal public identifier for containing element (schema, assert, report etc) </html:p> 
  <define name="FpiValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>

<div html:id="langValue.dat"> 
<html:h3>Datatype  langValue</html:h3> 
<html:p>The value assigned to an xml:lang attribute. Normally used to
identify the language used in the containing element and its children. </html:p>
  <define name="LangValue">
    <data type="language"/>
  </define>
</div>

<div html:id="roleValue.dat"> 
<html:h3>Datatype  roleValue</html:h3> 
<html:p>The role attribute allows you to label the subject and subject
nodes of assertions with simple labels. You could also see it as
labelling the arcs between context subject and the arc subjects. For
example, if generating RDF: see <html:a
href="http://lists.xml.org/archives/xml-dev/200308/msg00541.html">xml-dev
archive</html:a></html:p>
<html:p>For example, imagine you had a document containing gene sequences. You
could use the role attribute to label the junk DNA parts.</html:p>
<html:p>So the role could be what role the subject plays in the document, but is
could be what role the subject plays in the pattern, or what role the rule
plays in the pattern.</html:p>
<html:p>The role attribute is used, therefore, like a kind of type binding, but
instead of binding the node to a type name, it is bound to (one or more)
arbitrary names.</html:p> 
  <define name="RoleValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>

<div html:id="flagValue.dat"> 
<html:h3>Datatype flagValue </html:h3> 
<html:p>A string used as the name of a boolean flag </html:p> 
  <define name="flagValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>

<div html:id="nameValue.dat"> 
<html:h3>Datatype nameValue </html:h3> 
<html:p>The string which is the name of a variable, namespace prefix or parameter</html:p> 
  <define name="nameValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>

  <!-- In the default query language binding, xsd:NCNAME -->

<div html:id="classValue.dat"> 
<html:h3>Datatype classValue </html:h3> 
<html:p>A string used to hold the class of an element</html:p>
  <define name="ClassValue">
    <data type="string" datatypeLibrary=""/>
  </define>
</div>


<div html:id="foreign"> 
<html:h3>Element 'foreign'</html:h3> 
<html:p>An element not in the Schematron namespace </html:p> 
<define name="Foreign">
    <ref name="Foreign-attributes"/>
    <zeroOrMore>
      <ref name="Foreign-element"/>
    </zeroOrMore>
  </define>
</div>

<div html:id="foreign-element"> 
<html:h3>Element 'foreign-element'</html:h3> 
<html:p>Any element not in the Schematron namespace </html:p> 
  <define name="Foreign-element">
    <element>
      <anyName>
	<except>
	  <nsName/>
	</except>
      </anyName>
      <zeroOrMore>
	<choice>
	  <attribute>
	    <anyName/>
	  </attribute>
	  <ref name="Foreign-element"/>
	  <ref name="Schema"/>
	  <text/>
	</choice>
      </zeroOrMore>
    </element>
  </define>
</div>


<div html:id="foreign-empty"> 
  <html:h3>An empty element with foreign attributes</html:h3> 
  <html:p>An element not in the Schematron namespace which is empty and may contain attributes </html:p> 
  <define name="Foreign-empty">
    <ref name="Foreign-attributes"/>
  </define>
</div>
 


<div html:id="foreign-attributes.att"> 
<html:h3>Foreign attributes </html:h3>
<html:p>attributes of elements in a namespace other than the
Schematron namespace. </html:p> 
  <define name="Foreign-attributes">
    <zeroOrMore>
      <attribute>
        <anyName>
          <except>
            <nsName ns=""/>
            <nsName ns="http://www.w3.org/XML/1998/namespace"/>
          </except>
        </anyName>
      </attribute>
    </zeroOrMore>
  </define>
</div>


</grammar>

<!-- 

<div html:id=""> 
<html:h3>Element </html:h3> 
<html:p> </html:p> 

</div>


<div html:id=""> 
<html:h3>Element </html:h3> 
<html:p> </html:p> 
<define name=""> 
  <element name=""> 
    <mixed>
      <zeroOrMore>
	<choice>
	  <ref name=""/>
	</choice>
      </zeroOrMore>
    </mixed>
</element> 
</define> 
</div>


 -->