blob: a4472b8c5632487e6f057af6c2c51d1c64c660a5 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Example sitemap snippets</title>
<link href="http://purl.org/DC/elements/1.0/" rel="schema.DC">
<meta content="Explanations of some sitemaps" name="DC.Subject">
<meta content="David Crossley" name="DC.Creator">
</head>
<body>
<h1>Overview</h1>
<p>
The following explanations describe how some sections of the sitemaps
operate. For overview, see the general
<a href="sitemap.html">Sitemap</a> document and the specific
userdocs.
</p>
<h1>C2 documentation</h1>
<p>
The Cocoon documentation XML files are located at
<span class="codefrag">documentation/xdocs/*.xml</span> and sub-directories.
The sitemap at <span class="codefrag">documentation/sitemap.xmap</span> does most of the
work. It is used by <span class="codefrag">build docs</span> and it also mounted by the
main sitemap to handle requests for documentation as a servlet.
</p>
<p>
Each match is presented and described in turn.
</p>
<pre class="code">
Match #1 ...
&lt;!-- ================ C2 documentation ================= --&gt;
&lt;map:match pattern=""&gt;
&lt;map:redirect-to uri="index.html"/&gt;
&lt;/map:match&gt;
</pre>
<p>
Just a convenience for redirecting the null pattern to the home page.
</p>
<pre class="code">
Match #2 ...
&lt;map:match pattern="*.html"&gt;
&lt;map:aggregate element="site"&gt;
&lt;map:part src="cocoon:/book-{1}.xml"/&gt;
&lt;map:part src="cocoon:/body-{1}.xml"/&gt;
&lt;/map:aggregate&gt;
&lt;map:transform src="stylesheets/site2xhtml.xsl"&gt;
&lt;map:parameter name="use-request-parameters" value="true"/&gt;
&lt;map:parameter name="header" value="graphics/{1}-header.jpg"/&gt;
&lt;/map:transform&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
</pre>
<p>
Generates the response for a top-level page (e.g. index.html).
Note that lower-level pages (e.g. userdocs/index.html) do not match
here and are processed in a similar way by Match #3.
</p>
<p>
Each document is composed of two separate parts: the side-panel menu and
the actual page content. Each part is build separately and then aggregated.
Consider the example of the home page (index.html).
The side-panel content comes from <span class="codefrag">documentation/xdocs/book.xml</span>
(and is handled by the pipeline <span class="codefrag">book-index.xml</span>).
The actual page content comes from <span class="codefrag">documentation/xdocs/index.xml</span>
(and is handled by the pipeline <span class="codefrag">body-index.xml</span>).
</p>
<p>
So Match #2 generates an intermediate XML file by aggregating the XML output
from the two pipelines and wrapping it with a <span class="codefrag">&lt;site&gt;</span>
element. (The <span class="codefrag">cocoon:/</span> protocol means "Use the relevant
pipeline from the current sitemap".)
The output stream is then transformed to XHTML and serialized.
</p>
<pre class="code">
Match #3 ...
&lt;map:match pattern="**/*.html"&gt;
&lt;map:aggregate element="site"&gt;
&lt;map:part src="cocoon:/{1}/book-{1}/{2}.xml"/&gt;
&lt;map:part src="cocoon:/body-{1}/{2}.xml"/&gt;
&lt;/map:aggregate&gt;
&lt;map:transform src="stylesheets/site2xhtml.xsl"&gt;
&lt;map:parameter name="use-request-parameters" value="true"/&gt;
&lt;map:parameter name="header" value="graphics/{2}-header.jpg"/&gt;
&lt;/map:transform&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
</pre>
<p>
This is similar to Match #2, except that it deals with documents in
sub-directories. For the side-panel, this uses the <span class="codefrag">book.xml</span>
found in each relevant directory.
</p>
<pre class="code">
Match #4 ...
&lt;map:match pattern="**book-**.xml"&gt;
&lt;map:generate src="xdocs/{1}book.xml"/&gt;
&lt;map:transform src="stylesheets/book2menu.xsl"&gt;
&lt;map:parameter name="use-request-parameters" value="true"/&gt;
&lt;map:parameter name="resource" value="{2}.html"/&gt;
&lt;/map:transform&gt;
&lt;map:serialize type="xml"/&gt;
&lt;/map:match&gt;
</pre>
<p>
This produces the additional structured content for the relevant
side-panel menu. Note that this is the only match that serializes to
XML (the others have the default HTML).
</p>
<p>
In essence, this Match #4 is called from Match #2 via the
<span class="codefrag">cocoon:/</span> protocol and is aggregated with the output of Match #6
</p>
<pre class="code">
Match #5 ...
&lt;map:match pattern="body-todo.xml"&gt;
&lt;map:generate src="xdocs/todo.xml"/&gt;
&lt;map:transform src="stylesheets/todo2document.xsl"/&gt;
&lt;map:transform src="stylesheets/document2html.xsl"/&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
&lt;map:match pattern="body-changes.xml"&gt;
&lt;map:generate src="xdocs/changes.xml"/&gt;
&lt;map:transform src="stylesheets/changes2document.xsl"/&gt;
&lt;map:transform src="stylesheets/document2html.xsl"/&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
&lt;map:match pattern="body-faq.xml"&gt;
&lt;map:generate src="xdocs/faq.xml"/&gt;
&lt;map:transform src="stylesheets/faq2document.xsl"/&gt;
&lt;map:transform src="stylesheets/document2html.xsl"/&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
</pre>
<p>
These matches are for special cases. Note that they are defined before
the general body-*.xml match. Remember that the sitemap reads from top to
bottom and the first encountered match is used.
</p>
<p>
These special-cases need to transform the content into XML files that
conform to document-v10.dtd first.
</p>
<pre class="code">
Match #6 ...
&lt;map:match pattern="body-**.xml"&gt;
&lt;map:generate src="xdocs/{1}.xml"/&gt;
&lt;map:transform src="stylesheets/document2html.xsl"/&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
</pre>
<p>
This match handles the bodies of all other the other documents
(which are natively conforming to document-v10.dtd).
</p>
<p>
In essence, this Match #6 is called from Match #2 via the
<span class="codefrag">cocoon:/</span> protocol and is aggregated with the output of Match #4
</p>
</body>
</html>