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
components.transformers — Warning! not used within this schema file.
define : components.transformers
element : map:transformers
attribute : default
refdata.componentName
zeroOrMore
<define name="components.transformers">
   <element name="map:transformers">
      <attribute name="default">
         <ref name="data.componentName"/>
      </attribute>
      <zeroOrMore>
         <ref name="transformers.transformer"/>
      </zeroOrMore>
   </element>
</define>
define : transformers.transformer
Schematron
Check the transformer names are unique
Context : “map:transformer
if not condition “count(//map:transformer[ @name = current()/@name ]) = 1
then output: There should be unique transformer names
<define name="transformers.transformer">
   <sch:pattern name="Check the transformer names are unique">
      <sch:rule context="map:transformer">
         <sch:assert test="count(//map:transformer[ @name = current()/@name ]) = 1">There should be unique transformer names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:transformer">
      <ref name="component.attributes.common"/>
      <optional>
         <ref name="component.attribute.cachable"/>
      </optional>
      <ref name="SCSSTransformer.contents"/>
      <ref name="TRAXTransformer.contents"/>
      <ref name="PageHitTransformer.contents"/>
      <ref name="GalleryTransformer.contents"/>
      <ref name="PasswordTransformer.contents"/>
      <ref name="SourceWritingTransformer.contents"/>
      <ref name="FilterTransformer.contents"/>
      <ref name="SQLTransformer.contents"/>
      <ref name="EntityTransformer.contents"/>
      <ref name="LogTransformer.contents"/>
      <ref name="XIncludeTransformer.contents"/>
      <ref name="FilterTransformer.contents"/>
      <ref name="I18nTransformer.contents"/>
      <ref name="ModuleWriteTransformer.contents"/>
   </element>
</define>
define : TRAXTransformer.contents
interleave
optional
refcomponent.use-request-parameters
<define name="TRAXTransformer.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : PageHitTransformer.contents
Schematron
PageHit parameters only allowed within PageHitTransformer
Context : “//map:transformer/map:parameter[ @name='file' ]
If condition “parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]
then output: file parameter only allowed within PageHitTransformer
Context : “//map:transformer/map:parameter[ @name='unique' ]
If condition “parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]
then output: unique parameter only allowed within PageHitTransformer
Context : “//map:transformer/map:parameter[ @name='cookie-name' ]
If condition “parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]
then output: cookie-name parameter only allowed within PageHitTransformer
Context : “//map:transformer/map:parameter[ @name='ignore' ]
If condition “parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]
then output: ignore parameter only allowed within PageHitTransformer
interleave
optional
refcomponent.use-request-parameters
zeroOrMore
refcommon.element.parameter
<define name="PageHitTransformer.contents">
   <sch:pattern name="PageHit parameters only allowed within PageHitTransformer">
      <sch:rule context="//map:transformer/map:parameter[ @name='file' ]">
         <sch:report test="parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]">file parameter only allowed within PageHitTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='unique' ]">
         <sch:report test="parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]">unique parameter only allowed within PageHitTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='cookie-name' ]">
         <sch:report test="parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]">cookie-name parameter only allowed within PageHitTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='ignore' ]">
         <sch:report test="parent::*[ not( contains( @src, 'PageHitTransformer' ) ) ]">ignore parameter only allowed within PageHitTransformer</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 : GalleryTransformer.contents
Schematron
PageHit parameters only allowed within PageHitTransformer
Context : “//map:transformer/map:parameter[ @name='root' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: root parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='image-cache' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: image-cache parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='max-thumbnail-width' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: max-thumbnail-width parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='max-thumbnail-height' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: max-thumbnail-height parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='max-thumbnail-width' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: max-thumbnail-width parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='resize' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: resize parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='max-width' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: max-width parameter only allowed within GalleryTransformer
Context : “//map:transformer/map:parameter[ @name='max-height' ]
If condition “parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]
then output: max-height parameter only allowed within GalleryTransformer
interleave
optional
refcomponent.use-request-parameters
zeroOrMore
refcommon.element.parameter
<define name="GalleryTransformer.contents">
   <sch:pattern name="PageHit parameters only allowed within PageHitTransformer">
      <sch:rule context="//map:transformer/map:parameter[ @name='root' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">root parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='image-cache' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">image-cache parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='max-thumbnail-width' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">max-thumbnail-width parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='max-thumbnail-height' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">max-thumbnail-height parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='max-thumbnail-width' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">max-thumbnail-width parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='resize' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">resize parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='max-width' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">max-width parameter only allowed within GalleryTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='max-height' ]">
         <sch:report test="parent::*[ not( contains( @src, 'GalleryTransformer' ) ) ]">max-height parameter only allowed within GalleryTransformer</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 : LogTransformer.contents
