Permalink
Browse files

Reworked XLink attributes to support simple/extended links

  • Loading branch information...
ndw committed Oct 4, 2011
1 parent c63650e commit c903e3a4b81ff59c64a676a11cb9709aff6df1dc
Showing with 144 additions and 8 deletions.
  1. +9 −7 relaxng/schemas/docbook/pool.rnc
  2. +134 −0 relaxng/schemas/docbook/xlink.rnc
  3. +1 −1 relaxng/schemas/website/rddl.rnc
@@ -211,12 +211,12 @@ db.xlink.href.attribute =
]
attribute xlink:href { xsd:anyURI }
db.xlink.type.attribute =
db.xlink.simple.type.attribute =
[
db:refpurpose [ "Identifies the XLink link type" ]
]
attribute xlink:type {
## An XLink simple link
## An XLink simple link type
"simple"
}
@@ -287,15 +287,17 @@ db.xlink.actuate.attribute =
]
attribute xlink:actuate { db.xlink.actuate.enumeration }
db.href.attributes =
db.xlink.href.attribute
& db.xlink.type.attribute?
db.xlink.simple.link.attributes =
db.xlink.simple.type.attribute?
& db.xlink.href.attribute?
& db.xlink.role.attribute?
& db.xlink.arcrole.attribute?
& db.xlink.title.attribute?
& db.xlink.show.attribute?
& db.xlink.actuate.attribute?
db.xlink.attributes = db.xlink.simple.link.attributes
# ======================================================================
db.xml.id.attribute =
@@ -391,10 +393,10 @@ db.common.idreq.attributes =
& db.common.base.attributes
db.common.linking.attributes =
(db.linkend.attribute | db.href.attributes)?
(db.linkend.attribute | db.xlink.attributes)?
db.common.req.linking.attributes =
db.linkend.attribute | db.href.attributes
db.linkend.attribute | db.xlink.attributes
db.common.data.attributes =
[
@@ -35,6 +35,140 @@ namespace xlink = "http://www.w3.org/1999/xlink"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
default namespace = "http://docbook.org/ns/docbook"
db.xlink.extended.type.attribute =
[
db:refpurpose [ "Identifies the XLink extended link type" ]
s:pattern [
name = "XLink extended placement"
s:rule [
context = "*[@xlink:type='extended']"
s:assert [
test = "not(parent::*[@xlink:type='extended'])"
"An XLink extended type element may not occur as the direct child of an XLink extended type element."
]
]
]
]
attribute xlink:type {
## An XLink extended link type
"extended"
}
db.xlink.locator.type.attribute =
[
db:refpurpose [ "Identifies the XLink locator link type" ]
s:pattern [
name = "XLink locator placement"
s:rule [
context = "*[@xlink:type='locator']"
s:assert [
test = "not(parent::*[@xlink:type='extended'])"
"An XLink locator type element must occur as the direct child of an XLink extended type element."
]
]
]
]
attribute xlink:type {
## An XLink locator link type
"locator"
}
db.xlink.arc.type.attribute =
[
db:refpurpose [ "Identifies the XLink arc link type" ]
s:pattern [
name = "XLink arc placement"
s:rule [
context = "*[@xlink:type='arc']"
s:assert [
test = "parent::*[@xlink:type='extended']"
"An XLink arc type element must occur as the direct child of an XLink extended type element."
]
]
]
]
attribute xlink:type {
## An XLink arc link type
"arc"
}
db.xlink.resource.type.attribute =
[
db:refpurpose [ "Identifies the XLink resource link type" ]
s:pattern [
name = "XLink resource placement"
s:rule [
context = "*[@xlink:type='resource']"
s:assert [
test = "not(parent::*[@xlink:type='extended'])"
"An XLink resource type element must occur as the direct child of an XLink extended type element."
]
]
]
]
attribute xlink:type {
## An XLink resource link type
"resource"
}
db.xlink.title.type.attribute =
[
db:refpurpose [ "Identifies the XLink title link type" ]
s:pattern [
name = "XLink title placement"
s:rule [
context = "*[@xlink:type='title']"
s:assert [
test = "not(parent::*[@xlink:type='extended']) and not(parent::*[@xlink:type='locator']) and not(parent::*[@xlink:type='arc'])"
"An XLink title type element must occur as the direct child of an XLink extended, locator, or arc type element."
]
]
]
]
attribute xlink:type {
## An XLink title link type
"title"
}
db.xlink.extended.link.attributes =
db.xlink.extended.type.attribute
& db.xlink.role.attribute?
& db.xlink.title.attribute?
db.xlink.locator.link.attributes =
db.xlink.locator.type.attribute
& db.xlink.href.attribute
& db.xlink.role.attribute?
& db.xlink.title.attribute?
& db.xlink.label.attribute?
db.xlink.arc.link.attributes =
db.xlink.arc.type.attribute
& db.xlink.arcrole.attribute?
& db.xlink.title.attribute?
& db.xlink.show.attribute?
& db.xlink.actuate.attribute?
& db.xlink.from.attribute?
& db.xlink.to.attribute?
db.xlink.resource.link.attributes =
db.xlink.resource.type.attribute
& db.xlink.role.attribute?
& db.xlink.title.attribute?
& db.xlink.label.attribute?
db.xlink.title.link.attributes =
db.xlink.title.type.attribute
db.xlink.attributes |=
db.xlink.extended.link.attributes
| db.xlink.locator.link.attributes
| db.xlink.arc.link.attributes
| db.xlink.resource.link.attributes
| db.xlink.title.link.attributes
# /Hack hack hack
db.info.elements |= db.extendedlink
db.xlink.from.attribute =
@@ -24,7 +24,7 @@ db.technical.inlines |= rddl.resource
]
div {
rddl.resource.type.attribute = db.xlink.type.attribute
rddl.resource.type.attribute = db.xlink.simple.type.attribute
rddl.resource.arcrole.attribute = db.xlink.arcrole.attribute
rddl.resource.role.attribute = db.xlink.role.attribute
rddl.resource.href.attribute = db.xlink.href.attribute

0 comments on commit c903e3a

Please sign in to comment.