]> granicus.if.org Git - docbook-dsssl/commitdiff
Initial checkin
authorNorman Walsh <ndw@nwalsh.com>
Mon, 15 Sep 2003 21:34:19 +0000 (21:34 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 15 Sep 2003 21:34:19 +0000 (21:34 +0000)
14 files changed:
docbook/relaxng/.cvsignore [new file with mode: 0644]
docbook/relaxng/Makefile [new file with mode: 0644]
docbook/relaxng/src/callouts.rnc [new file with mode: 0644]
docbook/relaxng/src/calstbl.rnc [new file with mode: 0644]
docbook/relaxng/src/docbook.rnc [new file with mode: 0644]
docbook/relaxng/src/hier.rnc [new file with mode: 0644]
docbook/relaxng/src/htmltbl.rnc [new file with mode: 0644]
docbook/relaxng/src/mathml.rnc [new file with mode: 0644]
docbook/relaxng/src/msgset.rnc [new file with mode: 0644]
docbook/relaxng/src/pool.rnc [new file with mode: 0644]
docbook/relaxng/tools/cleanup.pl [new file with mode: 0644]
docbook/relaxng/tools/combine.xsl [new file with mode: 0644]
docbook/relaxng/tools/dtd-ok.xsl [new file with mode: 0644]
docbook/relaxng/tools/missing-defs.xsl [new file with mode: 0644]

diff --git a/docbook/relaxng/.cvsignore b/docbook/relaxng/.cvsignore
new file mode 100644 (file)
index 0000000..8907e79
--- /dev/null
@@ -0,0 +1,2 @@
+*.rng
+*.rnx
diff --git a/docbook/relaxng/Makefile b/docbook/relaxng/Makefile
new file mode 100644 (file)
index 0000000..08cc146
--- /dev/null
@@ -0,0 +1,29 @@
+VPATH=src
+
+COMBINE=tools/combine.xsl
+CLEANUP=tools/cleanup.pl
+TEMP1=/tmp/temp1.rng
+TEMP2=/tmp/temp2.rng
+
+MODULES=docbook.rnx pool.rnx hier.rnx \
+        calstbl.rnx htmltbl.rnx \
+        callouts.rnx msgset.rnx \
+        mathml.rnx
+
+.SUFFIXES: .rnc .rnx .rng
+
+all: docbook.rng
+
+docbook.rng: $(MODULES)
+       saxon $< $(COMBINE) $(TEMP1) modules="$(filter-out $<,$^)" use.extensions=1
+       perl $(CLEANUP) < $(TEMP1) > $@
+       -rm -f $(TEMP1)
+
+small.rng: docbook.rnx pool.rnx hier.rnx
+       saxon $< $(COMBINE) $(TEMP1) modules="$(filter-out $<,$^)" use.extensions=1
+       perl $(CLEANUP) < $(TEMP1) > $@
+       -rm -f $(TEMP1)
+
+.rnc.rnx:
+       trang -O rng $< $@
+
diff --git a/docbook/relaxng/src/callouts.rnc b/docbook/relaxng/src/callouts.rnc
new file mode 100644 (file)
index 0000000..a548ad3
--- /dev/null
@@ -0,0 +1,117 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+# ======================================================================
+
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+ctrl:choice-list [ name="publishing.inlines" choose="db.coref" ]
+ctrl:choice-list [ name="list.blocks" choose="db.calloutlist" ]
+ctrl:choice-list [ name="verbatim.blocks" choose="db.programlistingco" ]
+ctrl:choice-list [ name="verbatim.blocks" choose="db.screenco" ]
+ctrl:choice-list [ name="graphic.blocks" choose="db.mediaobjectco" ]
+ctrl:choice-list [ name="screenshot.block" choose="db.mediaobjectco" ]
+ctrl:choice-list [ name="computeroutput.inlines" choose="db.co" ]
+ctrl:choice-list [ name="verbatim.inlines" choose="db.co" ]
+ctrl:choice-list [ name="prompt.inlines" choose="db.co" ]
+ctrl:choice-list [ name="systemitem.inlines" choose="db.co" ]
+
+area.units.enumtype.attribute =
+   attribute units {
+      "calspair"
+    | "linecolumn"
+    | "linecolumnpair"
+    | "linerange"
+   }?
+
+area.units.othertype.attributes =
+   attribute units { "other" },
+   attribute otherunits { xsd:NMTOKEN }
+
+area.units.attribute =
+   (area.units.enumtype.attribute | area.units.othertype.attributes)
+
+
+calloutlist.info = db.info
+db.calloutlist = element calloutlist { calloutlist.info, blocks*, db.callout+ }
+
+callout.arearefs.attrib = attribute arearefs { xsd:IDREFS }
+db.callout = element callout { blocks+ }
+
+programlistingco.info = db.info
+db.programlistingco =
+   element programlistingco {
+      programlistingco.info,
+      db.areaspec,
+      db.programlisting,
+      db.calloutlist*
+   }
+
+areaspec.units.attrib = area.units.attribute
+db.areaspec = element areaspec { (db.area | db.areaset)+ }
+
+# FIXME: are the common linking attributes used on area?
+
+ctrl:common-attributes [ element="area" attributes="common.attrib.idreq" ]
+
+area.units.attrib = area.units.attribute
+area.linkends.attrib = linkends.attribute?
+area.label.attrib = attribute label { text }?
+area.coords.attrib = attribute coords { text }
+db.area = element area { empty }
+
+ctrl:common-attributes [ element="areaset" attributes="common.attrib.idreq" ]
+
+areaset.units.attrib = area.units.attribute
+areaset.label.attrib = attribute label { text }?
+db.areaset = element areaset { db.area+ }
+
+screenco.info = db.info
+db.screenco =
+   element screenco {
+      screenco.info,
+      db.areaspec,
+      db.screen,
+      db.calloutlist*
+   }
+
+mediaobjectco.info = db.info
+db.mediaobjectco =
+   element mediaobjectco {
+      mediaobjectco.info,
+      db.imageobjectco,
+      (db.imageobjectco | db.textobject)*
+   }
+
+imageobjectco.info = db.info
+db.imageobjectco =
+   element imageobjectco {
+      imageobjectco.info,
+      db.areaspec,
+      db.imageobject,
+      db.calloutlist*
+   }
+
+# FIXME: are the common linking attributes used on co?
+
+ctrl:common-attributes [ element="co" attributes="common.attrib.idreq" ]
+
+co.linkends.attrib = linkends.attribute?
+co.label.attrib = attribute label { text }?
+db.co = element co { empty }
+
+# FIXME: are the common linking attributes used on coref?
+
+coref.label.attrib = attribute label { text }?
+coref.linkend.attrib = linkend.attribute
+
+db.coref = element coref { empty }
+
diff --git a/docbook/relaxng/src/calstbl.rnc b/docbook/relaxng/src/calstbl.rnc
new file mode 100644 (file)
index 0000000..c7166eb
--- /dev/null
@@ -0,0 +1,125 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+# ======================================================================
+
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+char.attribute = attribute char { text }?
+charoff.attribute = attribute charoff { text }?
+colsep.attribute = attribute colsep { text }?
+rowsep.attribute = attribute rowsep { text }?
+align.attribute =
+  attribute align { "center" | "char" | "justify" | "left" | "right" }?
+valign.attribute = attribute valign { "bottom" | "middle" | "top" }?
+spanname.attribute = attribute spanname { text }?
+colname.attribute = attribute colname { text }?
+
+tgroup.char.attrib = char.attribute?
+tgroup.charoff.attrib = charoff.attribute?
+tgroup.tgroupstyle.attrib = attribute tgroupstyle { text }?
+tgroup.cols.attrib = attribute cols { xsd:integer }
+tgroup.colsep.attrib = colsep.attribute?
+tgroup.rowsep.attrib = rowsep.attribute?
+tgroup.align.attrib = align.attribute?
+db.tgroup =
+   element tgroup {
+      db.colspec*,
+      db.spanspec*,
+      cals.thead?,
+      cals.tfoot?,
+      cals.tbody
+   }
+
+colspec.colnum.attrib = attribute colnum { xsd:integer }?
+colspec.char.attrib = char.attribute?
+colspec.colsep.attrib = colsep.attribute?
+colspec.colwidth.attrib = attribute colwidth { text }?
+colspec.charoff.attrib = charoff.attribute?
+colspec.colname.attrib = colname.attribute?
+colspec.rowsep.attrib = rowsep.attribute?
+colspec.align.attrib = align.attribute?
+db.colspec = element colspec { empty }
+
+spanspec.namest.attrib = attribute namest { text }?
+spanspec.nameend.attrib = attribute nameend { text }?
+spanspec.spanname.attrib = spanname.attribute
+spanspec.char.attrib = char.attribute?
+spanspec.colsep.attrib = colsep.attribute?
+spanspec.charoff.attrib = charoff.attribute?
+spanspec.rowsep.attrib = rowsep.attribute?
+spanspec.align.attrib = align.attribute?
+db.spanspec = element spanspec { empty }
+
+cals.thead.valign.attrib = valign.attribute?
+cals.thead = element thead { db.colspec*, db.row+ }
+
+cals.tfoot.valign.attrib = valign.attribute?
+cals.tfoot = element tfoot { db.colspec*, db.row+ }
+
+cals.tbody.valign.attrib = valign.attribute?
+cals.tbody = element tbody { db.row+ }
+
+row.rowsep.attrib = rowsep.attribute?
+row.valign.attrib = valign.attribute?
+db.row = element row { (db.entry | db.entrytbl)+ }
+
+entry.nameend.attrib = attribute nameend { text }?
+entry.valign.attrib = valign.attribute?
+entry.char.attrib = char.attribute?
+entry.colsep.attrib = colsep.attribute?
+entry.charoff.attrib = charoff.attribute?
+entry.morerows.attrib = attribute morerows { xsd:integer }?
+entry.spanname.attrib = attribute spanname { text }?
+entry.namest.attrib = attribute namest { text }?
+entry.colname.attrib = colname.attribute?
+entry.rowsep.attrib = rowsep.attribute?
+entry.rotate.attrib = attribute rotate { text }?
+entry.align.attrib = align.attribute?
+db.entry = element entry { (inlines* | blocks*) }
+
+entrytbl.nameend.attrib = attribute nameend { text }?
+entrytbl.char.attrib = char.attribute?
+entrytbl.charoff.attrib = charoff.attribute?
+entrytbl.spanname.attrib = attribute spanname { text }?
+entrytbl.namest.attrib = attribute namest { text }?
+entrytbl.tgroupstyle.attrib = attribute tgroupstyle { text }?
+entrytbl.cols.attrib = attribute cols { xsd:integer }?
+entrytbl.colsep.attrib = colsep.attribute?
+entrytbl.rowsep.attrib = rowsep.attribute?
+entrytbl.colname.attrib = colname.attribute?
+entrytbl.align.attrib = align.attribute?
+db.entrytbl = element entrytbl { (db.colspec*, db.spanspec*, cals.thead?, cals.tbody) }
+
+cals.table.model = db.tgroup
+cals.table.tabstyle.attrib = attribute tabstyle { text }?
+cals.table.orient.attrib = attribute orient { "land" | "port" }?
+cals.table.colsep.attrib = colsep.attribute?
+cals.table.rowsep.attrib = rowsep.attribute?
+cals.table.frame.attrib =
+   attribute frame {
+      "all" | "bottom" | "none" | "sides" | "top" | "topbot"
+   }?
+
+cals.table.pgwide.attrib = attribute pgwide { "0" | "1" }
+
+cals.table.info = docbook.info.titlereq
+cals.table = element table { cals.table.info, cals.table.model }
+
+ctrl:choice-list [ name="table.choice" choose="cals.table" ]
+ctrl:choice-list [ name="table.contentmodel" choose="cals.table.model" ]
+
+informaltable.tabstyle.attrib |= cals.table.tabstyle.attrib
+informaltable.orient.attrib |= cals.table.orient.attrib
+informaltable.colsep.attrib |= cals.table.colsep.attrib
+informaltable.rowsep.attrib |= cals.table.rowsep.attrib
+informaltable.frame.attrib |= cals.table.frame.attrib
+informaltable.pgwide.attrib |= cals.table.pgwide.attrib
diff --git a/docbook/relaxng/src/docbook.rnc b/docbook/relaxng/src/docbook.rnc
new file mode 100644 (file)
index 0000000..b3ebf19
--- /dev/null
@@ -0,0 +1,25 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+# ======================================================================
+
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+start = db.set
+        | db.setindex
+        | db.book
+       | divisions
+       | components
+       | navigation.components
+       | db.refentry
+       | db.section
+       | db.para
+
diff --git a/docbook/relaxng/src/hier.rnc b/docbook/relaxng/src/hier.rnc
new file mode 100644 (file)
index 0000000..417a246
--- /dev/null
@@ -0,0 +1,247 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+# ======================================================================
+
+status.attribute = attribute status { text }
+
+# ======================================================================
+
+divisions = db.part | db.reference
+
+components =
+   db.dedication
+ | db.preface
+ | db.chapter
+ | db.appendix
+ | db.article
+ | db.colophon
+
+navigation.components =
+   db.toc | db.index | db.glossary | db.bibliography
+
+component.contentmodel =
+  navigation.components*, blocks.or.sections, navigation.components*
+
+# ======================================================================
+
+set.status.attrib = status.attribute?
+set.info = docbook.info.titlereq
+db.set = element set { set.info, db.toc*, db.book+, db.setindex }
+
+book.status.attrib = status.attribute?
+book.info = docbook.info.titlereq
+db.book =
+   element book { book.info, (navigation.components | components | divisions)+ }
+
+dedication.status.attrib = status.attribute?
+dedication.info = docbook.info
+db.dedication =
+  element dedication { dedication.info, component.contentmodel }
+
+colophon.status.attrib = status.attribute?
+colophon.info = docbook.info
+db.colophon =
+   element colophon { colophon.info, component.contentmodel }
+
+toc.pagenum.attrib = pagenum.attribute?
+toc.linkend.attrib = linkend.attribute?
+
+toc.info = docbook.info
+db.toc = element toc { toc.info, blocks*, (db.tocdiv | db.tocentry)* }
+
+tocdiv.pagenum.attrib = pagenum.attribute?
+tocdiv.linkend.attrib = linkend.attribute?
+
+tocdiv.info = docbook.info
+db.tocdiv = element tocdiv { tocdiv.info, blocks*, (db.tocdiv | db.tocentry)+ }
+
+tocentry.pagenum.attrib = pagenum.attribute?
+tocentry.linkend.attrib = linkend.attribute?
+db.tocentry = element tocentry { inlines* }
+
+appendix.status.attrib = status.attribute?
+appendix.info = docbook.info.titlereq
+db.appendix =
+   element appendix { appendix.info, component.contentmodel }
+
+chapter.status.attrib = status.attribute?
+chapter.info = docbook.info.titlereq
+db.chapter =
+   element chapter { chapter.info, component.contentmodel }
+
+part.status.attrib = status.attribute?
+part.info = docbook.info.titlereq
+db.part =
+   element part {
+      part.info,
+      db.partintro?,
+      (navigation.components | components | db.refentry | db.reference)+
+   }
+
+preface.status.attrib = status.attribute?
+preface.info = docbook.info
+db.preface =
+   element preface { preface.info, component.contentmodel }
+
+reference.status.attrib = status.attribute?
+reference.info = docbook.info.titlereq
+db.reference =
+   element reference { reference.info, db.partintro?, db.refentry+ }
+
+partintro.info = docbook.info
+db.partintro =
+   element partintro { partintro.info, blocks.or.sections }
+
+sections.optional = db.section* | db.simplesect*
+
+sections.required = db.section+ | db.simplesect*
+
+blocks.or.sections =
+  (blocks+, sections.optional) | sections.required
+
+section.status.attrib = status.attribute?
+section.info = docbook.info.titlereq
+db.section =
+  element section { section.info, blocks.or.sections }
+
+simplesect.status.attrib = status.attribute?
+simplesect.info = docbook.info.titlereq
+db.simplesect =
+  element simplesect { simplesect.info, blocks+ }
+
+bibliography.status.attrib = status.attribute?
+bibliography.info = docbook.info
+db.bibliography =
+   element bibliography {
+      bibliography.info,
+      blocks*,
+      (db.bibliodiv+ | (db.biblioentry | db.bibliomixed)+)
+   }
+
+bibliodiv.status.attrib = status.attribute?
+bibliodiv.info = docbook.info.titlereq
+db.bibliodiv =
+   element bibliodiv {
+      bibliodiv.info,
+      blocks*,
+      (db.biblioentry | db.bibliomixed)+
+   }
+
+glossary.status.attrib = status.attribute?
+glossary.info = docbook.info
+db.glossary =
+   element glossary { glossary.info, blocks*, (db.glossdiv+ | db.glossentry+) }
+
+glossdiv.status.attrib = status.attribute?
+glossdiv.info = docbook.info
+db.glossdiv =
+   element glossdiv { glossdiv.info, blocks*, db.glossentry+ }
+
+index.info = docbook.info
+db.index =
+   element index { index.info, blocks*, (db.indexdiv* | db.indexentry*) }
+
+setindex.info = docbook.info
+db.setindex =
+   element setindex { setindex.info, blocks*, (db.indexdiv* | db.indexentry*) }
+
+indexdiv.info = docbook.info.titlereq
+db.indexdiv =
+   element indexdiv { indexdiv.info, blocks*, db.indexentry+ }
+
+db.indexentry =
+   element indexentry {
+      db.primaryie,
+      (db.seeie | db.seealsoie)*,
+      (db.secondaryie, (db.seeie | db.seealsoie | db.tertiaryie)*)*
+   }
+
+primaryie.linkends.attrib = linkends.attribute?
+db.primaryie = element primaryie { inlines* }
+
+secondaryie.linkends.attrib = linkends.attribute?
+db.secondaryie = element secondaryie { inlines* }
+
+tertiaryie.linkends.attrib = linkends.attribute?
+db.tertiaryie = element tertiaryie { inlines* }
+
+seeie.linkend.attrib = linkend.attribute?
+db.seeie = element seeie { inlines* }
+
+seealsoie.linkends.attrib = linkends.attribute?
+db.seealsoie = element seealsoie { inlines* }
+
+refsections.optional = db.refsection* | db.simplesect*
+
+refsections.required = db.refsection+ | db.simplesect*
+
+blocks.or.refsections =
+  (blocks+, refsections.optional) | refsections.required
+
+refentry.status.attrib = status.attribute?
+refentry.info = docbook.info.titleforbidden
+db.refentry =
+   element refentry {
+      refentry.info,
+      db.refmeta?,
+      db.refnamediv,
+      db.refsynopsisdiv?,
+      db.refsection+
+   }
+
+db.refmeta =
+   element refmeta { db.refentrytitle, db.manvolnum, db.refmiscinfo* }
+
+db.refmiscinfo = element refmiscinfo { docbook.text }
+
+db.refnamediv =
+   element refnamediv { db.refdescriptor?, db.refname+, db.refpurpose, db.refclass* }
+
+db.refdescriptor = element refdescriptor { inlines* }
+
+db.refname = element refname { inlines* }
+
+db.refpurpose = element refpurpose { inlines* }
+
+db.refclass = element refclass { docbook.text }
+
+refsynopsisdiv.info = docbook.info
+db.refsynopsisdiv =
+   element refsynopsisdiv { refsynopsisdiv.info, blocks.or.refsections }
+
+refsection.status.attrib = status.attribute?
+refsection.info = docbook.info.titlereq
+db.refsection =
+  element refsection { refsection.info, blocks.or.refsections }
+
+article.status.attrib = status.attribute?
+article.class.attrib =
+   attribute class {
+      "faq"
+    | "journalarticle"
+    | "productsheet"
+    | "specification"
+    | "techreport"
+    | "whitepaper"
+   }?
+
+article.info = docbook.info.titlereq
+db.article =
+   element article {
+      article.info,
+      navigation.components*,
+      blocks.or.sections,
+      db.appendix*,
+      navigation.components*
+   }
+
+
diff --git a/docbook/relaxng/src/htmltbl.rnc b/docbook/relaxng/src/htmltbl.rnc
new file mode 100644 (file)
index 0000000..f31cc3a
--- /dev/null
@@ -0,0 +1,133 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+html.table.model =
+   (html.col* | html.colgroup*),
+   html.thead?,
+   html.tfoot?,
+   (html.tbody+ | html.tr+)
+
+html.table.html.attrib = html.attrs
+html.table.summary.attrib = attribute summary { text }?
+html.table.width.attrib = attribute width { text }?
+html.table.border.attrib = attribute border { text }?
+html.table.frame.attrib =
+   attribute frame {
+      "void"
+    | "above"
+    | "below"
+    | "hsides"
+    | "lhs"
+    | "rhs"
+    | "vsides"
+    | "box"
+    | "border"
+   }?
+html.table.rules.attrib =
+   attribute rules { "none" | "groups" | "rows" | "cols" | "all" }?
+html.table.cellspacing.attrib = attribute cellspacing { text }?
+html.table.cellpadding.attrib = attribute cellpadding { text }?
+html.table = element table { html.table.model }
+
+html.coreattrs &=
+  attribute class { text }?,
+  attribute style { text }?,
+  attribute title { text }?
+
+html.i18n &=
+  attribute lang { text }?,
+  attribute dir { "ltr" | "rtl" }?
+
+html.events &=
+  attribute onclick { text }?,
+  attribute ondblclick { text }?,
+  attribute onmousedown { text }?,
+  attribute onmouseup { text }?,
+  attribute onmouseover { text }?,
+  attribute onmousemove { text }?,
+  attribute onmouseout { text }?,
+  attribute onkeypress { text }?,
+  attribute onkeydown { text }?,
+  attribute onkeyup { text }?
+
+html.attrs &= html.coreattrs, html.i18n, html.events
+
+html.cellhalign &=
+  attribute align { "left" | "center" | "right" | "justify" | "char" }?,
+  attribute char { text }?,
+  attribute charoff { text }?
+
+html.cellvalign &=
+  attribute valign { "top" | "middle" | "bottom" | "baseline" }?
+
+html.col.html.attrib = html.attrs
+html.col.span.attrib = attribute span { text }?
+html.col.width.attrib = attribute width { text }?
+html.col.cellhalign.attrib = html.cellhalign
+html.col.cellvalign.attrib = html.cellvalign
+html.col = element col { empty }
+
+html.colgroup.html.attrib = html.attrs
+html.colgroup.span.attrib = attribute span { text }?
+html.colgroup.width.attrib = attribute width { text }?
+html.colgroup.cellhalign.attrib = html.cellhalign
+html.colgroup.cellvalign.attrib = html.cellvalign
+html.colgroup = element colgroup { html.col+ }
+
+html.thead.html.attrib = html.attrs
+html.thead.cellhalign.attrib = html.cellhalign
+html.thead.cellvalign.attrib = html.cellvalign
+html.thead = element thead { html.tr+ }
+
+html.tfoot.html.attrib = html.attrs
+html.tfoot.cellhalign.attrib = html.cellhalign
+html.tfoot.cellvalign.attrib = html.cellvalign
+html.tfoot = element tfoot { html.tr+ }
+
+html.tbody.html.attrib = html.attrs
+html.tbody.cellhalign.attrib = html.cellhalign
+html.tbody.cellvalign.attrib = html.cellvalign
+html.tbody = element tbody { html.tr+ }
+
+html.tr.html.attrib = html.attrs
+html.tr.cellhalign.attrib = html.cellhalign
+html.tr.cellvalign.attrib = html.cellvalign
+html.tr = element tr { (html.th | html.td)+ }
+
+html.th.html.attrib = html.attrs
+html.th.abbr.attrib = attribute abbr { text }?
+html.th.axis.attrib = attribute axis { text }?
+html.th.headers.attrib = attribute headers { text }?
+html.th.scope.attrib = attribute scope { text }?
+html.th.rowspan.attrib = attribute rowspan { text }?
+html.th.colspan.attrib = attribute colspan { text }?
+html.th.cellhalign.attrib = html.cellhalign
+html.th.cellvalign.attrib = html.cellvalign
+html.th = element th { (inlines* | blocks*) }
+
+html.td.html.attrib = html.attrs
+html.td.abbr.attrib = attribute abbr { text }?
+html.td.axis.attrib = attribute axis { text }?
+html.td.headers.attrib = attribute headers { text }?
+html.td.scope.attrib = attribute scope { text }?
+html.td.rowspan.attrib = attribute rowspan { text }?
+html.td.colspan.attrib = attribute colspan { text }?
+html.td.cellhalign.attrib = html.cellhalign
+html.td.cellvalign.attrib = html.cellvalign
+html.td = element td { (inlines* | blocks*) }
+
+ctrl:choice-list [ name="table.choice" choose="html.table" ]
+ctrl:choice-list [ name="table.contentmodel" choose="html.table.model" ]
+
+informaltable.frame.attrib |= html.table.frame.attrib
diff --git a/docbook/relaxng/src/mathml.rnc b/docbook/relaxng/src/mathml.rnc
new file mode 100644 (file)
index 0000000..f242f20
--- /dev/null
@@ -0,0 +1,26 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+
+namespace mml = "http://www.w3.org/1998/Math/MathML"
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+any.mml =
+   element mml:*
+   {
+      (attribute * { text }
+       | text
+       | any.mml)*
+   }
+
+
+ctrl:choice-list [ name="equation.content" choose="any.mml" ]
+ctrl:choice-list [ name="inlineequation.content" choose="any.mml" ]
diff --git a/docbook/relaxng/src/msgset.rnc b/docbook/relaxng/src/msgset.rnc
new file mode 100644 (file)
index 0000000..47a406a
--- /dev/null
@@ -0,0 +1,43 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+msgset.info = docbook.info
+
+db.msgset = element msgset { msgset.info, (db.msgentry+|db.simplemsgentry+) }
+
+db.msgentry = element msgentry { db.msg+, db.msginfo, db.msgexplan* }
+
+db.simplemsgentry = element simplemsgentry { db.msgtext, db.msgexplan+ }
+
+db.msg = element msg { db.title?, db.msgmain, (db.msgsub|db.msgrel)* }
+
+db.msgmain = element msgmain { db.title?, db.msgtext }
+
+db.msgsub = element msgsub { db.title?, db.msgtext }
+
+db.msgrel = element msgrel { db.title?, db.msgtext }
+
+db.msgtext = element msgtext { blocks+ }
+
+db.msginfo = element msginfo { (db.msglevel|db.msgorig|db.msgaud)* }
+
+db.msglevel = element msglevel { ubiq.inlines* }
+
+db.msgorig = element msgorig { ubiq.inlines* }
+
+db.msgaud = element msgaud { ubiq.inlines* }
+
+db.msgexplan = element msgexplan { db.title?, blocks+ }
+
+ctrl:choice-list [ name="technical.blocks" choose="db.msgset" ]
diff --git a/docbook/relaxng/src/pool.rnc b/docbook/relaxng/src/pool.rnc
new file mode 100644 (file)
index 0000000..bc6cd87
--- /dev/null
@@ -0,0 +1,1359 @@
+# (Part of) A prototype DocBook V.next RELAX NG grammar.
+
+# This schema is a "work-in-progress". It validates a DocBook-like grammar that
+# may, in some incarnation, form the basis for DocBook V.next. Or it may not.
+# At the moment, it's just an exploration by Norm. It has utterly no normative
+# value at all.
+#
+# Author: Norman Walsh, <ndw@nwalsh.com>
+# Source: Derived from DocBook XML V4.1 and V4.2
+# Release: $Id$
+#
+
+namespace ctrl = "http://nwalsh.com/xmlns/schema-control/"
+
+# ======================================================================
+
+id.attribute        = attribute id { xsd:ID }
+
+xml.lang.attribute  = attribute xml:lang { text }
+
+xml.base.attribute  = attribute xml:base { text }
+
+remap.attribute     = attribute remap { text }
+
+xreflabel.attribute = attribute xreflabel { text }
+
+revisionflag.attribute =
+  attribute revisionflag { "changed" | "added" | "deleted" | "off" }
+
+effectivity.attributes =
+  arch.attribute,
+  condition.attribute,
+  conformance.attribute,
+  os.attribute,
+  revision.attribute,
+  security.attribute,
+  userlevel.attribute,
+  vendor.attribute
+
+arch.attribute        = attribute arch        { text }
+condition.attribute   = attribute condition   { text }
+conformance.attribute = attribute conformance { text }
+os.attribute          = attribute os          { text }
+revision.attribute    = attribute revision    { text }
+security.attribute    = attribute security    { text }
+userlevel.attribute   = attribute userlevel   { text }
+vendor.attribute      = attribute vendor      { text }
+
+# ======================================================================
+
+linkend.attribute  = attribute linkend { xsd:IDREF }
+
+linkends.attribute = attribute linkends { xsd:IDREFS }
+
+href.attribute = attribute href { text }
+
+# ======================================================================
+
+common.attributes =
+  id.attribute?,
+  xml.lang.attribute?,
+  xml.base.attribute?,
+  remap.attribute?,
+  xreflabel.attribute?,
+  revisionflag.attribute?,
+  effectivity.attributes?
+
+common.attrib.idreq =
+  id.attribute,
+  xml.lang.attribute?,
+  xml.base.attribute?,
+  remap.attribute?,
+  xreflabel.attribute?,
+  revisionflag.attribute?,
+  effectivity.attributes?
+
+common.linking.attributes.req =
+   linkend.attribute | href.attribute
+
+common.linking.attributes =
+   (linkend.attribute | href.attribute)?
+
+# ======================================================================
+
+relation.attribute = attribute relation { text }?
+
+linenumbering.attribute = attribute linenumbering { "numbered" | "unnumbered" }?
+
+float.attribute = attribute float { text }
+pgwide.attribute = attribute pgwide { "0" | "1" }
+
+data.format.attribute = attribute format { text }?
+data.fileref.attribute = attribute fileref { text }?
+data.entityref.attribute = attribute entityref { xsd:ENTITY }?
+data.common.attribute &=
+   data.format.attribute,
+   data.fileref.attribute,
+   data.entityref.attribute
+
+oo-language.attribute = attribute language { text }?
+
+ctrl:other-attribute [ name="biblio"
+                       attribute-name="class"
+                       attribute-values="doi isbn issn libraryofcongress pubnumber uri"
+                       other-attribute-name="otherclass"
+                       other-attribute-value="other" ]
+
+significance.attribute = attribute significance { "normal" | "preferred" }
+zone.attribute = attribute zone { xsd:IDREFS }
+pagenum.attribute = attribute pagenum { text }
+scope.attribute = attribute scope { "all" | "global" | "local" }
+
+# ======================================================================
+
+ubiq.inlines     = db.inlinemediaobject | db.anchor | db.indexterm | db.remark
+
+text.replaceable = element replaceable { docbook.text }
+text.phrase      = element phrase      { docbook.text }
+
+docbook.text     = (text | ubiq.inlines | text.phrase | text.replaceable)*
+
+# ======================================================================
+
+inlines = text | ubiq.inlines | general.inlines | domain.inlines
+
+general.inlines =
+   publishing.inlines
+ | product.inlines
+ | bibliography.inlines
+ | glossary.inlines
+ | graphic.inlines
+ | indexing.inlines
+ | link.inlines
+
+domain.inlines =
+   technical.inlines
+ | error.inlines
+ | os.inlines
+ | programming.inlines
+ | markup.inlines
+ | math.inlines
+ | gui.inlines
+ | keyboard.inlines
+
+technical.inlines =
+  db.replaceable | db.systemitem | db.option | db.optional
+
+error.inlines =
+  db.errorcode | db.errortext | db.errorname | db.errortype
+
+oo.inlines = db.ooclass | db.ooexception | db.oointerface
+
+programming.inlines =
+   db.function
+ | db.parameter
+ | db.varname
+ | db.returnvalue
+ | db.type
+ | db.classname
+ | db.exceptionname
+ | db.interfacename
+ | db.methodname
+ | db.modifier
+ | db.initializer
+ | oo.inlines
+
+product.inlines =
+   db.productnumber
+ | db.productname
+ | db.database
+ | db.application
+ | db.hardware
+ | db.trademark
+
+os.inlines =
+   db.prompt
+ | db.envar
+ | db.filename
+ | db.command
+ | db.computeroutput
+ | db.userinput
+
+markup.inlines =
+   db.xmltag
+ | db.markup
+ | db.token
+ | db.symbol
+ | db.literal
+ | db.constant
+
+bibliography.inlines =
+   db.citation
+ | db.citerefentry
+ | db.citetitle
+ | db.citebiblioid
+ | db.author
+ | db.personname
+ | db.editor
+
+glossary.inlines =
+   db.firstterm
+ | db.glossterm
+
+ctrl:choice-list [ name="publishing.inlines" choose="db.abbrev" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.acronym" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.emphasis" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.footnote" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.footnoteref" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.foreignphrase" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.phrase" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.quote" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.subscript" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.superscript" ]
+ctrl:choice-list [ name="publishing.inlines" choose="db.wordasword" ]
+
+math.inlines = db.inlineequation
+
+graphic.inlines = db.inlinemediaobject
+
+indexing.inlines = db.indexterm
+
+gui.inlines =
+   db.guiicon
+ | db.guibutton
+ | db.guimenuitem
+ | db.guimenu
+ | db.guisubmenu
+ | db.guilabel
+ | db.menuchoice
+ | db.mousebutton
+
+keyboard.inlines =
+   db.keycombo
+ | db.keycap
+ | db.keycode
+ | db.keysym
+ | db.shortcut
+ | db.accel
+
+link.inlines =
+   db.xref
+ | db.anchor
+
+# ======================================================================
+
+blocks =
+   list.blocks
+ | admonition.blocks
+ | para.blocks
+ | formal.blocks
+ | informal.blocks
+ | publishing.blocks
+ | graphic.blocks
+ | technical.blocks
+ | verbatim.blocks
+ | synopsis.blocks
+ | db.indexterm
+ | db.bridgehead
+ | db.remark
+
+formal.blocks =
+   db.equation
+ | db.example
+ | db.figure
+ | db.table
+
+informal.blocks =
+   db.informalequation
+ | db.informalexample
+ | db.informalfigure
+ | db.informaltable
+
+publishing.blocks =
+   db.sidebar
+ | db.blockquote
+ | db.address
+ | db.epigraph
+
+ctrl:choice-list [ name="graphic.blocks" choose="db.mediaobject" ]
+ctrl:choice-list [ name="graphic.blocks" choose="db.screenshot" ]
+
+ctrl:choice-list [ name="technical.blocks" choose="db.procedure" ]
+
+admonition.blocks =
+   db.caution
+ | db.important
+ | db.note
+ | db.tip
+ | db.warning
+
+ctrl:choice-list [ name="list.blocks" choose="db.itemizedlist" ]
+ctrl:choice-list [ name="list.blocks" choose="db.orderedlist" ]
+ctrl:choice-list [ name="list.blocks" choose="db.procedure" ]
+ctrl:choice-list [ name="list.blocks" choose="db.simplelist" ]
+ctrl:choice-list [ name="list.blocks" choose="db.variablelist" ]
+
+ctrl:choice-list [ name="verbatim.blocks" choose="db.programlisting" ]
+ctrl:choice-list [ name="verbatim.blocks" choose="db.screen" ]
+ctrl:choice-list [ name="verbatim.blocks" choose="db.literallayout" ]
+ctrl:choice-list [ name="verbatim.blocks" choose="db.synopsis" ]
+
+synopsis.blocks =
+   db.cmdsynopsis
+ | db.funcsynopsis
+ | db.classsynopsis
+ | db.methodsynopsis
+ | db.constructorsynopsis
+ | db.destructorsynopsis
+ | db.fieldsynopsis
+
+# ======================================================================
+
+db.title = element title { inlines* }
+
+db.titleabbrev = element titleabbrev { inlines* }
+
+db.subtitle = element subtitle { inlines* }
+
+docbook.title = db.title? & db.titleabbrev? & db.subtitle?
+docbook.titlereq = db.title & db.titleabbrev? & db.subtitle?
+
+info.elements =
+  db.biblioid
+  | db.artpagenums
+  | db.copyright
+  | db.subjectset
+  | db.keywordset
+  | db.subjectset
+  | db.keywordset
+  | db.itermset
+  | db.abstract
+  | db.authorgroup
+  | db.author
+  | db.editor
+  | db.othercredit
+  | db.bibliocoverage
+  | db.bibliomisc
+  | db.bibliomset
+  | db.bibliorelation
+  | db.biblioset
+  | db.collab
+  | db.confgroup
+  | db.date
+  | db.pubdate
+  | db.edition
+  | db.volumenum
+  | db.seriesvolnums
+  | db.pagenums
+  | db.legalnotice
+  | db.publisher
+  | db.releaseinfo
+  | db.revhistory
+  | db.printhistory
+
+bibliographic.elements =
+   info.elements
+ | db.abbrev
+ | db.title
+ | db.titleabbrev
+ | db.subtitle
+ | db.citetitle
+ | db.address
+ | db.affiliation
+ | db.personblurb
+ | db.authorinitials
+ | db.personname
+ | db.orgname
+ | db.productname
+ | db.productnumber
+ | db.publishername
+
+db.biblioentry = element biblioentry { bibliographic.elements+ }
+
+db.bibliomixed = element bibliomixed { (text | bibliographic.elements)* }
+
+db.info = element info { docbook.title, info.elements* }
+db.info.titlereq = element info { docbook.titlereq, info.elements* }
+db.info.titleforbidden = element info { info.elements* }
+
+docbook.info = (docbook.titlereq?, db.info.titleforbidden?) | db.info?
+docbook.info.titlereq = (docbook.titlereq, db.info.titleforbidden?) | db.info.titlereq
+docbook.info.titleforbidden = db.info.titleforbidden?
+
+biblioset.relation.attrib = relation.attribute
+db.biblioset = element biblioset { bibliographic.elements+ }
+
+bibliomset.relation.attrib = relation.attribute
+db.bibliomset = element bibliomset { (docbook.text | bibliographic.elements)* }
+
+db.bibliomisc = element bibliomisc { docbook.text }
+
+subjectset.scheme.attrib = attribute scheme { text }?
+db.subjectset = element subjectset { db.subject+ }
+
+subject.weight.attrib = attribute weight { text }?
+db.subject = element subject { db.subjectterm+ }
+
+db.subjectterm = element subjectterm { docbook.text }
+
+db.keywordset = element keywordset { db.keyword+ }
+
+db.keyword = element keyword { docbook.text }
+
+db.itermset = element itermset { db.indexterm+ }
+
+task.info = docbook.info.titlereq
+
+db.task = element task { task.info,
+                         db.tasksummary?,
+                        db.taskprerequisites?,
+                        db.procedure,
+                        db.example*,
+                        db.taskrelated? }
+
+tasksummary.info = docbook.info
+
+db.tasksummary = element tasksummary { tasksummary.info, blocks+ }
+
+taskprerequisites.info = docbook.info
+
+db.taskprerequisites = element taskprerequisites { taskprerequisites.info, blocks+ }
+
+taskrelated.info = docbook.info
+
+db.taskrelated = element taskrelated { taskrelated.info, blocks+ }
+
+qandaset.defaultlabel.attrib = attribute defaultlabel { "none" | "number" | "qanda" }?
+qandaset.info = docbook.info
+db.qandaset =
+   element qandaset { qandaset.info, blocks*, (db.qandadiv | db.qandaentry)+ }
+
+qandadiv.info = docbook.info
+db.qandadiv =
+   element qandadiv { qandadiv.info, blocks*, (db.qandadiv | db.qandaentry)+ }
+
+qandaentry.info = docbook.info
+db.qandaentry =
+   element qandaentry { qandaentry.info, db.question, db.answer* }
+
+db.question = element question { db.label?, blocks+ }
+
+db.answer = element answer { db.label?, blocks+ }
+
+db.label = element label { docbook.text }
+
+ctrl:choice-list [ name="table.choice" choose="#notAllowed" ]
+ctrl:choice-list [ name="table.contentmodel" choose="#notAllowed" ]
+
+db.table = table.choice
+
+informaltable.tabstyle.attrib = notAllowed?
+informaltable.orient.attrib = notAllowed?
+informaltable.colsep.attrib = notAllowed?
+informaltable.rowsep.attrib = notAllowed?
+informaltable.frame.attrib = notAllowed?
+informaltable.pgwide.attrib = notAllowed?
+
+informaltable.info = db.info.titleforbidden
+db.informaltable = element informaltable { informaltable.info?, table.contentmodel }
+
+procedure.info = docbook.info
+db.procedure = element procedure { procedure.info, blocks*, db.step+ }
+
+step.performance.attrib = attribute performance { "optional" | "required" }?
+
+step.info = docbook.info
+db.step = element step { step.info, blocks*, db.substeps?, blocks* }
+
+substeps.performance.attrib = attribute performance { "optional" | "required" }?
+
+db.substeps = element substeps { db.step+ }
+
+sidebar.info = docbook.info
+
+db.sidebar = element sidebar { sidebar.info, blocks+ }
+
+abstract.info = docbook.info
+db.abstract = element abstract { abstract.info, para.blocks+ }
+
+personblurb.info = docbook.info
+db.personblurb = element personblurb { personblurb.info, para.blocks+ }
+
+blockquote.info = docbook.info
+db.blockquote = element blockquote { blockquote.info, db.attribution?, blocks+ }
+
+db.attribution = element attribution { (docbook.text | db.personname) }
+
+db.bridgehead = element bridgehead { inlines* }
+
+db.remark = element remark { docbook.text }
+
+epigraph.info = docbook.info
+
+db.epigraph =
+   element epigraph {
+      epigraph.info,
+      db.attribution?,
+      (para.blocks | db.literallayout)+
+   }
+
+db.footnote = element footnote { blocks* }
+
+db.highlights = element highlights { blocks* }
+
+para.blocks =
+   db.para
+ | db.formalpara
+ | db.simpara
+
+formalpara.info = docbook.info.titlereq
+db.formalpara = element formalpara { formalpara.info, db.para }
+
+para.info = docbook.info.titleforbidden
+db.para = element para { para.info, (inlines | blocks)* }
+
+simpara.info = docbook.info.titleforbidden
+db.simpara = element simpara { simpara.info, inlines* }
+
+# admonitions are not excluded from themselves
+admonition.contentmodel = docbook.info, blocks+
+
+db.caution = element caution { admonition.contentmodel }
+
+db.important = element important { admonition.contentmodel }
+
+db.note = element note { admonition.contentmodel }
+
+db.tip = element tip { admonition.contentmodel }
+
+db.warning = element warning { admonition.contentmodel }
+
+db.glosslist = element glosslist { db.glossentry+ }
+
+glossentry.sortas.attrib = sortas.attribute?
+db.glossentry =
+   element glossentry {
+      db.glossterm,
+      db.acronym?,
+      db.abbrev?,
+      (db.glosssee | db.glossdef+)
+   }
+
+glossdef.subject.attrib = attribute subject { text }?
+db.glossdef = element glossdef { blocks+, db.glossseealso* }
+
+glosssee.otherterm.attrib = attribute otherterm { xsd:IDREF }?
+db.glosssee = element glosssee { inlines* }
+
+glossseealso.otherterm.attrib = attribute otherterm { xsd:IDREF }?
+db.glossseealso = element glossseealso { inlines* }
+
+itemizedlist.mark.attrib = attribute mark { text }?
+itemizedlist.spacing.attrib = attribute spacing { "compact" | "normal" }?
+
+itemizedlist.info = docbook.info
+db.itemizedlist = element itemizedlist { itemizedlist.info, blocks*, db.listitem+ }
+
+orderedlist.inheritnum.attrib = attribute inheritnum { "ignore" | "inherit" }?
+orderedlist.spacing.attrib = attribute spacing { "compact" | "normal" }?
+orderedlist.continuation.attrib = attribute continuation { "continues" | "restarts" }?
+orderedlist.numeration.attrib = attribute numeration { text }?
+
+orderedlist.info = docbook.info
+db.orderedlist = element orderedlist { orderedlist.info, blocks*, db.listitem+ }
+
+listitem.override.attrib = attribute override { text }?
+db.listitem = element listitem { blocks+ }
+
+segmentedlist.info = docbook.info
+db.segmentedlist = element segmentedlist { segmentedlist.info,
+                                           db.segtitle+,
+                                           db.seglistitem+ }
+
+db.segtitle = element segtitle { inlines* }
+
+db.seglistitem = element seglistitem { db.seg+ }
+
+db.seg = element seg { (inlines | blocks)* }
+
+simplelist.type.attrib = attribute type { "horiz" | "inline" | "vert" }?
+
+db.simplelist = element simplelist { db.member+ }
+
+db.member = element member { inlines* }
+
+variablelist.termlength.attrib = attribute termlength { text }?
+variablelist.info = db.info
+
+db.variablelist = element variablelist { variablelist.info, blocks*, db.varlistentry+ }
+
+db.varlistentry = element varlistentry { db.term+, db.listitem }
+
+db.term = element term { inlines* }
+
+example.info = db.info.titlereq
+db.example = element example { example.info, blocks+ }
+
+informalexample.info = db.info.titleforbidden
+db.informalexample = element informalexample { informalexample.info, blocks+ }
+
+ctrl:choice-list [ name="verbatim.inlines" choose="inlines" ]
+ctrl:choice-list [ name="verbatim.inlines" choose="db.lineannotation" ]
+
+verbatim.contentmodel = docbook.info.titleforbidden, verbatim.inlines*
+
+programlisting.linenumbering.attrib = linenumbering.attribute
+db.programlisting = element programlisting { verbatim.contentmodel }
+
+literallayout.linenumbering.attrib = linenumbering.attribute
+literallayout.class.attrib = attribute class { "monospaced" | "normal" }
+db.literallayout = element literallayout { verbatim.contentmodel }
+
+screen.linenumbering.attrib = linenumbering.attribute
+db.screen = element screen { verbatim.contentmodel }
+
+
+ctrl:choice-list [ name="screenshot.block" choose="db.mediaobject" ]
+
+screenshot.info = docbook.info
+db.screenshot =
+   element screenshot { screenshot.info, screenshot.block }
+
+figure.float.attrib = float.attribute?
+figure.pgwide.attrib = pgwide.attribute?
+figure.info = db.info.titlereq
+db.figure = element figure { figure.info, blocks+ }
+
+informalfigure.float.attrib = float.attribute?
+informalfigure.pgwide.attrib = pgwide.attribute?
+informalfigure.info = db.info.titleforbidden
+db.informalfigure = element informalfigure { informalfigure.info, blocks+ }
+
+mediaobject.info = db.info
+db.mediaobject =
+   element mediaobject {
+      mediaobject.info,
+      (db.videoobject | db.audioobject | db.imageobject | db.textobject)+
+   }
+
+inlinemediaobject.info = db.info
+db.inlinemediaobject =
+   element inlinemediaobject {
+      inlinemediaobject.info,
+      (db.videoobject | db.audioobject | db.imageobject | db.textobject)+
+   }
+
+videoobject.info = db.info
+db.videoobject = element videoobject { videoobject.info, db.videodata }
+
+audioobject.info = db.info
+db.audioobject = element audioobject { audioobject.info, db.audiodata }
+
+imageobject.info = db.info
+db.imageobject = element imageobject { imageobject.info, db.imagedata }
+
+textobject.info = db.info
+db.textobject =
+   element textobject { textobject.info, (db.phrase | db.textdata | blocks+) }
+
+videodata.data.attrib = data.common.attribute
+db.videodata = element videodata { db.info.titleforbidden? }
+
+audiodata.data.attrib = data.common.attribute
+db.audiodata = element audiodata { db.info.titleforbidden? }
+
+imagedata.data.attrib = data.common.attribute
+imagedata.align.attrib =
+  attribute align { "center" | "char" | "justify" | "left" | "right" }?
+imagedata.valign.attrib = attribute valign { "bottom" | "middle" | "top" }?
+imagedata.width.attrib = attribute width { text }?
+imagedata.contentwidth.attrib = attribute contentwidth { text }?
+imagedata.scalefit.attrib = attribute scalefit { "0" | "1" }?
+imagedata.depth.attrib = attribute depth { text }?
+imagedata.contentdepth.attrib = attribute contentdepth { text }?
+
+db.imagedata = element imagedata { db.info.titleforbidden? }
+
+textdata.data.attrib = data.common.attribute
+textdata.encoding.attrib = attribute encoding { text }?
+
+db.textdata = element textdata { db.info.titleforbidden? }
+
+db.caption = element caption { inlines* | blocks+ }
+
+ctrl:choice-list [ name="equation.content" choose="db.mediaobject" ]
+
+equation.info = docbook.info.titlereq
+db.equation = element equation { equation.info, equation.content+ }
+
+informalequation.info = db.info.titleforbidden
+
+db.informalequation =
+   element informalequation {
+      informalequation.info,
+      equation.content+
+   }
+
+ctrl:choice-list [ name="inlineequation.content" choose="db.inlinemediaobject" ]
+
+db.inlineequation = element inlineequation { inlineequation.content+ }
+
+db.alt = element alt { text }
+
+synopsis.linenumbering.attrib = linenumbering.attribute
+db.synopsis = element synopsis { verbatim.contentmodel }
+
+cmdsynopsis.sepchar.attrib = attribute sepchar { text }?
+cmdsynopsis.cmdlength.attrib = attribute cmdlength { text }?
+
+cmdsynopsis.info = db.info
+db.cmdsynopsis =
+   element cmdsynopsis {
+      cmdsynopsis.info,
+      (db.command | db.arg | db.group | db.sbr)+,
+      db.synopfragment*
+   }
+
+rep.attribute = attribute rep { "norepeat" | "repeat" }
+choice.attribute = attribute choice { "opt" | "plain" | "req" }
+
+arg.rep.attrib = rep.attribute
+arg.choice.attrib = choice.attribute
+
+db.arg =
+   element arg {
+      (docbook.text
+       | db.arg
+       | db.group
+       | db.option
+       | db.synopfragmentref
+       | db.sbr)*
+   }
+
+
+group.rep.attrib = rep.attribute
+group.choice.attrib = choice.attribute
+
+db.group =
+   element group {
+      (db.arg | db.group | db.option | db.synopfragmentref | db.sbr)+
+   }
+
+db.sbr = element sbr { empty }
+
+ctrl:common-attributes [ element="synopfragment" attributes="common.attrib.idreq" ]
+
+db.synopfragment = element synopfragment { (db.arg | db.group)+ }
+
+synopfragmentref.linkend.attrib = linkend.attribute
+db.synopfragmentref = element synopfragmentref { docbook.text }
+
+funcsynopsis.info = db.info
+db.funcsynopsis =
+   element funcsynopsis {
+      funcsynopsis.info,
+      (db.funcsynopsisinfo | db.funcprototype)+
+   }
+
+funcsynopsisinfo.linenumbering.attrib = linenumbering.attribute
+db.funcsynopsisinfo = element funcsynopsisinfo { verbatim.contentmodel }
+
+db.funcprototype =
+   element funcprototype {
+      db.funcdef,
+      (db.void | db.varargs | db.paramdef+)
+   }
+
+db.funcdef = element funcdef { (docbook.text | db.type | db.function)* }
+
+db.void = element void { empty }
+
+db.varargs = element varargs { empty }
+
+db.paramdef =
+   element paramdef { (docbook.text | db.type | db.parameter | db.funcparams)* }
+
+db.funcparams = element funcparams { inlines* }
+
+oo-method.synopsis.blocks =
+  db.methodsynopsis | db.constructorsynopsis | db.destructorsynopsis
+
+oo-field.synopsis.blocks = db.fieldsynopsis
+
+classsynopsis.language.attrib = oo-language.attribute
+classsynopsis.class.attrib = attribute class { "class" | "interface" }
+db.classsynopsis =
+   element classsynopsis {
+      oo.inlines+,
+      (db.classsynopsisinfo
+       | oo-method.synopsis.blocks
+       | oo-field.synopsis.blocks)*
+   }
+
+classsynopsisinfo.linenumbering.attrib = linenumbering.attribute
+db.classsynopsisinfo = element classsynopsisinfo { verbatim.contentmodel }
+
+db.ooclass = element ooclass { db.modifier*, db.classname }
+
+db.oointerface = element oointerface { db.modifier*, db.interfacename }
+
+db.ooexception = element ooexception {db.modifier*, db.exceptionname  }
+
+db.modifier = element modifier { docbook.text }
+
+db.interfacename = element interfacename { docbook.text }
+
+db.exceptionname = element exceptionname { docbook.text }
+
+fieldsynopsis.language.attrib = oo-language.attribute
+db.fieldsynopsis =
+   element fieldsynopsis {
+      db.modifier*,
+      db.type?,
+      db.varname,
+      db.initializer?
+   }
+
+db.initializer = element initializer { docbook.text }
+
+constructorsynopsis.language.attrib = oo-language.attribute
+db.constructorsynopsis =
+   element constructorsynopsis {
+      db.modifier*,
+      db.methodname?,
+      (db.methodparam+ | db.void),
+      db.exceptionname*,
+      db.modifier*
+   }
+
+destructorsynopsis.language.attrib = oo-language.attribute
+db.destructorsynopsis =
+   element destructorsynopsis {
+      db.modifier*,
+      db.methodname?,
+      (db.methodparam+ | db.void),
+      db.exceptionname*,
+      db.modifier*
+   }
+
+methodsynopsis.language.attrib = oo-language.attribute
+db.methodsynopsis =
+   element methodsynopsis {
+      db.modifier*,
+      (db.type | db.void)?,
+      db.methodname,
+      (db.methodparam+ | db.void),
+      db.exceptionname*,
+      db.modifier*
+   }
+
+db.methodname = element methodname { docbook.text }
+
+methodparam.rep.attrib = rep.attribute
+methodparam.choice.attrib = choice.attribute
+
+db.methodparam =
+   element methodparam {
+      db.modifier*,
+      db.type?,
+      ((db.parameter, db.initializer?) | db.funcparams),
+      db.modifier*
+   }
+
+db.ackno = element ackno { inlines* }
+
+address.linenumbering.attrib = linenumbering.attribute
+db.address =
+   element address {
+      (docbook.text
+       | db.personname
+       | db.pob
+       | db.street
+       | db.city
+       | db.state
+       | db.postcode
+       | db.country
+       | db.phone
+       | db.fax
+       | db.email)*
+   }
+
+db.street = element street { docbook.text }
+db.pob = element pob { docbook.text }
+db.postcode = element postcode { docbook.text }
+db.city = element city { docbook.text }
+db.state = element state { docbook.text }
+db.country = element country { docbook.text }
+db.phone = element phone { docbook.text }
+db.fax = element fax { docbook.text }
+
+db.affiliation =
+   element affiliation {
+      db.shortaffil?,
+      db.jobtitle*,
+      db.orgname?,
+      db.orgdiv?,
+      db.address*
+   }
+
+db.shortaffil = element shortaffil { inlines* }
+
+db.jobtitle = element jobtitle { docbook.text }
+
+orgname.class.attrib =
+   attribute class {
+      "consortium"
+    | "corporation"
+    | "informal"
+    | "nonprofit"
+    | "other"
+   }?
+
+db.orgname = element orgname { inlines* }
+
+db.orgdiv = element orgdiv { inlines* }
+
+db.artpagenums = element artpagenums { docbook.text }
+
+db.personname =
+   element personname {
+      (docbook.text
+       | (db.honorific
+        | db.firstname
+        | db.surname
+        | db.lineage
+        | db.othername)+)
+   }
+
+person.author =
+   db.personname,
+   (db.personblurb
+    | db.affiliation
+    | db.email
+    | db.address
+    | db.contrib)*
+
+org.author =
+   db.orgname,
+   (db.orgdiv
+    | db.affiliation
+    | db.email
+    | db.address
+    | db.contrib)*
+
+credit.contentmodel = person.author | org.author
+
+db.author = element author { credit.contentmodel }
+
+db.authorgroup = element authorgroup { (db.author | db.editor | db.othercredit)+ }
+
+db.collab = element collab { (db.personname | db.orgname)+, db.affiliation* }
+
+db.authorinitials = element authorinitials { docbook.text }
+
+db.confgroup =
+   element confgroup {
+      (db.confdates
+       | db.conftitle
+       | db.confnum
+       | db.confsponsor
+       | db.address)*
+   }
+
+db.confdates = element confdates { docbook.text }
+
+db.conftitle = element conftitle { inlines* }
+
+db.confnum = element confnum { docbook.text }
+
+db.confsponsor = element confsponsor { inlines* }
+
+db.contractnum = element contractnum { inlines* }
+
+db.contractsponsor = element contractsponsor { inlines* }
+
+db.copyright = element copyright { db.year+, db.holder* }
+
+db.year = element year { docbook.text }
+
+db.holder = element holder { docbook.text }
+
+db.date = element date { docbook.text }
+
+db.edition = element edition { docbook.text }
+
+db.editor = element editor { credit.contentmodel }
+
+biblioid.class.attrib = biblio.class.attrib
+db.biblioid = element biblioid { docbook.text }
+
+citebiblioid.class.attrib = biblio.class.attrib
+db.citebiblioid =
+   element citebiblioid { docbook.text }
+
+bibliosource.class.attrib = biblio.class.attrib
+db.bibliosource = element bibliosource { docbook.text }
+
+bibliorelation.class.attrib = biblio.class.attrib
+
+ctrl:other-attribute [ name="bibliorelation"
+                       attribute-name="type"
+                       attribute-values="hasformat haspart hasversion isformatof ispartof isreferencedby isreplacedby isrequiredby isversionof references replaces requires"
+                       other-attribute-name="othertype"
+                       other-attribute-value="othertype" ]
+
+db.bibliorelation = element bibliorelation { docbook.text }
+
+ctrl:other-attribute [ name="bibliocoverage"
+                       attribute-name="spatial"
+                       attribute-values="dcmibox dcmipoint iso3166 tgn"
+                       other-attribute-name="otherspacial"
+                       other-attribute-value="otherspacial" ]
+
+ctrl:other-attribute [ name="bibliocoverage"
+                       attribute-name="temporal"
+                       attribute-values="dcmiperiod othertemporal w3c-dtf"
+                       other-attribute-name="othertemporal"
+                       other-attribute-value="othertemporal" ]
+
+db.bibliocoverage = element bibliocoverage { docbook.text }
+
+legalnotice.info = docbook.info
+db.legalnotice = element legalnotice { legalnotice.info, blocks+ }
+
+db.othercredit = element othercredit { credit.contentmodel }
+
+db.pagenums = element pagenums { docbook.text }
+
+db.contrib = element contrib { docbook.text }
+
+db.honorific = element honorific { docbook.text }
+
+db.firstname = element firstname { docbook.text }
+
+db.surname = element surname { docbook.text }
+
+db.lineage = element lineage { docbook.text }
+
+db.othername = element othername { docbook.text }
+
+db.printhistory = element printhistory { para.blocks+ }
+
+db.productname = element productname { docbook.text }
+
+db.productnumber = element productnumber { docbook.text }
+
+db.pubdate = element pubdate { docbook.text }
+
+db.publisher = element publisher { (docbook.text | (db.publishername, db.address*)) }
+
+db.publishername = element publishername { docbook.text }
+
+db.releaseinfo = element releaseinfo { docbook.text }
+
+revhistory.info = docbook.info
+db.revhistory = element revhistory { revhistory.info, db.revision+ }
+
+db.revision =
+   element revision {
+      db.revnumber,
+      db.date,
+      (db.authorinitials | db.author)*,
+      (db.revremark | db.revdescription)?
+   }
+
+db.revnumber = element revnumber { docbook.text }
+
+db.revremark = element revremark { inlines* }
+
+db.revdescription = element revdescription { blocks* }
+
+db.seriesvolnums = element seriesvolnums { docbook.text }
+
+db.volumenum = element volumenum { docbook.text }
+
+db.accel  = element accel { docbook.text }
+
+application.class.attrib = attribute class { "hardware" | "software" }?
+db.application = element application { docbook.text }
+
+db.classname = element classname { docbook.text }
+
+db.command = element command { inlines* }
+
+ctrl:choice-list [ name="computeroutput.inlines" choose="inlines" ]
+
+db.computeroutput = element computeroutput { computeroutput.inlines* }
+
+database.class.attrib =
+   attribute class {
+      "field" | "key1" | "key2" | "name" | "record" | "table"
+   }?
+db.database = element database { docbook.text }
+
+db.email = element email { docbook.text }
+
+db.envar = element envar { docbook.text }
+
+db.errorcode = element errorcode { docbook.text }
+
+db.errorname = element errorname { docbook.text }
+
+db.errortext = element errortext { inlines* }
+
+db.errortype = element errortype { docbook.text }
+
+filename.path.attrib = attribute path { text }?
+filename.class.attrib =
+   attribute class {
+      "devicefile"
+    | "directory"
+    | "extension"
+    | "headerfile"
+    | "libraryfile"
+    | "partition"
+    | "symlink"
+   }?
+db.filename = element filename { docbook.text }
+
+db.function = element function { docbook.text }
+
+db.guibutton = element guibutton { docbook.text }
+
+db.guiicon = element guiicon { docbook.text }
+
+db.guilabel = element guilabel { docbook.text }
+
+db.guimenu = element guimenu { docbook.text }
+
+db.guimenuitem =  element guimenuitem { docbook.text }
+
+db.guisubmenu = element guisubmenu { docbook.text }
+
+db.hardware = element hardware { docbook.text }
+
+db.keycap = element keycap { docbook.text }
+
+db.keycode = element keycode { docbook.text }
+
+ctrl:other-attribute [ name="keycombo"
+                       attribute-name="action"
+                       attribute-values="click double-click press seq simul"
+                       other-attribute-name="otheraction"
+                       other-attribute-value="other" ]
+
+db.keycombo = element keycombo { docbook.text }
+
+db.keysym = element keysym { docbook.text }
+
+db.lineannotation = element lineannotation { inlines* }
+
+db.literal = element literal { inlines* }
+
+db.constant = element constant { docbook.text }
+
+db.varname = element varname { docbook.text }
+
+db.markup = element markup { docbook.text }
+
+db.menuchoice = element menuchoice { docbook.text }
+
+shortcut.action.attrib = keycombo.action.attrib
+
+db.shortcut = element shortcut { docbook.text }
+
+db.mousebutton = element mousebutton { docbook.text }
+
+db.option = element option { docbook.text }
+
+db.optional = element optional { inlines* }
+
+parameter.class.attrib = attribute class { "command" | "function" | "option" }?
+db.parameter = element parameter { docbook.text }
+
+ctrl:choice-list [ name="prompt.inlines" choose="docbook.text" ]
+
+db.prompt = element prompt { prompt.inlines* }
+
+db.replaceable = element replaceable { docbook.text }
+
+db.returnvalue = element returnvalue { docbook.text }
+
+xmltag.class.attrib =
+  attribute class {
+    "attribute"
+    | "attvalue"
+    | "element"
+    | "emptytag"
+    | "endtag"
+    | "genentity"
+    | "numcharref"
+    | "paramentity"
+    | "pi"
+    | "sgmlcomment"
+    | "starttag"
+    | "xmlpi"
+  }?
+db.xmltag = element xmltag { docbook.text }
+
+db.symbol = element symbol { docbook.text }
+
+systemitem.class.attrib =
+   attribute class {
+      "domainname"
+    | "etheraddress"
+    | "event"
+    | "eventhandler"
+    | "filesystem"
+    | "fqdomainname"
+    | "groupname"
+    | "ipaddress"
+    | "library"
+    | "macro"
+    | "netmask"
+    | "newsgroup"
+    | "osname"
+    | "resource"
+    | "systemname"
+    | "username"
+  }?
+
+ctrl:choice-list [ name="systemitem.inlines" choose="docbook.text" ]
+
+db.systemitem = element systemitem { systemitem.inlines* }
+
+db.uri = element uri { docbook.text }
+
+db.token = element token { docbook.text }
+
+db.type = element type { docbook.text }
+
+db.userinput = element userinput { inlines* }
+
+db.abbrev = element abbrev { docbook.text }
+
+db.acronym = element acronym { docbook.text }
+
+db.citation = element citation { docbook.text }
+
+db.citerefentry = element citerefentry { db.refentrytitle, db.manvolnum? }
+
+db.refentrytitle = element refentrytitle { inlines* }
+
+db.manvolnum = element manvolnum { docbook.text }
+
+citetitle.pubwork.attrib =
+   attribute pubwork {
+      "article"
+    | "book"
+    | "chapter"
+    | "journal"
+    | "manuscript"
+    | "part"
+    | "refentry"
+    | "section"
+    | "series"
+    | "set"
+   }?
+
+db.citetitle = element citetitle { inlines* }
+
+db.emphasis = element emphasis { inlines* }
+
+firstterm.baseform.attrib = glossterm.baseform.attrib
+db.firstterm = element firstterm { docbook.text }
+
+db.foreignphrase = element foreignphrase { inlines* }
+
+glossterm.baseform.attrib = attribute baseform { text }?
+db.glossterm = element glossterm { docbook.text }
+
+db.phrase = element phrase { inlines* }
+
+db.quote = element quote { inlines* }
+
+db.subscript = element subscript { docbook.text }
+
+db.superscript = element superscript { docbook.text }
+
+trademark.class.attrib =
+   attribute class { "copyright" | "registered" | "service" | "trade" }?
+
+db.trademark = element trademark { docbook.text }
+
+db.wordasword = element wordasword { docbook.text }
+
+db.footnoteref = element footnoteref { empty }
+
+ctrl:common-linking [ element="xref" attributes="common.linking.attributes.req" ]
+
+xref.xrefstyle.attrib = attribute xrefstyle { text }
+db.xref = element xref { empty }
+
+ctrl:common-linking [ element="anchor" suppress="yes" ]
+
+db.anchor = element anchor { empty }
+
+indexterm.singular.significance.attrib = significance.attribute?
+indexterm.startofrange.significance.attrib = significance.attribute?
+indexterm.endofrange.significance.attrib = significance.attribute?
+
+indexterm.singular.zone.attrib = zone.attribute?
+indexterm.startofrange.zone.attrib = zone.attribute?
+indexterm.endofrange.zone.attrib = zone.attribute?
+
+indexterm.singular.pagenum.attrib = pagenum.attribute?
+indexterm.startofrange.pagenum.attrib =  pagenum.attribute?
+indexterm.endofrange.pagenum.attrib =  pagenum.attribute?
+
+indexterm.singular.scope.attrib = scope.attribute?
+indexterm.startofrange.scope.attrib = scope.attribute?
+indexterm.endofrange.scope.attrib = scope.attribute?
+
+indexterm.singular.class.attrib = attribute class { "singular" }?
+indexterm.startofrange.class.attrib = attribute class { "startofrange" }
+indexterm.endofrange.class.attrib = attribute class { "endofrange" }
+
+indexterm.endofrange.startref.attrib = attribute startref { xsd:IDREF }?
+
+indexterm.contentmodel =
+   db.primary?,
+   ((db.secondary,
+      ((db.tertiary, (db.see | db.seealso+)?)
+       | db.see
+       | db.seealso+)?)
+    | db.see
+    | db.seealso+)?
+
+indexterm.singular =
+   element indexterm {
+      indexterm.contentmodel
+   }
+
+indexterm.startofrange =
+   element indexterm {
+      indexterm.contentmodel
+   }
+
+indexterm.endofrange =
+   element indexterm {
+      indexterm.contentmodel
+   }
+
+db.indexterm = (indexterm.singular|indexterm.startofrange|indexterm.endofrange)
+
+sortas.attribute = attribute sortas { text }?
+
+primary.sortas.attrib = sortas.attribute?
+db.primary = element primary { inlines* }
+
+secondary.sortas.attrib = sortas.attribute?
+db.secondary = element secondary { inlines* }
+
+tertiary.sortas.attrib = sortas.attribute?
+db.tertiary = element tertiary { inlines* }
+
+db.see = element see { inlines* }
+
+db.seealso = element seealso { inlines* }
diff --git a/docbook/relaxng/tools/cleanup.pl b/docbook/relaxng/tools/cleanup.pl
new file mode 100644 (file)
index 0000000..e886d90
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -- # -*- Perl -*-
+
+# Simple script to cleanup the output of the stylesheets. It fiddles with
+# spuriouis namespace declarations, mostly. And adds newlines between the
+# definitions.
+
+while (<>) {
+    s/<rng:/</g;
+    s/<\/rng:/<\//g;
+    s/\s+xmlns:rng=[\"\'].*?[\"\']\s+/ /g;
+    s/\s*xmlns:rng=[\"\'].*?[\"\']\s*//g;
+    s/\s+xmlns:ctrl=[\"\'].*?[\"\']\s+/ /g;
+    s/\s*xmlns:ctrl=[\"\'].*?[\"\']\s*//g;
+    print $_;
+    print "\n" if /<\/define>/;
+}
diff --git a/docbook/relaxng/tools/combine.xsl b/docbook/relaxng/tools/combine.xsl
new file mode 100644 (file)
index 0000000..15c7bbc
--- /dev/null
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/"
+                exclude-result-prefixes="exsl ctrl"
+                version="1.0">
+
+  <!-- This stylesheet does a fair bit of work.
+
+       1. It merges modules passed as a parameter into the primary grammar
+       2. It expands several elements in the ctrl: namespace
+       3. It augments the grammar with some standard constructs:
+          a. Every element gets a role attribute
+          b. Every element gets some common attributes (absent ctrl:*)
+          c. The attribute list is added to the element definition
+
+       The resulting grammar is ready for use by a validator. -->
+
+  <xsl:output method="xml" encoding="utf-8" indent="yes"/>
+  <xsl:strip-space elements="*"/>
+
+  <xsl:key name="defs" match="rng:define" use="@name"/>
+  <xsl:key name="choice-lists" match="ctrl:choice-list" use="@name"/>
+
+  <xsl:param name="modules" select="''"/>
+
+  <xsl:template match="/">
+    <xsl:variable name="merged">
+      <xsl:apply-templates select="/" mode="include"/>
+    </xsl:variable>
+
+    <xsl:variable name="expanded">
+      <xsl:apply-templates select="exsl:node-set($merged)/rng:grammar" mode="expand"/>
+    </xsl:variable>
+
+    <xsl:message>Augmenting grammar</xsl:message>
+    <xsl:apply-templates select="exsl:node-set($expanded)/rng:grammar"/>
+  </xsl:template>
+
+  <xsl:template match="rng:grammar" priority="2">
+    <grammar xmlns="http://relaxng.org/ns/structure/1.0"
+             datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+      <xsl:copy-of select="@*"/>
+      <xsl:for-each select="*">
+        <xsl:choose>
+          <xsl:when test="self::rng:define and rng:element[@name]">
+            <xsl:variable name="basename">
+              <xsl:choose>
+                <xsl:when test="starts-with(@name, 'db.')">
+                  <xsl:value-of select="substring-after(@name, 'db.')"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@name"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable>
+
+            <rng:define name="{$basename}.role.attrib">
+              <rng:optional>
+                <rng:attribute name="role"/>
+              </rng:optional>
+            </rng:define>
+
+            <rng:define name="local.{$basename}.attrib">
+              <rng:optional>
+                <rng:notAllowed/>
+              </rng:optional>
+            </rng:define>
+
+            <rng:define name="{$basename}.attlist">
+              <xsl:variable name="ctrl:common-attributes"
+                            select="//ctrl:common-attributes[@element=$basename][1]"/>
+              <xsl:variable name="ctrl:common-linking"
+                            select="//ctrl:common-linking[@element=$basename][1]"/>
+
+              <xsl:choose>
+                <xsl:when test="$ctrl:common-attributes/@suppress">
+                  <!-- nop -->
+                </xsl:when>
+                <xsl:when test="$ctrl:common-attributes">
+                  <rng:ref name="{$ctrl:common-attributes/@attributes}"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <rng:ref name="common.attributes"/>
+                </xsl:otherwise>
+              </xsl:choose>
+
+              <xsl:choose>
+                <xsl:when test="$ctrl:common-linking/@suppress">
+                  <!-- nop -->
+                </xsl:when>
+                <xsl:when test="$ctrl:common-linking">
+                  <rng:ref name="{$ctrl:common-linking/@attributes}"/>
+                </xsl:when>
+                <xsl:when test="key('defs',concat($basename,'.linkend.attrib'))
+                                or key('defs',concat($basename,'.linkends.attrib'))">
+                  <!-- no common linking attributes -->
+                </xsl:when>
+                <xsl:otherwise>
+                  <rng:ref name="common.linking.attributes"/>
+                </xsl:otherwise>
+              </xsl:choose>
+
+              <rng:ref name="{$basename}.role.attrib"/>
+
+              <xsl:for-each select="/rng:grammar/rng:define[not(@combine)]">
+                <xsl:if test="string-length(@name) &gt; 7
+                              and starts-with(@name,concat($basename,'.'))
+                              and substring(@name, string-length(@name)-6) = '.attrib'">
+                  <rng:ref name="{@name}"/>
+                </xsl:if>
+              </xsl:for-each>
+
+              <rng:ref name="local.{$basename}.attrib"/>
+            </rng:define>
+
+            <xsl:apply-templates select="."/>
+          </xsl:when>
+
+          <xsl:when test="self::ctrl:common-linking|self::ctrl:common-attributes">
+            <!-- suppress -->
+          </xsl:when>
+
+          <xsl:otherwise>
+            <xsl:apply-templates select="."/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+    </grammar>
+  </xsl:template>
+
+  <xsl:template match="rng:element[@name]" priority="2">
+    <xsl:variable name="basename">
+      <xsl:choose>
+        <xsl:when test="starts-with(parent::rng:define/@name, 'db.')">
+          <xsl:value-of select="substring-after(parent::rng:define/@name, 'db.')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="parent::rng:define/@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <rng:ref name="{$basename}.attlist"/>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="comment()|processing-instruction()|text()">
+    <xsl:copy/>
+  </xsl:template>
+
+  <!-- ====================================================================== -->
+  <!-- Merge grammars -->
+
+  <xsl:template match="/" mode="include">
+    <xsl:apply-templates mode="include"/>
+  </xsl:template>
+
+  <xsl:template match="rng:grammar" priority="2" mode="include">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="include"/>
+
+      <xsl:if test="$modules != ''">
+        <xsl:call-template name="merge-grammars">
+          <xsl:with-param name="modules" select="$modules"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*" mode="include">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="include"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="comment()|processing-instruction()|text()" mode="include">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template name="merge-grammars">
+    <xsl:param name="modules" select="''"/>
+
+    <xsl:variable name="module">
+      <xsl:choose>
+        <xsl:when test="contains($modules, ' ')">
+          <xsl:value-of select="substring-before($modules, ' ')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$modules"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:message>Loading module: <xsl:value-of select="$module"/></xsl:message>
+
+    <xsl:variable name="grammar" select="document($module, .)"/>
+    <xsl:apply-templates select="$grammar/rng:grammar/node()" mode="include"/>
+
+    <xsl:if test="contains($modules, ' ')">
+      <xsl:call-template name="merge-grammars">
+        <xsl:with-param name="modules" select="substring-after($modules, ' ')"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ====================================================================== -->
+  <!-- Expand ctrl: elements -->
+
+  <xsl:template match="/" mode="expand">
+    <xsl:apply-templates mode="expand"/>
+  </xsl:template>
+
+  <xsl:template match="ctrl:other-attribute" priority="2" mode="expand">
+    <xsl:message>Expanding other attribute: <xsl:value-of select="@name"/></xsl:message>
+
+    <rng:define name="{@name}.enum{@attribute-name}.attribute">
+      <rng:optional>
+        <rng:attribute name="{@attribute-name}">
+          <rng:choice>
+            <xsl:call-template name="values">
+              <xsl:with-param name="string"
+                              select="normalize-space(@attribute-values)"/>
+            </xsl:call-template>
+          </rng:choice>
+        </rng:attribute>
+      </rng:optional>
+    </rng:define>
+
+    <rng:define name="{@name}.other{@attribute-name}.attributes">
+      <rng:attribute name="{@attribute-name}">
+        <rng:value>
+          <xsl:value-of select="@other-attribute-value"/>
+        </rng:value>
+      </rng:attribute>
+      <rng:attribute name="{@other-attribute-name}">
+        <rng:text/>
+      </rng:attribute>
+    </rng:define>
+
+    <rng:define name="{@name}.{@attribute-name}.attrib">
+      <rng:choice>
+        <rng:ref name="{@name}.enum{@attribute-name}.attribute"/>
+        <rng:ref name="{@name}.other{@attribute-name}.attributes"/>
+      </rng:choice>
+    </rng:define>
+  </xsl:template>
+
+  <xsl:template match="ctrl:choice-list" priority="2" mode="expand">
+    <xsl:variable name="name" select="@name"/>
+    <xsl:if test="not(preceding::ctrl:choice-list[@name=$name])">
+      <xsl:message>Expanding choice list: <xsl:value-of select="@name"/></xsl:message>
+      <rng:define name="{$name}">
+        <rng:choice>
+          <xsl:for-each select="key('choice-lists', $name)">
+            <xsl:choose>
+              <xsl:when test="@choose = '#notAllowed'">
+                <rng:notAllowed/>
+              </xsl:when>
+              <xsl:otherwise>
+                <rng:ref name="{@choose}"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:for-each>
+        </rng:choice>
+      </rng:define>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="*" mode="expand">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="expand"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="comment()|processing-instruction()|text()" mode="expand">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template name="values">
+    <xsl:param name="string" select="''"/>
+
+    <xsl:choose>
+      <xsl:when test="contains($string, ' ')">
+        <rng:value>
+          <xsl:value-of select="substring-before($string, ' ')"/>
+        </rng:value>
+        <xsl:call-template name="values">
+          <xsl:with-param name="string" select="substring-after($string, ' ')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <rng:value>
+          <xsl:value-of select="$string"/>
+        </rng:value>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- ====================================================================== -->
+
+</xsl:stylesheet>
diff --git a/docbook/relaxng/tools/dtd-ok.xsl b/docbook/relaxng/tools/dtd-ok.xsl
new file mode 100644 (file)
index 0000000..cd7bee8
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/"
+                exclude-result-prefixes="exsl ctrl"
+                version="1.0">
+
+  <!-- The plan is that this stylesheet cleans up a DocBook RNG file, refactoring
+       the constructs that Trang can't handle into appropriate deterministic
+       (and less constrained) alternatives. -->
+
+  <xsl:output method="xml" encoding="utf-8" indent="yes"/>
+  <xsl:strip-space elements="*"/>
+
+  <xsl:template match="rng:define[string-length(@name) &gt; 7
+                       and starts-with(@name,'local.')
+                       and substring(@name, string-length(@name)-6) = '.attrib']"
+                priority="2">
+    <!-- delete this -->
+  </xsl:template>
+
+  <xsl:template match="rng:ref[string-length(@name) &gt; 7
+                       and starts-with(@name,'local.')
+                       and substring(@name, string-length(@name)-6) = '.attrib']"
+                priority="2">
+    <!-- delete this -->
+  </xsl:template>
+
+  <xsl:template match="*">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="comment()|processing-instruction()|text()">
+    <xsl:copy/>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/docbook/relaxng/tools/missing-defs.xsl b/docbook/relaxng/tools/missing-defs.xsl
new file mode 100644 (file)
index 0000000..f751be7
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rng="http://relaxng.org/ns/structure/1.0"
+                version="1.0">
+
+<!-- This stylesheet is just used for debugging, it reports what definitions
+     are referenced but undefined or defined but unused in a particular grammar
+     module. For the final grammar, it shouldn't print anything. -->
+
+<xsl:output method="text"/>
+
+<xsl:key name="defines" match="rng:define" use="@name"/>
+<xsl:key name="refs" match="rng:ref" use="@name"/>
+
+<xsl:template match="/">
+  <xsl:for-each select="//rng:ref">
+    <xsl:variable name="name" select="@name"/>
+    <xsl:if test="not(preceding::rng:ref[@name=$name])">
+      <xsl:if test="not(key('defines', $name))">
+        <xsl:text>Missing define: </xsl:text>
+        <xsl:value-of select="$name"/>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+  </xsl:for-each>
+
+  <xsl:for-each select="//rng:define">
+    <xsl:variable name="name" select="@name"/>
+    <xsl:if test="not(preceding::rng:define[@name=$name])">
+      <xsl:if test="not(key('refs', $name)) and not(rng:element)">
+        <xsl:text>Unreferenced: </xsl:text>
+        <xsl:value-of select="$name"/>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>