From: Norman Walsh Date: Thu, 20 Oct 2005 18:33:34 +0000 (+0000) Subject: Add s:pattern elements to Schematron rules X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3da70f87f9edf7fca09c9497dbc89ba2bee93f6;p=docbook-dsssl Add s:pattern elements to Schematron rules --- diff --git a/docbook/relaxng/docbook/src/glossary.rnc b/docbook/relaxng/docbook/src/glossary.rnc index 0ab68be90..7d398ea56 100644 --- a/docbook/relaxng/docbook/src/glossary.rnc +++ b/docbook/relaxng/docbook/src/glossary.rnc @@ -125,11 +125,14 @@ div { db.glosssee = [ - s:rule [ - context = "db:glosssee[@otherterm]" - s:assert [ - test = "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" - "@otherterm on glosssee must point to a glossentry." + s:pattern [ + name = "Glosssary 'see' type constraint" + s:rule [ + context = "db:glosssee[@otherterm]" + s:assert [ + test = "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" + "@otherterm on glosssee must point to a glossentry." + ] ] ] ] @@ -158,11 +161,14 @@ div { db.glossseealso = [ - s:rule [ - context = "db:glossseealso[@otherterm]" - s:assert [ - test = "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" - "@otherterm on glossseealso must point to a glossentry." + s:pattern [ + name = "Glossary 'seealso' type constraint" + s:rule [ + context = "db:glossseealso[@otherterm]" + s:assert [ + test = "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" + "@otherterm on glossseealso must point to a glossentry." + ] ] ] ] @@ -190,11 +196,14 @@ div { db.firstterm = [ - s:rule [ - context = "db:firstterm[@linkend]" - s:assert [ - test = "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" - "@linkend on firstterm must point to a glossentry." + s:pattern [ + name = "Glossary 'firstterm' type constraint" + s:rule [ + context = "db:firstterm[@linkend]" + s:assert [ + test = "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on firstterm must point to a glossentry." + ] ] ] ] @@ -222,11 +231,14 @@ div { db.glossterm = [ - s:rule [ - context = "db:glossterm[@linkend]" - s:assert [ - test = "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" - "@linkend on glossterm must point to a glossentry." + s:pattern [ + name = "Glossary 'glossterm' type constraint" + s:rule [ + context = "db:glossterm[@linkend]" + s:assert [ + test = "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on glossterm must point to a glossentry." + ] ] ] ] @@ -314,11 +326,14 @@ div { db.termdef = [ - s:rule [ - context = "db:termdef" - s:assert [ - test = "count(db:glossterm) != 1" - "A termdef must contain a glossterm" + s:pattern [ + name = "Glossary term definition constraint" + s:rule [ + context = "db:termdef" + s:assert [ + test = "count(db:glossterm) != 1" + "A termdef must contain a glossterm" + ] ] ] ] diff --git a/docbook/relaxng/docbook/src/pool.rnc b/docbook/relaxng/docbook/src/pool.rnc index 0c160d3d7..670ae640f 100644 --- a/docbook/relaxng/docbook/src/pool.rnc +++ b/docbook/relaxng/docbook/src/pool.rnc @@ -1890,11 +1890,14 @@ div { db.seglistitem = [ - s:rule [ - context = "db:seglistitem" - s:assert [ - test = "count(db:seg) = count(../db:segtitle)" - "The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist" + s:pattern [ + name = "Cardinality of segments and titles" + s:rule [ + context = "db:seglistitem" + s:assert [ + test = "count(db:seg) = count(../db:segtitle)" + "The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist" + ] ] ] ] @@ -2819,11 +2822,14 @@ div { db.synopfragmentref = [ - s:rule [ - context = "db:synopfragmentref" - s:assert [ - test = "local-name(//*[@id=current()/@linkend]) = 'synopfragment' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" - "@linkend on synopfragmentref must point to a synopfragment." + s:pattern [ + name = "Synopsis fragment type constraint" + s:rule [ + context = "db:synopfragmentref" + s:assert [ + test = "local-name(//*[@id=current()/@linkend]) = 'synopfragment' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on synopfragmentref must point to a synopfragment." + ] ] ] ] @@ -6639,11 +6645,14 @@ div { db.footnoteref = [ - s:rule [ - context = "db:footnoteref" - s:assert [ - test = "local-name(//*[@id=current()/@linkend]) = 'footnote' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" - "@linkend on footnoteref must point to a footnote." + s:pattern [ + name = "Footnote reference type constraint" + s:rule [ + context = "db:footnoteref" + s:assert [ + test = "local-name(//*[@id=current()/@linkend]) = 'footnote' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on footnoteref must point to a footnote." + ] ] ] ] diff --git a/docbook/relaxng/tools/augment.xsl b/docbook/relaxng/tools/augment.xsl index 28e081b96..8621adaf6 100644 --- a/docbook/relaxng/tools/augment.xsl +++ b/docbook/relaxng/tools/augment.xsl @@ -87,13 +87,15 @@ --> - - - - must not occur in the descendants of - - - + + + + + must not occur in the descendants of + + + + @@ -105,11 +107,13 @@ - - - The root element must have a version attribute. - - + + + + The root element must have a version attribute. + + +