From 63e4635ed178d6761e9a81050c3ae3b347f6d0ae Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Sun, 17 Oct 2004 21:38:21 +0000 Subject: [PATCH] Support xml:id and XLink (at last) --- docbook/relaxng/src/docbook.rnc | 1 + docbook/relaxng/src/pool.rnc | 14 ++++- docbook/relaxng/src/xlink.rnc | 99 +++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 docbook/relaxng/src/xlink.rnc diff --git a/docbook/relaxng/src/docbook.rnc b/docbook/relaxng/src/docbook.rnc index 932150357..5294e9e66 100644 --- a/docbook/relaxng/src/docbook.rnc +++ b/docbook/relaxng/src/docbook.rnc @@ -25,6 +25,7 @@ start = db.set | db.section | db.para +include "xlink.rnc" include "hier.rnc" include "sect1.rnc" include "refentry.rnc" diff --git a/docbook/relaxng/src/pool.rnc b/docbook/relaxng/src/pool.rnc index 6e17d48ac..68bd27dad 100644 --- a/docbook/relaxng/src/pool.rnc +++ b/docbook/relaxng/src/pool.rnc @@ -60,6 +60,7 @@ namespace rng = "http://relaxng.org/ns/structure/1.0" namespace s = "http://www.ascc.net/xml/schematron" namespace db = "http://docbook.org/docbook-ng" namespace dbx = "http://sourceforge.net/projects/docbook/defguide/schema/extra-markup" +namespace xlink = "http://www.w3.org/1999/xlink" default namespace = "http://docbook.org/docbook-ng" # ====================================================================== @@ -85,12 +86,19 @@ db.linkend.attribute = attribute linkend { xsd:IDREF } db.linkends.attribute = attribute linkends { xsd:IDREFS } -db.href.attribute = attribute href { text } +db.href.attribute = + attribute xlink:href { text } + & attribute xlink:type { "simple" }? + & attribute xlink:role { xsd:anyURI }? + & attribute xlink:arcrole { xsd:anyURI }? + & attribute xlink:title { text }? + & attribute xlink:show { "new" | "replace" | "embed" | "other" }? + & attribute xlink:actuate { "onLoad" | "onRequest" | "other" | "none" }? # ====================================================================== db.common.attributes = - attribute id { xsd:ID }?, + attribute xml:id { xsd:ID }?, attribute version { text }?, attribute xml:lang { text }?, attribute xml:base { text }?, @@ -100,7 +108,7 @@ db.common.attributes = db.effectivity.attributes db.common.idreq.attributes = - attribute id { xsd:ID }, + attribute xml:id { xsd:ID }, attribute version { text }?, attribute xml:lang { text }?, attribute xml:base { text }?, diff --git a/docbook/relaxng/src/xlink.rnc b/docbook/relaxng/src/xlink.rnc new file mode 100644 index 000000000..65e850737 --- /dev/null +++ b/docbook/relaxng/src/xlink.rnc @@ -0,0 +1,99 @@ +# This file is part of DocBook NG: The "Eaux-de-vie" Release. + +# 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, +# Source: Derived from DocBook XML V4.3 +# Release: $Id$ +# + +namespace ctrl = "http://nwalsh.com/xmlns/schema-control/" +namespace rng = "http://relaxng.org/ns/structure/1.0" +namespace s = "http://www.ascc.net/xml/schematron" +namespace db = "http://docbook.org/docbook-ng" +namespace xlink = "http://www.w3.org/1999/xlink" +default namespace = "http://docbook.org/docbook-ng" + +db.info.elements |= db.extendedlink + +# ====================================================================== + +[ + db:refname [ "extendedlink" ] + db:refpurpose [ "" ] +] +div { + + db.extendedlink.role.attribute = attribute role { text } + + db.extendedlink.attlist = + db.extendedlink.role.attribute? + & db.common.attributes + & attribute xlink:type { "extended" }? + & attribute xlink:role { xsd:anyURI }? + & attribute xlink:title { text }? + + db.extendedlink = + element extendedlink { + db.extendedlink.attlist, + (db.locator|db.arc)+ + } +} + +# ====================================================================== + +[ + db:refname [ "locator" ] + db:refpurpose [ "" ] +] +div { + + db.locator.role.attribute = attribute role { text } + + db.locator.attlist = + db.locator.role.attribute? + & db.common.attributes + & attribute xlink:type { "locator" }? + & attribute xlink:href { text } + & attribute xlink:role { xsd:anyURI }? + & attribute xlink:title { text }? + & attribute xlink:label { xsd:NMTOKEN }? + + db.locator = + element locator { + db.locator.attlist, + empty + } +} + +# ====================================================================== + +[ + db:refname [ "arc" ] + db:refpurpose [ "" ] +] +div { + + db.arc.role.attribute = attribute role { text } + + db.arc.attlist = + db.arc.role.attribute? + & db.common.attributes + & attribute xlink:type { "arc" }? + & attribute xlink:arcrole { xsd:anyURI }? + & attribute xlink:title { text }? + & attribute xlink:show { "new" | "replace" | "embed" | "other" }? + & attribute xlink:actuate { "onLoad" | "onRequest" | "other" | "none" }? + & attribute xlink:from { xsd:NMTOKEN }? + & attribute xlink:to { xsd:NMTOKEN }? + + db.arc = + element arc { + db.arc.attlist, + empty + } +} + -- 2.49.0