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.readers — Warning! not used within this schema file.
define  :  components.readers
element  :  map:readers
attribute  :  default
ref  →  data.componentName
zeroOrMore
ref  →  readers.reader
<define name="components.readers">
   <element name="map:readers">
      <attribute name="default">
         <ref name="data.componentName"/>
      </attribute>
      <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
ref  →  component.attributes.common
ref  →  reader.contents
<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>
reader.instance — Warning! not used within this schema file.
define  :  reader.instance
element  :  read
ref  →  components.attribute.src
empty
<define name="reader.instance">
   <element name="read" ns="http://apache.org/cocoon/sitemap/1.0">
      <ref name="components.attribute.src"/>
      <empty/>
   </element>
</define>
map.resources — Warning! not used within this schema file.
define  :  map.resources
element  :  resources
zeroOrMore
ref  →  resources.resource
<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
zeroOrMore
ref  →  transformer.instance
ref  →  serializer.instance
<define name="resources.resource">
   <element name="map:resource">
      <attribute name="name"/>
      <zeroOrMore>
         <ref name="transformer.instance"/>
      </zeroOrMore>
      <ref name="serializer.instance"/>
   </element>
</define>
map.flows — Warning! not used within this schema file.
define  :  map.flows
element  :  map:flow
attribute  :  language
ref  →  data.language
zeroOrMore
ref  →  resources.script
<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
ref  →  data.sourceFileName
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
resource.call — Warning! not used within this schema file.
define  :  resource.call
element  :  map:call
choice
attribute  :  resource
ref  →  data.componentName
attribute  :  function
zeroOrMore
ref  →  common.element.parameter
<define name="resource.call">
   <element name="map:call">
      <choice>
         <attribute name="resource">
            <ref name="data.componentName"/>
         </attribute>
         <attribute name="function"/>
      </choice>
      <zeroOrMore>
         <ref name="common.element.parameter"/>
      </zeroOrMore>
   </element>
</define>
resource.redirect-to — Warning! not used within this schema file.
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
Any text
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">
         <text/>
      </attribute>
      <empty/>
   </element>
</define>
resource.mount — Warning! not used within this schema file.
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>
map.views — Warning! not used within this schema file.
define  :  map.views
element  :  map:views
zeroOrMore
ref  →  views.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
ref  →  pipeline.views
<define name="views.view">
   <element name="map:view">
      <attribute name="name"/>
      <attribute name="from-label"/>
      <ref name="pipeline.views"/>
   </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.