RELAX NG Schema for Paloose Sitemaps
Author: Hugh Field-Richards
Date: 2011-08-03T12:15
WARNING! This schema uses ANY type elements. This is dangerous: it allows anything to appear within the elements. The cost of this generality is the dismantling of the structure. Because any element is allowed it is impossible to validate formally the structure of the document. See Goldfarb (The SGML Handbook): "An element type that has an ANY content specification is completely unstructured."

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

Sitemap Root

Schema Root
start
refmap.sitemap
<start>
   <ref name="map.sitemap"/>
</start>

Sitemap Structure

The Paloose site has a similar structure to the Cocoon one, just less of it.

define : map.sitemap
element : map:sitemap
interleave
refmap.views
refmap.flows
<define name="map.sitemap">
   <element name="map:sitemap">
      <ref name="map.components"/>
      <interleave>
         <ref name="map.resources"/>
         <ref name="map.views"/>
         <ref name="map.flows"/>
      </interleave>
      <ref name="map.pipelines"/>
   </element>
</define>

Components

The components definition defines what component that this sitemap requires.

define : map.components
element : map:components
interleave
zeroOrMore
zeroOrMore
zeroOrMore
zeroOrMore
zeroOrMore
zeroOrMore
zeroOrMore
<define name="map.components">
   <element name="map:components">
      <ref name="components.attribute.default"/>
      <interleave>
         <zeroOrMore>
            <ref name="components.generators"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="components.transformers"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="components.serializers"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="components.matchers"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="components.readers"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="components.selectors"/>
         </zeroOrMore>
         <zeroOrMore>
            <ref name="components.actions"/>
         </zeroOrMore>
      </interleave>
   </element>
</define>

All components definition have an associated default for use in the pipeline.

define : components.attribute.default
attribute : default
<define name="components.attribute.default">
   <attribute name="default">
      <ref name="data.componentName"/>
   </attribute>
</define>

All component instances may have an associated label (for views).

define : components.attribute.label
attribute : label
<define name="components.attribute.label">
   <attribute name="label">
      <ref name="data.componentLabel"/>
   </attribute>
</define>

All aggregation instances may have an associated element attribute.

define : components.attribute.element
attribute : element
<define name="components.attribute.element">
   <attribute name="element">
      <ref name="data.elementName"/>
   </attribute>
</define>

All component instances may have an associated type.

define : components.attribute.type
attribute : type
<define name="components.attribute.type">
   <attribute name="type">
      <ref name="data.componentName"/>
   </attribute>
</define>

All component declarations must have an associated source (PHP5 source file).

define : components.attribute.src
attribute : src
<define name="components.attribute.src">
   <attribute name="src">
      <ref name="data.sourceFileName"/>
   </attribute>
</define>

All component instances must have an associated type.

define : components.attribute.strip-root
attribute : strip-root
<define name="components.attribute.strip-root">
   <attribute name="strip-root">
      <ref name="common.trueFalseEnum"/>
   </attribute>
</define>

Some but not all components can be cached.

define : component.attribute.cachable
attribute : cachable
<define name="component.attribute.cachable">
   <attribute name="cachable">
      <ref name="common.trueFalseEnum"/>
   </attribute>
</define>

Some but not compoents can be instructed to use the request paratemers.

define : component.use-request-parameters
element : map:use-request-parameters
<define name="component.use-request-parameters">
   <element name="map:use-request-parameters">
      <ref name="common.trueFalseEnum"/>
   </element>
</define>

Each component has the following set of attributes.

define : component.attributes.common
attribute : name
attribute : src
<define name="component.attributes.common">
   <attribute name="name">
      <ref name="data.componentName"/>
   </attribute>
   <attribute name="src">
      <ref name="data.sourceFileName"/>
   </attribute>
</define>

Pipeline Definitions

define : map.pipelines
element : map:pipelines
interleave
oneOrMore
<define name="map.pipelines">
   <element name="map:pipelines">
      <interleave>
         <optional>
            <ref name="pipelines.component-configurations"/>
         </optional>
         <oneOrMore>
            <ref name="pipelines.pipeline"/>
         </oneOrMore>
      </interleave>
   </element>
</define>
define : pipelines.pipeline
element : map:pipeline
attribute : internal-only
interleave
oneOrMore
optional
<define name="pipelines.pipeline">
   <element name="map:pipeline">
      <attribute name="internal-only">
         <ref name="common.trueFalseEnum"/>
      </attribute>
      <interleave>
         <oneOrMore>
            <ref name="matcher.instance"/>
         </oneOrMore>
         <optional>
            <ref name="pipelines.handle-errors"/>
         </optional>
      </interleave>
   </element>
</define>
define : pipelines.component-configurations
element : map:component-configurations
interleave
optional
<define name="pipelines.component-configurations">
   <element name="map:component-configurations">
      <interleave>
         <optional>
            <ref name="pipelines.authentication-manager"/>
         </optional>
         <optional>
            <ref name="pipelines.global-variables"/>
         </optional>
      </interleave>
   </element>
