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.


Included file: common/common.rng
Included file: common/xinclude.rng
Included file: common/text.rng
Included file: paloose.rng
Included file: pforms.rng

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

Schema Root
start
element  :  page:page
ref  →  page.page

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.

page.page
define  :  page.page
zeroOrMore
ref  →  xi.include
optional
ref  →  page.metadata
zeroOrMore
ref  →  xi.include
element  :  page:content
ref  →  common.commonAttributes
zeroOrMore
choice
ref  →  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.

page.metadata
define  :  page.metadata
element  :  page:meta
ref  →  common.commonAttributes
interleave
ref  →  page.pageTitleElement
ref  →  page.copyrightElement
optional
ref  →  page.breadcrumb
optional
ref  →  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 :-)

page.pageTitleElement
define  :  page.pageTitleElement
Schematron
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:title
zeroOrMore
choice
Any text
ref  →  i18n.text

Copyright Text

Copyright text is pretty much anything. This could be restricted like the page title above.

page.copyrightElement
define  :  page.copyrightElement
element  :  page:copyright
zeroOrMore
choice
ref  →  text.verticalContent
ref  →  text.horizontalContent

Page Breadcrumb Title

page.breadcrumb
define  :  page.breadcrumb
Schematron
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:breadcrumb
zeroOrMore
choice
Any text
ref  →  i18n.text