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. 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.
<start> <element name="page:page"> <ref name="page.page"/> </element> </start>
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 throughout the content and around the metadata.
<define name="page.page"> <zeroOrMore> <ref name="xi.include"/> </zeroOrMore> <optional> <ref name="page.metadata"/> </optional> <zeroOrMore> <ref name="xi.include"/> </zeroOrMore> <element name="page:content"> <ref name="common.commonAttributes"/> <zeroOrMore> <choice> <ref name="xi.include"/> <ref name="text.verticalContent"/> </choice> </zeroOrMore> </element> </define>
Metadata describes the page with information that does not necessarily get output on the body of the page.
<define name="page.metadata"> <element name="page:meta"> <ref name="common.commonAttributes"/> <interleave> <ref name="page.pageTitleElement"/> <ref name="page.copyrightElement"/> <optional> <ref name="page.breadcrumb"/> </optional> <optional> <ref name="paloose.page-hit"/> </optional> </interleave> </element> </define>
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 name="page.pageTitleElement"> <sch:pattern name="Only plain text or i18n namespace allowed within page title."> <sch:rule context="page:title"> <sch:report test="descendant::*[ namespace-uri() != 'http://apache.org/cocoon/i18n/2.1' ]">Only plain text or i18n namespace allowed within page title.</sch:report> </sch:rule> </sch:pattern> <element name="page:title"> <zeroOrMore> <choice> <text/> <ref name="i18n.text"/> </choice> </zeroOrMore> </element> </define>
Copyright text is pretty much anything. This could be restricted like the page title above.
<define name="page.copyrightElement"> <element name="page:copyright"> <zeroOrMore> <choice> <ref name="text.verticalContent"/> <ref name="text.horizontalContent"/> </choice> </zeroOrMore> </element> </define>
<define name="page.breadcrumb"> <sch:pattern name="Only plain text or i18n namespace allowed within breadcrumb title."> <sch:rule context="page:breadcrumb"> <sch:report test="descendant::*[ namespace-uri() != 'http://apache.org/cocoon/i18n/2.1' ]">Only plain text or i18n namespace allowed within page title.</sch:report> </sch:rule> </sch:pattern> <element name="page:breadcrumb"> <zeroOrMore> <choice> <text/> <ref name="i18n.text"/> </choice> </zeroOrMore> </element> </define>