</define>
define : pipelines.authentication-manager
element : map:authentication-manager
interleave
zeroOrMore
<define name="pipelines.authentication-manager">
   <element name="map:authentication-manager">
      <interleave>
         <zeroOrMore>
            <ref name="pipelines.handlers"/>
         </zeroOrMore>
      </interleave>
   </element>
</define>
define : pipelines.global-variables
element : map:global-variables
zeroOrMore
element
Any text
<define name="pipelines.global-variables">
   <element name="map:global-variables">
      <zeroOrMore>
         <element>
            <anyName/>
            <text/>
         </element>
      </zeroOrMore>
   </element>
</define>
define : pipelines.handlers
element : map:handlers
interleave
oneOrMore
<define name="pipelines.handlers">
   <element name="map:handlers">
      <interleave>
         <oneOrMore>
            <ref name="pipelines.handler"/>
         </oneOrMore>
      </interleave>
   </element>
</define>
define : pipelines.handler
element : map:handler
attribute : name
element : map:authentication
attribute : uri
<define name="pipelines.handler">
   <element name="map:handler">
      <attribute name="name"/>
      <ref name="resource.redirect-to"/>
      <element name="map:authentication">
         <attribute name="uri"/>
      </element>
   </element>
</define>
define : pipelines.handle-errors
element : map:handle-errors
interleave
oneOrMore
<define name="pipelines.handle-errors">
   <element name="map:handle-errors">
      <interleave>
         <oneOrMore>
            <ref name="pipeline.matcher"/>
         </oneOrMore>
      </interleave>
   </element>
</define>

Pipelines used in matchers

There is no sensible way of providing restictions on the pipeline ordering in RELAX-NG. I have had to resort to Schematron rules to do this. Oh for DSD-2, which can do this with no problem at all.

define : pipeline.matcher
Schematron
Check position of pipeline elements
Context : “map:generate
If condition “count( preceding-sibling::* ) > 0 and not ( preceding-sibling::map:parameter )
then output: Generate element must be first in the pipeline
Context : “map:aggregate
If condition “count( preceding-sibling::* ) > 0 and not( preceding-sibling::map:act ) and not ( preceding-sibling::map:parameter )
then output: Aggregate element must be first in the pipeline
Context : “map:call
If condition “count( following-sibling::* ) > 0
then output: call element must be last in the pipeline
Context : “map:redirect-to
If condition “count( following-sibling::* ) > 0 and not( parent::map:handler )
then output: redirect-to element must be last in the pipeline
Context : “map:read
If condition “count( preceding-sibling::* ) > 0 and count( following-sibling::* ) > 0
then output: Read element must be only element in the pipeline
Context : “map:mount
If condition “count( preceding-sibling::* ) > 0 and count( following-sibling::* ) > 0
then output: Mount element must be only element in the pipeline
<define name="pipeline.matcher">
   <sch:pattern name="Check position of pipeline elements">
      <sch:rule context="map:generate">
         <sch:report test="count( preceding-sibling::* ) > 0                and not ( preceding-sibling::map:parameter )">Generate element must be first in the pipeline</sch:report>
      </sch:rule>
      <sch:rule context="map:aggregate">
         <sch:report test="count( preceding-sibling::* ) > 0                and not( preceding-sibling::map:act )                and not ( preceding-sibling::map:parameter )">Aggregate element must be first in the pipeline</sch:report>
      </sch:rule>
      <sch:rule context="map:call">
         <sch:report test="count( following-sibling::* ) > 0">call element must be last in the pipeline</sch:report>
      </sch:rule>
      <sch:rule context="map:redirect-to">
         <sch:report test="count( following-sibling::* ) > 0                and not( parent::map:handler )">redirect-to element must be last in the pipeline</sch:report>
      </sch:rule>
      <sch:rule context="map:read">
         <sch:report test="count( preceding-sibling::* ) > 0 and count( following-sibling::* ) > 0">Read element must be only element in the pipeline</sch:report>
      </sch:rule>
      <sch:rule context="map:mount">
         <sch:report test="count( preceding-sibling::* ) > 0 and count( following-sibling::* ) > 0">Mount element must be only element in the pipeline</sch:report>
      </sch:rule>
   </sch:pattern>
   <zeroOrMore>
      <interleave>
         <ref name="generator.instance"/>
         <ref name="action.instance"/>
         <ref name="resource.mount"/>
         <ref name="resource.call"/>
         <ref name="selector.instance"/>
         <ref name="aggregate.instance"/>
         <ref name="transformer.instance"/>
         <ref name="serializer.instance"/>
         <ref name="resource.redirect-to"/>
         <ref name="reader.instance"/>
      </interleave>
   </zeroOrMore>
