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="components.selectors"> <element name="map:selectors"> <attribute name="default"> <ref name="data.componentName"/> </attribute> <zeroOrMore> <ref name="selectors.selector"/> </zeroOrMore> </element> </define>
<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 names</sch:assert> </sch:rule> </sch:pattern> <element name="map:selector"> <attribute name="name"/> <attribute name="src"> <choice> <value>resource://lib/selection/BrowserSelector</value> <value>resource://lib/selection/RequestParameterSelector</value> <value>resource://lib/selection/MobileSelector</value> <value>resource://lib/selection/RegexpSelector</value> <value>resource://lib/selection/VariableSelector</value> <value>resource://lib/selection/ResourceExistsSelector</value> </choice> </attribute> <interleave> <optional> <ref name="BrowserSelector.contents"/> </optional> <optional> <ref name="RequestParameterSelector.contents"/> </optional> </interleave> </element> </define>
<define name="BrowserSelector.contents"> <sch:pattern name="browser elements only allowed within BrowserSelector"> <sch:rule context="//*[ local-name() = 'map: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 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="map:browser"> <attribute name="name"/> <attribute name="useragent"> <ref name="browser.userAgents"/> </attribute> </element> </define>
<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 name="RequestParameterSelector.contents"> <sch:pattern name="parameter-name elements only allowed within RequestParameterSelector"> <sch:rule context="//*[ local-name() = 'parameter-name' ]"> <sch:report test="parent::*[ contains( @src, 'RegexpSelector' ) or contains( @src, 'VariableSelector' ) or contains( @src, 'MobileSelector' ) or contains( @src, 'ResourceExistsSelector' ) ] ">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 name="selector.instance"> <element name="map:select"> <attribute name="type"/> <optional> <ref name="common.element.parameter"/> </optional> <oneOrMore> <ref name="selector.when"/> </oneOrMore> <ref name="selector.otherwise"/> </element> </define>
<define name="selector.when"> <element name="map:when"> <attribute name="test"/> <ref name="pipeline.select"/> </element> </define>
<define name="selector.otherwise"> <element name="map:otherwise"> <optional> <ref name="pipeline.select"/> </optional> </element> </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.