D Sample RELAX NG Grammar (Non-Normative)

The following [RELAX NG] Grammars (expressed in the compact syntax) validate XLink 1.1. They are provided only as a convenience for application developers; they have no normative status.

xlink11-simple.rnc:

namespace xlink = "http://www.w3.org/1999/xlink"

start = anyElement
anyElement = simple | foreignElement
foreignElement = element * - xlink:* { foreign.att*, (anyElement | text)* }

simple.type = attribute xlink:type {"simple"}
href.att = attribute xlink:href {xsd:anyURI}
role.att = attribute xlink:role {xsd:anyURI}
arcrole.att = attribute xlink:arcrole {xsd:anyURI}
title.att = attribute xlink:title {text}
show.att = attribute xlink:show {"new"|"replace"|"embed"|"other"|"none"}
actuate.att = attribute xlink:actuate {"onLoad"|"onRequest"|"other"|"none"}
foreign.att = attribute * - xlink:*  {text}

simple = element * {
                (simple.type | href.att | (simple.type, href.att)),
                foreign.att*, role.att?, arcrole.att?, title.att?,
                show.att?, actuate.att?,
                (anyElement | text)*
                }

xlink11.rnc:

namespace xlink = "http://www.w3.org/1999/xlink"

include "xlink11-simple.rnc" {
        anyElement = simple | extended | foreignElement
        }

label.att = attribute xlink:label {xsd:NCName}
from.att = attribute xlink:from {xsd:NCName}
to.att = attribute xlink:to {xsd:NCName}

extended = element * {
                attribute xlink:type {"extended"},
                foreign.att*, role.att?, title.att?,
                (title | resource | locator | arc | anyElement | text)*
                }

title = element * {
                attribute xlink:type {"title"}, foreign.att*,
                (anyElement | text)*
                }

resource = element * {
                attribute xlink:type {"resource"}, foreign.att*,
                role.att?, title.att?, label.att?,
                (anyElement | text)*
                }

locator = element * {
                attribute xlink:type {"locator"}, foreign.att*,
                href.att, role.att?, title.att?, label.att?,
                (title | anyElement | text)*
                }

arc = element * {
                attribute xlink:type {"arc"}, foreign.att*,
                arcrole.att?, title.att?, from.att?, to.att?,
                show.att?, actuate.att?,
                (title | anyElement | text)*
                }