</define>
define : pipeline.select
<define name="pipeline.select">
   <interleave>
      <ref name="generator.instance"/>
      <ref name="transformer.instance"/>
      <ref name="serializer.instance"/>
      <ref name="resource.call"/>
      <ref name="resource.mount"/>
      <ref name="reader.instance"/>
      <ref name="selector.instance"/>
   </interleave>
</define>
define : pipeline.views
interleave
<define name="pipeline.views">
   <interleave>
      <ref name="transformer.instance"/>
      <ref name="serializer.instance"/>
      <ref name="resource.call"/>
   </interleave>
</define>

Generators

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

define : components.generators
element : map:generators
zeroOrMore
<define name="components.generators">
   <element name="map:generators">
      <ref name="components.attribute.default"/>
      <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
<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
<define name="FileGenerator.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : PXTemplateGenerator.contents
interleave
<define name="PXTemplateGenerator.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : DirectoryGenerator.contents
interleave
<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
zeroOrMore
<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
zeroOrMore
<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).

define : generator.instance
element : map:generate
optional
optional
zeroOrMore
<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

Aggregations only appear as pipeline instances.

define : aggregate.instance
element : map:aggregate
optional
oneOrMore
<define name="aggregate.instance">
   <element name="map:aggregate">
      <optional>
         <ref name="components.attribute.label"/>
      </optional>
      <ref name="components.attribute.element"/>
      <oneOrMore>
         <ref name="aggregate.part"/>
      </oneOrMore>
   </element>
</define>
define : aggregate.part
element : map:part
oneOrMore
<define name="aggregate.part">
   <element name="map:part">
      <optional>
         <ref name="components.attribute.strip-root"/>
      </optional>
      <ref name="components.attribute.src"/>
      <ref name="components.attribute.element"/>
      <oneOrMore>
         <ref name="aggregate.part"/>
      </oneOrMore>
   </element>
</define>
define : components.transformers
element : map:transformers
zeroOrMore
<define name="components.transformers">
   <element name="map:transformers">
      <ref name="components.attribute.default"/>
      <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"/>
      <ref name="component.attribute.cachable"/>
      <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"/>
   </element>
</define>
define : TRAXTransformer.contents
interleave
<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
zeroOrMore
<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
zeroOrMore
<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
<define name="LogTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : XIncludeTransformer.contents
interleave
zeroOrMore
<define name="XIncludeTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : PasswordTransformer.contents
interleave
zeroOrMore
<define name="PasswordTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : SourceWritingTransformer.contents
interleave
zeroOrMore
<define name="SourceWritingTransformer.contents">
   <interleave>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </interleave>
</define>
define : FilterTransformer.contents
interleave
<define name="FilterTransformer.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : EntityTransformer.contents
interleave
<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
<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
<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>
      <ref name="I18n.catalogues"/>
      <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>
define : transformer.instance
element : map:transform
optional
optional
zeroOrMore
<define name="transformer.instance">
   <element name="map:transform">
      <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>
define : components.selectors
element : map:selectors
zeroOrMore
<define name="components.selectors">
   <element name="map:selectors">
      <ref name="components.attribute.default"/>
      <zeroOrMore>
         <ref name="selectors.selector"/>
      </zeroOrMore>
   </element>
