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.
<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 name="pipelines.pipeline"> <element name="map:pipeline"> <optional> <attribute name="internal-only"> <ref name="common.trueFalseEnum"/> </attribute> </optional> <interleave> <oneOrMore> <ref name="matcher.instance"/> </oneOrMore> <optional> <ref name="pipelines.handle-errors"/> </optional> </interleave> </element> </define>
<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 name="pipelines.authentication-manager"> <element name="map:authentication-manager"> <interleave> <zeroOrMore> <ref name="pipelines.handlers"/> </zeroOrMore> </interleave> </element> </define>
<define name="pipelines.global-variables"> <element name="map:global-variables"> <zeroOrMore> <ref name="pipelines.variable"/> </zeroOrMore> </element> </define>
<define name="pipelines.variable"> <element name="map:variable"> <attribute name="name"/> <attribute name="value"/> </element> </define>
<define name="pipelines.handlers"> <element name="map:handlers"> <interleave> <oneOrMore> <ref name="pipelines.handler"/> </oneOrMore> </interleave> </element> </define>
<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 name="pipelines.handle-errors"> <element name="map:handle-errors"> <interleave> <oneOrMore> <ref name="pipeline.matcher"/> </oneOrMore> </interleave> </element> </define>
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 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> <choice> <group> <ref name="resource.mount"/> </group> <group> <ref name="reader.instance"/> </group> <group> <ref name="selector.instance"/> </group> <group> <ref name="action.instance"/> </group> <group> <ref name="resource.redirect-to"/> </group> <group> <choice> <ref name="generator.instance"/> <ref name="aggregate.instance"/> <ref name="action.instance"/> <ref name="selector.instance"/> </choice> <zeroOrMore> <ref name="transformer.instance"/> </zeroOrMore> <choice> <ref name="resource.call"/> <ref name="resource.redirect-to"/> <ref name="serializer.instance"/> </choice> </group> </choice> </define>
<define name="pipeline.select"> <choice> <group> <ref name="resource.mount"/> </group> <group> <ref name="reader.instance"/> </group> <group> <optional> <choice> <ref name="generator.instance"/> <ref name="aggregate.instance"/> </choice> </optional> <interleave> <optional> <ref name="selector.instance"/> </optional> <zeroOrMore> <optional> <ref name="transformer.instance"/> </optional> </zeroOrMore> <optional> <choice> <ref name="resource.call"/> <ref name="resource.redirect-to"/> <ref name="serializer.instance"/> </choice> </optional> </interleave> </group> </choice> </define>
<define name="pipeline.views"> <zeroOrMore> <ref name="transformer.instance"/> </zeroOrMore> <choice> <group> <ref name="resource.call"/> </group> <group> <ref name="serializer.instance"/> </group> </choice> </define>
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.