RELAX NG Schema for Paloose Site Pages
Author: Hugh Field-Richards
Date: 2006-08-15T11:45
This is the RELAX NG schema for the XML pages used in the Paloose site. Since
the whole site is rooted in XML it is essential that a formal definition is made of the
structure to check any changes and created pages before they are processed by the Paloose
pipeline. Feel free to change these or use your own. However they are a good start. They also
make use of Schematron rules to cover the deficiencies of RELAX NG.
These are the namespaces needed by the Schematron validator.
Schematron
Declare schematron namespace : page:http://www.hsfr.org.uk/Schema/Page
Schematron
Declare schematron namespace : link:http://www.hsfr.org.uk/Schema/Link
Schematron
Declare schematron namespace : list:http://www.hsfr.org.uk/Schema/List
Schematron
Declare schematron namespace : text:http://www.hsfr.org.uk/Schema/Text
Schematron
Declare schematron namespace : i18n:http://apache.org/cocoon/i18n/2.1
Schematron
Declare schematron namespace : paloose:http://www.paloose.org/schemas/Paloose/1.0
Schematron
Declare schematron namespace : pf:http://www.paloose.org/schemas/Forms/1.0
Page Definition
Pages are basically metadata (optional) and content. For example
<page:page>
<page:meta>
...
</page:meta>
<page:content>
...
</page:content>
</page:page>Note that include statements can occur throughtout the content and around the metadata.
define :
page.pagezeroOrMoreref → xi.include
zeroOrMoreref → xi.include
element :
page:contentref → common.commonAttributes
zeroOrMorechoiceref → xi.include
ref → text.verticalContent
Page Metadata
Metadata describes the page with information that does not necessarily get output on the
body of the page.
define :
page.metadataelement :
page:metaref → common.commonAttributes
interleaveoptionalref → paloose.page-hit
Page Body Title
Titles that appear in title bar of the page consist only of text or translatable text.
Note that the latter should only be simple text only. We have to have a Schematron rule
here as i18n namespace can contain other tags here which we need to prevent. This sort
of thing is so easy in DSD2 :-)
define :
page.pageTitleElementSchematron
Only plain text or i18n namespace allowed within page title.Context : “
page:title”
If condition “
descendant::*[ namespace-uri() != 'http://apache.org/cocoon/i18n/2.1' ]”
then output: Only plain text or i18n namespace allowed within page title.
element :
page:titlezeroOrMorechoiceAny text
ref → i18n.text
Copyright Text
Copyright text is pretty much anything. This could be restricted like the page title
above.
define :
page.copyrightElementelement :
page:copyrightzeroOrMorechoiceref → text.verticalContent
ref → text.horizontalContent
Page Breadcrumb Title
define :
page.breadcrumbSchematron
Only plain text or i18n namespace allowed within breadcrumb title.Context : “
page:breadcrumb”
If condition “
descendant::*[ namespace-uri() != 'http://apache.org/cocoon/i18n/2.1' ]”
then output: Only plain text or i18n namespace allowed within page title.
element :
page:breadcrumbzeroOrMorechoiceAny text
ref → i18n.text