</define>
define : selectors.selector
Schematron
Check the identities are unique within a category
Context : “map:selector
if not condition “count(//map:selector[@name = current()/@name]) = 1
then output: There should be unique selector IDs
<define name="selectors.selector">
   <sch:pattern name="Check the identities are unique within a category">
      <sch:rule context="map:selector">
         <sch:assert test="count(//map:selector[@name = current()/@name]) = 1">There should be unique selector IDs</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:selector">
      <ref name="component.attributes.common"/>
      <ref name="BrowserSelector.contents"/>
      <ref name="RequestParameterSelector.contents"/>
   </element>
</define>
define : BrowserSelector.contents
Schematron
browser elements only allowed within BrowserSelector
Context : “//*[ local-name() = 'browser' ]
If condition “parent::*[ not( contains( @src, 'BrowserSelector' ) ) ]
then output: browser element only allowed in BrowserSelector
interleave
zeroOrMore
<define name="BrowserSelector.contents">
   <sch:pattern name="browser elements only allowed within BrowserSelector">
      <sch:rule context="//*[ local-name() = 'browser' ]">
         <sch:report test="parent::*[ not( contains( @src, 'BrowserSelector' ) ) ]">browser element only allowed in BrowserSelector</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <zeroOrMore>
         <ref name="selector.browser"/>
      </zeroOrMore>
   </interleave>
</define>
define : RequestParameterSelector.contents
Schematron
parameter-name elements only allowed within RequestParameterSelector
Context : “//*[ local-name() = 'parameter-name' ]
If condition “parent::*[ not( contains( @src, 'RequestParameterSelector' ) ) ]
then output: parameter-name element only allowed in RequestParameterSelector
interleave
zeroOrMore
element : map:parameter-name
Any text
<define name="RequestParameterSelector.contents">
   <sch:pattern name="parameter-name elements only allowed within RequestParameterSelector">
      <sch:rule context="//*[ local-name() = 'parameter-name' ]">
         <sch:report test="parent::*[ not( contains( @src, 'RequestParameterSelector' ) ) ]">parameter-name element only allowed in RequestParameterSelector</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <zeroOrMore>
         <element name="map:parameter-name">
            <text/>
         </element>
      </zeroOrMore>
   </interleave>
</define>
define : selector.browser
Schematron
Check the names of browsers are unique
Context : “browser
if not condition “count(//browser[@useragent = current()/@useragent]) = 1
then output: There should be unique user agent names
element : browser
optional
attribute : name
Any text
optional
attribute : class
Any text
optional
attribute : unroll
attribute : useragent
<define name="selector.browser">
   <sch:pattern name="Check the names of browsers are unique">
      <sch:rule context="browser">
         <sch:assert test="count(//browser[@useragent = current()/@useragent]) = 1">There should be unique user agent names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="browser">
      <optional>
         <attribute name="name">
            <text/>
         </attribute>
      </optional>
      <optional>
         <attribute name="class">
            <text/>
         </attribute>
      </optional>
      <optional>
         <attribute name="unroll">
            <ref name="common.trueFalseEnum"/>
         </attribute>
      </optional>
      <attribute name="useragent">
         <ref name="browser.userAgents"/>
      </attribute>
   </element>
</define>
define : browser.userAgents
choice
value = "MSIE"
value = "MSPIE"
value = "HandHTTP"
value = "AvantGo"
value = "DoCoMo"
value = "Opera"
value = "Lynx"
value = "Java"
value = "Nokia"
value = "UP"
value = "Wapalizer"
value = "Mozilla/5"
value = "Netscape6/"
value = "Mozilla"
value = "Safari"
value = "iPhone"
<define name="browser.userAgents">
   <choice>
      <value>MSIE</value>
      <value>MSPIE</value>
      <value>HandHTTP</value>
      <value>AvantGo</value>
      <value>DoCoMo</value>
      <value>Opera</value>
      <value>Lynx</value>
      <value>Java</value>
      <value>Nokia</value>
      <value>UP</value>
      <value>Wapalizer</value>
      <value>Mozilla/5</value>
      <value>Netscape6/</value>
      <value>Mozilla</value>
      <value>Safari</value>
      <value>iPhone</value>
   </choice>
</define>
define : selector.instance
element : map:select
optional
attribute : type
attribute : src
zeroOrMore
oneOrMore
optional
<define name="selector.instance">
   <element name="map:select">
      <optional>
         <attribute name="type"/>
      </optional>
      <attribute name="src"/>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
      <oneOrMore>
         <ref name="selector.when"/>
      </oneOrMore>
      <optional>
         <ref name="selector.otherwise"/>
      </optional>
   </element>
</define>
define : selector.when
element : map:when
attribute : test
<define name="selector.when">
   <element name="map:when">
      <attribute name="test"/>
      <ref name="pipeline.select"/>
   </element>
</define>
define : selector.otherwise
element : map:otherwise
attribute : test
<define name="selector.otherwise">
   <element name="map:otherwise">
      <attribute name="test"/>
      <ref name="pipeline.select"/>
   </element>
</define>
define : components.serializers
element : map:serializers
zeroOrMore
<define name="components.serializers">
   <element name="map:serializers">
      <ref name="components.attribute.default"/>
      <zeroOrMore>
         <ref name="serializers.serializer"/>
      </zeroOrMore>
   </element>
</define>
define : serializers.serializer
Schematron
Check the serializer names are unique
Context : “map:serializer
if not condition “count(//map:serializer[@name = current()/@name]) = 1
then output: There should be unique serializer names
element : map:serializer
attribute : mime-type
<define name="serializers.serializer">
   <sch:pattern name="Check the serializer names are unique">
      <sch:rule context="map:serializer">
         <sch:assert test="count(//map:serializer[@name = current()/@name]) = 1">There should be unique serializer names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:serializer">
      <ref name="component.attributes.common"/>
      <ref name="component.attribute.cachable"/>
      <attribute name="mime-type"/>
      <ref name="XMLSerializer.contents"/>
      <ref name="TextSerializer.contents"/>
      <ref name="HTMLSerializer.contents"/>
      </>
   </element>
</define>
define : XMLSerializer.contents
interleave
<define name="XMLSerializer.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : TextSerializer.contents
interleave
<define name="TextSerializer.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : HTMLSerializer.contents
Schematron
doctype-public elements only allowed within HTMLSerializer
Context : “//*[ local-name() = 'doctype-public' ]
If condition “parent::*[ contains( @src, 'TextSerializer' ) ]
then output: doctype-public not allowed in TextSerializer
Context : “//*[ local-name() = 'doctype-system' ]
If condition “parent::*[ contains( @src, 'TextSerializer' ) ]
then output: doctype-public not allowed in TextSerializer
Context : “//*[ local-name() = 'encoding' ]
If condition “parent::*[ contains( @src, 'TextSerializer' ) ]
then output: doctype-public not allowed in TextSerializer
interleave
optional
<define name="HTMLSerializer.contents">
   <sch:pattern name="doctype-public elements only allowed within HTMLSerializer">
      <sch:rule context="//*[ local-name() = 'doctype-public' ]">
         <sch:report test="parent::*[ contains( @src, 'TextSerializer' ) ]">doctype-public not allowed in TextSerializer</sch:report>
      </sch:rule>
      <sch:rule context="//*[ local-name() = 'doctype-system' ]">
         <sch:report test="parent::*[ contains( @src, 'TextSerializer' ) ]">doctype-public not allowed in TextSerializer</sch:report>
      </sch:rule>
      <sch:rule context="//*[ local-name() = 'encoding' ]">
         <sch:report test="parent::*[ contains( @src, 'TextSerializer' ) ]">doctype-public not allowed in TextSerializer</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <optional>
         <ref name="HTMLSerializer.doctype-public"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.doctype-system"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.encoding"/>
      </optional>
   </interleave>
</define>
XHTMLSerializer.contents — Warning! not used within this schema file.
define : XHTMLSerializer.contents
interleave
optional
<define name="XHTMLSerializer.contents">
   <interleave>
      <optional>
         <ref name="HTMLSerializer.doctype-public"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.doctype-system"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.encoding"/>
      </optional>
   </interleave>
</define>
define : HTMLSerializer.doctype-public
element : doctype-public
Any text
<define name="HTMLSerializer.doctype-public">
   <element name="doctype-public">
      <text/>
   </element>
</define>
define : HTMLSerializer.doctype-system
element : doctype-system
Any text
<define name="HTMLSerializer.doctype-system">
   <element name="doctype-system">
      <text/>
   </element>
</define>
define : HTMLSerializer.encoding
element : encoding
Any text
<define name="HTMLSerializer.encoding">
   <element name="encoding">
      <text/>
   </element>
</define>
define : serializer.instance
element : map:serialize
optional
attribute : type
<define name="serializer.instance">
   <element name="map:serialize">
      <optional>
         <attribute name="type"/>
      </optional>
   </element>
</define>
define : components.matchers
element : map:matchers
zeroOrMore
<define name="components.matchers">
   <element name="map:matchers">
      <ref name="components.attribute.default"/>
      <zeroOrMore>
         <ref name="matchers.matcher"/>
      </zeroOrMore>
   </element>
</define>
define : matchers.matcher
Schematron
Check the matcher names are unique
Context : “map:matcher
if not condition “count(//map:matcher[@name = current()/@name]) = 1
then output: There should be unique matcher names
element : map:matcher
attribute : mime-type
<define name="matchers.matcher">
   <sch:pattern name="Check the matcher names are unique">
      <sch:rule context="map:matcher">
         <sch:assert test="count(//map:matcher[@name = current()/@name]) = 1">There should be unique matcher names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:matcher">
      <ref name="component.attributes.common"/>
      <ref name="component.attribute.cachable"/>
      <attribute name="mime-type"/>
      <ref name="WildcardURIMatcher.contents"/>
      <ref name="RegexpURIMatcher.contents"/>
   </element>
</define>
define : WildcardURIMatcher.contents
interleave
<define name="WildcardURIMatcher.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : RegexpURIMatcher.contents
interleave
<define name="RegexpURIMatcher.contents">
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : matcher.instance
element : map:match
attribute : pattern
attribute : type
choice
value = "regexp"
value = "wildcard"
<define name="matcher.instance">
   <element name="map:match">
      <attribute name="pattern"/>
      <attribute name="type">
         <choice>
            <value>regexp</value>
            <value>wildcard</value>
         </choice>
      </attribute>
      <ref name="pipeline.matcher"/>
   </element>
</define>
define : components.readers
element : map:readers
zeroOrMore
<define name="components.readers">
   <element name="map:readers">
      <ref name="components.attribute.default"/>
      <zeroOrMore>
         <ref name="readers.reader"/>
      </zeroOrMore>
   </element>
</define>
define : readers.reader
Schematron
Check the reader names are unique
Context : “map:reader
if not condition “count(//map:reader[@name = current()/@name]) = 1
then output: There should be unique reader names
element : map:reader
<define name="readers.reader">
   <sch:pattern name="Check the reader names are unique">
      <sch:rule context="map:reader">
         <sch:assert test="count(//map:reader[@name = current()/@name]) = 1">There should be unique reader names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:reader">
      <ref name="component.attributes.common"/>
      <ref name="reader.contents"/>
   </element>
</define>
define : reader.contents
empty
<define name="reader.contents">
   <empty/>
</define>
define : reader.instance
element : read
empty
<define name="reader.instance">
   <element name="read" ns="http://apache.org/cocoon/sitemap/1.0">
      <ref name="components.attribute.src"/>
      <empty/>
   </element>
</define>
define : map.resources
element : resources
zeroOrMore
<define name="map.resources">
   <element name="resources" ns="http://apache.org/cocoon/sitemap/1.0">
      <zeroOrMore>
         <ref name="resources.resource"/>
      </zeroOrMore>
   </element>
</define>
define : resources.resource
element : map:resource
attribute : name
<define name="resources.resource">
   <element name="map:resource">
      <attribute name="name"/>
      <ref name="pipeline.matcher"/>
   </element>
</define>
define : map.flows
element : map:flow
attribute : language
zeroOrMore
<define name="map.flows">
   <element name="map:flow">
      <attribute name="language">
         <ref name="data.language"/>
      </attribute>
      <zeroOrMore>
         <ref name="resources.script"/>
      </zeroOrMore>
   </element>
</define>
define : resources.script
Schematron
Check whether attributes are not null
Context : “map:script
If condition “@src = ''
then output: Cannot have null src attribute in script element
element : map:script
attribute : src
empty
<define name="resources.script">
   <sch:pattern name="Check whether attributes are not null">
      <sch:rule context="map:script">
         <sch:report test="@src = ''">Cannot have null src attribute in script element</sch:report>
      </sch:rule>
   </sch:pattern>
   <element name="map:script">
      <attribute name="src">
         <ref name="data.sourceFileName"/>
      </attribute>
      <empty/>
   </element>
</define>

Call Resource

Schematron
Check whether corresponding resource for call
Context : “//map:call
if not condition “@resource or @function
then output: Must have resource or function attribute
Context : “//map:call
If condition “@resource and @function
then output: Cannot have resource and function attribute
define : resource.call
element : call
choice
attribute : resource
attribute : function
empty
<define name="resource.call">
   <element name="call" ns="http://apache.org/cocoon/sitemap/1.0">
      <choice>
         <attribute name="resource">
            <ref name="data.componentName"/>
         </attribute>
         <attribute name="function"/>
      </choice>
      <empty/>
   </element>
</define>
define : resource.redirect-to
Schematron
Check whether attributes are not null
Context : “map:redirect-to
If condition “@uri = ''
then output: Cannot have null uri attribute in redirect-to element
element : map:redirect-to
attribute : uri
data : anyURI
empty
<define name="resource.redirect-to">
   <sch:pattern name="Check whether attributes are not null">
      <sch:rule context="map:redirect-to">
         <sch:report test="@uri = ''">Cannot have null uri attribute in redirect-to element</sch:report>
      </sch:rule>
   </sch:pattern>
   <element name="map:redirect-to">
      <attribute name="uri">
         <data type="anyURI"/>
      </attribute>
      <empty/>
   </element>
</define>
define : resource.mount
element : map:mount
attribute : src
Any text
optional
attribute : uri-prefix
data : string
empty
<define name="resource.mount">
   <element name="map:mount">
      <attribute name="src">
         <text/>
      </attribute>
      <optional>
         <attribute name="uri-prefix">
            <data type="string"/>
         </attribute>
      </optional>
      <empty/>
   </element>
</define>
define : map.views
element : map:views
zeroOrMore
refviews.view
<define name="map.views">
   <element name="map:views">
      <zeroOrMore>
         <ref name="views.view"/>
      </zeroOrMore>
   </element>
</define>
define : views.view
element : map:view
attribute : name
attribute : from-label
<define name="views.view">
   <element name="map:view">
      <attribute name="name"/>
      <attribute name="from-label"/>
      <ref name="pipeline.views"/>
   </element>
</define>
define : components.actions
element : map:actions
zeroOrMore
<define name="components.actions">
   <element name="map:actions">
      <ref name="components.attribute.default"/>
      <zeroOrMore>
         <ref name="actions.action"/>
      </zeroOrMore>
   </element>
</define>

Actions

define : actions.action
Schematron
Check the action names are unique
Context : “map:action
if not condition “count(//map:action[@name = current()/@name]) = 1
then output: There should be unique action names
<define name="actions.action">
   <sch:pattern name="Check the action names are unique">
      <sch:rule context="map:action">
         <sch:assert test="count(//map:action[@name = current()/@name]) = 1">There should be unique action names</sch:assert>
      </sch:rule>
   </sch:pattern>
   <element name="map:action">
      <ref name="component.attributes.common"/>
      <ref name="CookiesAction.contents"/>
      <ref name="SendMailAction.contents"/>
      <ref name="AuthAction.contents"/>
      <ref name="LoginAction.contents"/>
      <ref name="LogoutAction.contents"/>
   </element>
</define>
define : CookiesAction.contents
interleave
zeroOrMore
<define name="CookiesAction.contents">
   <interleave>
      <zeroOrMore>
         <ref name="CookiesAction.parameters"/>
      </zeroOrMore>
   </interleave>
   <ref name="pipeline.matcher"/>
</define>
define : CookiesAction.parameters
Schematron
smtp elements only allowed within CookiesAction
Context : “//*[ local-name() = 'default-cookies-name' ]
If condition “parent::*[ not( contains( @src, 'CookiesAction' ) ) ]
then output: default-cookies-name only allowed in CookiesAction
Schematron
Only one of CookiesAction nested elements allowed of each type
Context : “//map:action[ contains( @src, 'CookiesAction' ) ]
If condition “count( default-cookies-name ) > 1
then output: Only 1 default-cookies-name element allowed here
interleave
element : default-cookies-name
Any text
<define name="CookiesAction.parameters">
   <sch:pattern name="smtp elements only allowed within CookiesAction">
      <sch:rule context="//*[ local-name() = 'default-cookies-name' ]">
         <sch:report test="parent::*[ not( contains( @src, 'CookiesAction' ) ) ]">default-cookies-name only allowed in CookiesAction</sch:report>
      </sch:rule>
   </sch:pattern>
   <sch:pattern name="Only one of CookiesAction nested elements allowed of each type">
      <sch:rule context="//map:action[ contains( @src, 'CookiesAction' ) ]">
         <sch:report test="count( default-cookies-name ) > 1">Only 1 default-cookies-name element allowed here</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <element name="default-cookies-name">
         <text/>
      </element>
   </interleave>
</define>
define : SendMailAction.contents
interleave
zeroOrMore
<define name="SendMailAction.contents">
   <interleave>
      <zeroOrMore>
         <ref name="SendMailAction.parameters"/>
      </zeroOrMore>
   </interleave>
   <ref name="pipeline.matcher"/>
</define>
define : SendMailAction.parameters
Schematron
smtp elements only allowed within SendMailAction
Context : “//*[ local-name() = 'smtp-host' ]
If condition “parent::*[ not( contains( @src, 'SendMailAction' ) ) ]
then output: smtp-host only allowed in SendMailAction
Context : “//*[ local-name() = 'smtp-user' ]
If condition “parent::*[ not( contains( @src, 'SendMailAction' ) ) ]
then output: smtp-user only allowed in SendMailAction
Context : “//*[ local-name() = 'smtp-password' ]
If condition “parent::*[ not( contains( @src, 'SendMailAction' ) ) ]
then output: smtp-password only allowed in SendMailAction
Schematron
Only one of SendMailAction nested elements allowed of each type
Context : “//map:action[ contains( @src, 'SendMailAction' ) ]
If condition “count( smtp-host ) > 1
then output: Only 1 smtp-host element allowed here
Context : “//map:action[ contains( @src, 'SendMailAction' ) ]
If condition “count( smtp-user ) > 1
then output: Only 1 smtp-user element allowed here
Context : “//map:action[ contains( @src, 'SendMailAction' ) ]
If condition “count( smtp-password ) > 1
then output: Only 1 smtp-password element allowed here
interleave
element : smtp-host
Any text
element : smtp-user
Any text
element : smtp-password
Any text
<define name="SendMailAction.parameters">
   <sch:pattern name="smtp elements only allowed within SendMailAction">
      <sch:rule context="//*[ local-name() = 'smtp-host' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SendMailAction' ) ) ]">smtp-host only allowed in SendMailAction</sch:report>
      </sch:rule>
      <sch:rule context="//*[ local-name() = 'smtp-user' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SendMailAction' ) ) ]">smtp-user only allowed in SendMailAction</sch:report>
      </sch:rule>
      <sch:rule context="//*[ local-name() = 'smtp-password' ]">
         <sch:report test="parent::*[ not( contains( @src, 'SendMailAction' ) ) ]">smtp-password only allowed in SendMailAction</sch:report>
      </sch:rule>
   </sch:pattern>
   <sch:pattern name="Only one of SendMailAction nested elements allowed of each type">
      <sch:rule context="//map:action[ contains( @src, 'SendMailAction' ) ]">
         <sch:report test="count( smtp-host ) > 1">Only 1 smtp-host element allowed here</sch:report>
      </sch:rule>
      <sch:rule context="//map:action[ contains( @src, 'SendMailAction' ) ]">
         <sch:report test="count( smtp-user ) > 1">Only 1 smtp-user element allowed here</sch:report>
      </sch:rule>
      <sch:rule context="//map:action[ contains( @src, 'SendMailAction' ) ]">
         <sch:report test="count( smtp-password ) > 1">Only 1 smtp-password element allowed here</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <element name="smtp-host">
         <text/>
      </element>
      <element name="smtp-user">
         <text/>
      </element>
      <element name="smtp-password">
         <text/>
      </element>
   </interleave>
</define>
define : AuthAction.contents
Schematron
doctype-public elements only allowed within HTMLSerializer
Context : “//*[ local-name() = 'doctype-public' ]
If condition “parent::*[ contains( @src, 'TextSerializer' ) ]
then output: doctype-public not allowed in TextSerializer
Context : “//*[ local-name() = 'doctype-system' ]
If condition “parent::*[ contains( @src, 'TextSerializer' ) ]
then output: doctype-public not allowed in TextSerializer
Context : “//*[ local-name() = 'encoding' ]
If condition “parent::*[ contains( @src, 'TextSerializer' ) ]
then output: doctype-public not allowed in TextSerializer
interleave
<define name="AuthAction.contents">
   <sch:pattern name="doctype-public elements only allowed within HTMLSerializer">
      <sch:rule context="//*[ local-name() = 'doctype-public' ]">
         <sch:report test="parent::*[ contains( @src, 'TextSerializer' ) ]">doctype-public not allowed in TextSerializer</sch:report>
      </sch:rule>
      <sch:rule context="//*[ local-name() = 'doctype-system' ]">
         <sch:report test="parent::*[ contains( @src, 'TextSerializer' ) ]">doctype-public not allowed in TextSerializer</sch:report>
      </sch:rule>
      <sch:rule context="//*[ local-name() = 'encoding' ]">
         <sch:report test="parent::*[ contains( @src, 'TextSerializer' ) ]">doctype-public not allowed in TextSerializer</sch:report>
      </sch:rule>
   </sch:pattern>
   <interleave>
      <optional>
         <ref name="component.use-request-parameters"/>
      </optional>
   </interleave>
</define>
define : LoginAction.contents
interleave
optional
<define name="LoginAction.contents">
   <interleave>
      <optional>
         <ref name="HTMLSerializer.doctype-public"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.doctype-system"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.encoding"/>
      </optional>
   </interleave>
</define>
define : LogoutAction.contents
interleave
optional
<define name="LogoutAction.contents">
   <interleave>
      <optional>
         <ref name="HTMLSerializer.doctype-public"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.doctype-system"/>
      </optional>
      <optional>
         <ref name="HTMLSerializer.encoding"/>
      </optional>
   </interleave>
</define>
define : action.instance
element : map:act
optional
zeroOrMore
<define name="action.instance">
   <element name="map:act">
      <optional>
         <ref name="components.attribute.type"/>
      </optional>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
      <ref name="pipeline.matcher"/>
   </element>
</define>

Common Rules and Definitions for Cocoon Sitemap

Parameter Elements

Some components have an associated parameter of the form:

    <parameter name="quality" type="float" value="0.9"/>
define : common.element.parameter
element : map:parameter
attribute : name
Any text
optional
attribute : type
Any text
attribute : value
Any text
<define name="common.element.parameter">
   <element name="map:parameter">
      <attribute name="name">
         <text/>
      </attribute>
      <optional>
         <attribute name="type">
            <text/>
         </attribute>
      </optional>
      <attribute name="value">
         <text/>
      </attribute>
   </element>
</define>

Boolean Values

common.trueFalseEnum (Combine: choice)
define : common.trueFalseEnum
choice
value = "1"
value = "0"
value = "yes"
value = "no"
value = "true"
value = "false"
<define name="common.trueFalseEnum" combine="choice">
   <choice>
      <value>1</value>
      <value>0</value>
      <value>yes</value>
      <value>no</value>
      <value>true</value>
      <value>false</value>
   </choice>
</define>

Paloose Datatype Definitions

Component Name

define : data.componentName
data : string
param : pattern "[0-9a-zA-Z\.\-]+"
<define name="data.componentName">
   <data type="string">
      <param name="pattern">[0-9a-zA-Z\.\-]+</param>
   </data>
</define>

Pipeline Labels

define : data.componentLabel
data : string
param : pattern "[0-9a-zA-Z\-]+"
<define name="data.componentLabel">
   <data type="string">
      <param name="pattern">[0-9a-zA-Z\-]+</param>
   </data>
</define>

Element Name

define : data.elementName
data : string
param : pattern "[a-zA-Z\-]*:?[a-zA-Z]+[a-zA-Z0-9\-]*"
<define name="data.elementName">
   <data type="string">
      <param name="pattern">[a-zA-Z\-]*:?[a-zA-Z]+[a-zA-Z0-9\-]*</param>
   </data>
</define>

PHP5 Source File

define : data.sourceFileName
data : string
param : pattern "((resource:/)|(context:/)|(cocoon:/)|(/))(\S+/)*(\S+)"
<define name="data.sourceFileName">
   <data type="string">
      <param name="pattern">((resource:/)|(context:/)|(cocoon:/)|(/))(\S+/)*(\S+)</param>
   </data>
</define>

Lamguage Designator

This needs to be expanded.

define : data.language
data : string
param : pattern "\S+"
<define name="data.language">
   <data type="string">
      <param name="pattern">\S+</param>
   </data>
</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.