[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: [relax-ng-comment] RELAX NG Restrictions
Are any of the restrictions of the simplified form of RELAX NG applicable to the full form? I was making up a little Schematron schema (below) before I twigged that the restrictions were not generally applicable, and it would be nice not to throw the whole thing out. Cheers Rick <schema xmlns="http://www.ascc.net/xml/schematron" > <title>Simplified RELAX NG Restrictions</title> <ns prefix="r" uri="http://relaxng.org/ns/structure/1.0"/> <p>This schema validates various restrictions on RELAX NG after it has been simplified.</p> <p>See http://www.oasis-open.org/committees/relax-ng/spec-20011203.html#restriction</p> <pattern name="Restrictions"> <rule context="r:ref"> <report test="ancestor::r:attribute" >(Simplified RELAX NG) An <attribute> should not have a <ref> anywhere under it</report> <report test="ancestor::r:list" >(Simplified RELAX NG) A <list> should not have a <ref> anywhere under it</report> <report test="ancestor::r:except[parent::r:data]" >(Simplified RELAX NG) A <except> element contained by a <data> should not have a <ref> anywhere under it</report> </rule> <rule context="list"> <report test="ancestor::r:attribute" >(Simplified RELAX NG) An <attribute> should not have a <list> anywhere under it</report> <report test="ancestor::r:list" >(Simplified RELAX NG) A <list> should not have a <list> anywhere under it</report> <report test="ancestor::r:start" >(Simplified RELAX NG) A <start> should not have a <list> anywhere under it</report> <report test="ancestor::r:except[parent::r:data]" >(Simplified RELAX NG) A <except> element contained by a <data> should not have a <list> anywhere under it</report> <report test="ancestor::r:interleave[ancestor::r:oneOrMore]" >(Simplified RELAX NG) A <oneOrMore> element anywhere under an <interleave> element should not have a <list> anywhere under it</report> </rule> <rule context="r:text"> <report test="ancestor::r:start" >(Simplified RELAX NG) An <start> should not have a <text> anywhere under it</report> <report test="ancestor::r:list" >(Simplified RELAX NG) A <list> should not have a <text> anywhere under it</report> <report test="ancestor::r:except[parent::r:data]" >(Simplified RELAX NG) A <except> element contained by a <data> should not have a <text> anywhere under it</report> </rule> <rule context="r:interleave "> <report test="count(//r:text) > 1" >An <interleave> should not have more than one <text> descendents</report> <report test="ancestor::r:list" >(Simplified RELAX NG) An <list> should not have a <<name />> anywhere under it</report> <report test="ancestor::r:start" >(Simplified RELAX NG) An <start> should not have a <<name />> anywhere under it</report> <report test="ancestor::r:except[parent::r:data]" >(Simplified RELAX NG) A <except> element contained by a <data> should not have a <<name />> anywhere under it</report> </rule> <rule context="r:attribute"> <report test="ancestor::r:group[parent::r:oneOrMore]" >(Simplified RELAX NG) A <oneOrMore> element containing an <group> should not have a <<name />> anywhere under it</report> </rule> <rule context="r:group | r:oneOrMore | r:empty"> <report test="ancestor::r:start" >(Simplified RELAX NG) An <start> should not have a <<name />> anywhere under it</report> <report test="ancestor::r:except[parent::r:data]" >(Simplified RELAX NG) A <except> element contained by a <data> should not have a <<name />> anywhere under it</report> </rule> <rule context="r:data | r:value"> <report test="ancestor::r:start" >(Simplified RELAX NG) An <start> should not have a <<name />> anywhere under it</report> </rule> </pattern> <!-- <pattern name="String_Sequences"> <rule context="r:element[not(//r:list)] | r:attribute[not(//r:list)]"> ??? </rule> </pattern> --> <pattern name="Restrictions_on_Attributes_1"> <!-- limitation: only handles name attributes --> <!-- the count(*) is too broad --> <rule context="r:group[count(*)>1]//r:attribute[@name] "> <report test= "count(ancestor::r:group//r:attribute/@name=current()/@name)>1 or count(ancestor::r:group//r:attribute//r:name=current()/@name)>1" >(Simplified RELAX) Duplicate attributes are not allowed. </report> </rule> <rule context="r:interleave[count(*)>1]//r:attribute[@name]"> <report test= "count(ancestor::r:interleave//r:attribute/@name=current()/@name)>1 or count(ancestor::r:interleave//r:attribute//r:name=current()/@name)>1" >(Simplified RELAX) Duplicate attributes are not allowed. </report> </rule> </pattern> <pattern name="Restrictions_on_Attributes_2"> <!-- limitation: only handles direct name elements --> <!-- the count(*) is too broad --> <rule context="r:group[count(*)> 1)]//r:attribute[r:name] "> <report test= "count(ancestor::r:group//r:attribute/@name=current()/r:name)>1 or count(ancestor::r:group//r:attribute//r:name=current()/r:name)>1" >(Simplified RELAX) Duplicate attributes are not allowed. </report> </rule> <rule context="r:interleave[count(*)>1]//r:attribute[r:name]"> <report test= "count(ancestor::r:interleave//r:attribute/@name=current()/r:name)>1 or count(ancestor::r:interleave//r:attribute//r:name=current()/r:name)>1" >(Simplified RELAX) Duplicate attributes are not allowed. </report> </rule> </pattern> </schema>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC