RELAX NG Schema for Paloose Sitemaps
Author: Hugh Field-Richards
Date: 2011-08-03T12:15

This is the RELAX NG schema for the Paloose sitemaps. They are very similar to Cocoon sitemaps, but with enough differences to make it worth formalising separately. Any bug reports, help, suggestions, new task schemas etc to me, Hugh Field-Richards (hsfr@hsfr.org.uk).

The documentation is designed to be processed by the rng2xhtml.xsl pretty-printing processor available from the author.

Schematron
Declare schematron namespace : map = http://apache.org/cocoon/sitemap/1.0

Generators

A Generator generates XML content as DOM objects and initializes the pipeline processing.

components.generators — Warning! not used within this schema file.
define : components.generators
element : map:generators
attribute : default
refdata.componentName
zeroOrMore
<define name="components.generators">
   <element name="map:generators">
      <attribute name="default">
         <ref name="data.componentName"/>
      </attribute>
      <zeroOrMore>
         <ref name="generators.generator"/>
      </zeroOrMore>
   </element>
</define>
define : generators.generator
Schematron
Check the generator names are unique
Context : “map:generator
if not condition “count(//map:generator[@name = current()/@name]) = 1
then output: There should be unique generator names
element : map:generator
refcomponent.attribute.cachable
refcomponent.attributes.common
<define name="generators.generator">
   <sch:pattern name="Check the generator names are unique">
      <sch:rule context="map:generator">
         <sch:assert test="count(//map:generator[@name = current()/@name]) = 1">There should be unique generator names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:generator">
      <ref name="component.attribute.cachable"/>
      <ref name="component.attributes.common"/>
      <ref name="FileGenerator.contents"/>
      <ref name="PXTemplateGenerator.contents"/>
      <ref name="DirectoryGenerator.contents"/>
      <ref name="TidyGenerator.contents"/>
      <ref name="GedComGenerator.contents"/>
   </element>
</define>
define : FileGenerator.contents
interleave
optional
refcomponent.use-request-parameters
<define name="FileGenerator.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : PXTemplateGenerator.contents
interleave
optional
refcomponent.use-request-parameters
<define name="PXTemplateGenerator.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : DirectoryGenerator.contents
interleave
optional
refcomponent.use-request-parameters
<define name="DirectoryGenerator.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : TidyGenerator.contents
Schematron
Tidy parameters elements only allowed within TidyGenerator
Context : “//map:generator/map:parameter[ @name='char-encoding' ]
If condition “parent::*[ not( contains( @src, 'TidyGenerator' ) ) ]
then output: char-encoding parameter only allowed within TidyGenerator
Context : “//map:generator/map:parameter[ @name='clean' ]
If condition “parent::*[ not( contains( @src, 'TidyGenerator' ) ) ]
then output: clean parameter only allowed within TidyGenerator
Context : “//map:generator/map:parameter[ @name='word-2000' ]
If condition “parent::*[ not( contains( @src, 'TidyGenerator' ) ) ]
then output: word-2000 parameter only allowed within TidyGenerator
interleave
optional
refcomponent.use-request-parameters
zeroOrMore
refcommon.element.parameter
<define name="TidyGenerator.contents">
   <sch:pattern name="Tidy parameters elements only allowed within TidyGenerator">
      <sch:rule context="//map:generator/map:parameter[ @name='char-encoding' ]">
         <sch:report test="parent::*[ not( contains( @src, 'TidyGenerator' ) ) ]">char-encoding parameter only allowed within TidyGenerator</sch:report>
      </sch:rule>
      <sch:rule context="//map:generator/map:parameter[ @name='clean' ]">
         <sch:report test="parent::*[ not( contains( @src, 'TidyGenerator' ) ) ]">clean parameter only allowed within TidyGenerator</sch:report>
      </sch:rule>
      <sch:rule context="//map:generator/map:parameter[ @name='word-2000' ]">
         <sch:report test="parent::*[ not( contains( @src, 'TidyGenerator' ) ) ]">word-2000 parameter only allowed within TidyGenerator</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : GedComGenerator.contents
Schematron
GedCom parameters only allowed within GedComGenerator
Context : “//map:generator/map:parameter[ @name='generateXMLFile' ]
If condition “parent::*[ not( contains( @src, 'GedComGenerator' ) ) ]
then output: generateXMLFile parameter only allowed within GedComGenerator
Context : “//map:generator/map:parameter[ @name='generateDOM' ]
If condition “parent::*[ not( contains( @src, 'GedComGenerator' ) ) ]
then output: generateDOM parameter only allowed within GedComGenerator
Context : “//map:generator/map:parameter[ @name='useXMLFile' ]
If condition “parent::*[ not( contains( @src, 'GedComGenerator' ) ) ]
then output: useXMLFile parameter only allowed within GedComGenerator
interleave
optional
refcomponent.use-request-parameters
zeroOrMore
refcommon.element.parameter
<define name="GedComGenerator.contents">
   <sch:pattern name="GedCom parameters only allowed within GedComGenerator">
      <sch:rule context="//map:generator/map:parameter[ @name='generateXMLFile' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GedComGenerator' ) ) ]">generateXMLFile parameter only allowed within GedComGenerator</sch:report>
      </sch:rule>
      <sch:rule context="//map:generator/map:parameter[ @name='generateDOM' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GedComGenerator' ) ) ]">generateDOM parameter only allowed within GedComGenerator</sch:report>
      </sch:rule>
      <sch:rule context="//map:generator/map:parameter[ @name='useXMLFile' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GedComGenerator' ) ) ]">useXMLFile parameter only allowed within GedComGenerator</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>

Generator Pipeline Instance

Generators are instanced within a pipeline. However there are certain constraints on where the generator can occur. Primarily it must always be the first element within a pipeline (it makes no sense to be anywhere else).

generator.instance — Warning! not used within this schema file.
define : generator.instance
element : map:generate
optional
refcomponents.attribute.label
optional
refcomponents.attribute.type
refcomponents.attribute.src
zeroOrMore
refcommon.element.parameter
<define name="generator.instance">
   <element name="map:generate">
      <optional>
         <ref name="components.attribute.label"/>
      </optional>
      <optional>
         <ref name="components.attribute.type"/>
      </optional>
      <ref name="components.attribute.src"/>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </element>
</define>

Aggregation

aggregate.instance — Warning! not used within this schema file.
define : aggregate.instance
element : map:aggregate
refcomponents.attribute.element
optional
refcomponents.attribute.label
oneOrMore
<define name="aggregate.instance">
   <element name="map:aggregate">
      <ref name="components.attribute.element"/>
      <optional>
         <ref name="components.attribute.label"/>
      </optional>
      <oneOrMore>
         <ref name="aggregate.part"/>
      </oneOrMore>
   </element>
</define>
define : aggregate.part
element : map:part
refcomponents.attribute.element
optional
refcomponents.attribute.strip-root
refcomponents.attribute.src
<define name="aggregate.part">
   <element name="map:part">
      <ref name="components.attribute.element"/>
      <optional>
         <ref name="components.attribute.strip-root"/>
      </optional>
      <ref name="components.attribute.src"/>
   </element>
</define>

Copyright

Copyright (c) 2006 – 2009 Hugh Field-Richards

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

For a copy of the GNU General Public License write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.