interleave
zeroOrMore
refcommon.element.parameter
<define name="LogTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : XIncludeTransformer.contents
interleave
zeroOrMore
refcommon.element.parameter
<define name="XIncludeTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : PasswordTransformer.contents
interleave
zeroOrMore
refcommon.element.parameter
<define name="PasswordTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : SourceWritingTransformer.contents
interleave
zeroOrMore
refcommon.element.parameter
<define name="SourceWritingTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : FilterTransformer.contents
interleave
optional
refcomponent.use-request-parameters
<define name="FilterTransformer.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : SCSSTransformer.contents
empty
<define name="SCSSTransformer.contents">
   <empty/>
</define>
define : ModuleWriteTransformer.contents
empty
<define name="ModuleWriteTransformer.contents">
   <empty/>
</define>
define : EntityTransformer.contents
interleave
optional
refcomponent.use-request-parameters
<define name="EntityTransformer.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : SQLTransformer.contents
Schematron
PageHit parameters only allowed within PageHitTransformer
Context : “//map:transformer/map:parameter[ @name='type' ]
If condition “parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]
then output: type parameter only allowed within SQLTransformer
Context : “//map:transformer/map:parameter[ @name='host' ]
If condition “parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]
then output: host parameter only allowed within SQLTransformer
Context : “//map:transformer/map:parameter[ @name='user' ]
If condition “parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]
then output: user parameter only allowed within SQLTransformer
Context : “//map:transformer/map:parameter[ @name='password' ]
If condition “parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]
then output: password parameter only allowed within SQLTransformer
interleave
optional
refcomponent.use-request-parameters
<define name="SQLTransformer.contents">
   <sch:pattern name="PageHit parameters only allowed within PageHitTransformer">
      <sch:rule context="//map:transformer/map:parameter[ @name='type' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]">type parameter only allowed within SQLTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='host' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]">host parameter only allowed within SQLTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='user' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]">user parameter only allowed within SQLTransformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:parameter[ @name='password' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SQLTransformer' ) ) ]">password parameter only allowed within SQLTransformer</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : I18nTransformer.contents
Schematron
Catalogue elements only allowed within I18n transformer
Context : “//map:transformer/map:catalogues
If condition “parent::*[ not( contains( @src, 'I18nTransformer' ) ) ]
then output: Catalogues only allowed in I18n transformer
Context : “//map:transformer/map:untranslated-text
If condition “parent::*[ not( contains( @src, 'I18nTransformer' ) ) ]
then output: Catalogue elements only allowed in I18n transformer
interleave
optional
optional
<define name="I18nTransformer.contents">
   <sch:pattern name="Catalogue elements only allowed within I18n transformer">
      <sch:rule context="//map:transformer/map:catalogues">
         <sch:report test="parent::*[ not( contains( @src, 'I18nTransformer' ) ) ]">Catalogues only allowed in I18n transformer</sch:report>
      </sch:rule>
      <sch:rule context="//map:transformer/map:untranslated-text">
         <sch:report test="parent::*[ not( contains( @src, 'I18nTransformer' ) ) ]">Catalogue elements only allowed in I18n transformer</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <optional>
         <ref name="I18n.catalogues"/>
      </optional>
      <optional>
         <ref name="I18n.untranslated-text"/>
      </optional>
   </interleave>
</define>
define : I18n.catalogues
element : map:catalogues
attribute : default
zeroOrMore
<define name="I18n.catalogues">
   <element name="map:catalogues">
      <attribute name="default"/>
      <zeroOrMore>
         <ref name="I18n.catalogue"/>
      </zeroOrMore>
   </element>
</define>
define : I18n.catalogue
element : map:catalogue
attribute : id
attribute : name
attribute : location
<define name="I18n.catalogue">
   <element name="map:catalogue">
      <attribute name="id"/>
      <attribute name="name"/>
      <attribute name="location"/>
   </element>
</define>
define : I18n.untranslated-text
element : map:untranslated-text
Any text
<define name="I18n.untranslated-text">
   <element name="map:untranslated-text">
      <text/>
   </element>
</define>
transformer.instance — Warning! not used within this schema file.
define : transformer.instance
Schematron
PageHit parameters only allowed within PageHitTransformer
Context : “//map:transformer
If condition “*[ not( contains( @type, 'scss' ) ) ] and *[ @src ]
then output: Must contain src
element : map:transform
optional
refcomponents.attribute.label
optional
refcomponents.attribute.type
optional
refcomponents.attribute.src
zeroOrMore
refcommon.element.parameter
<define name="transformer.instance">
   <sch:pattern name="PageHit parameters only allowed within PageHitTransformer">
      <sch:rule context="//map:transformer">
         <sch:report test="*[ not( contains( @type, 'scss' ) ) ] and *[ @src ]">Must contain src</sch:report>
      </sch:rule>
   </sch:pattern>
   <element name="map:transform">
      <optional>
         <ref name="components.attribute.label"/>
      </optional>
      <optional>
         <ref name="components.attribute.type"/>
      </optional>
      <optional>
         <ref name="components.attribute.src"/>
      </optional>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </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.