| <!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 ... |
| <!-- ================ C2 documentation ================= --> |
| <map:match pattern=""> |
| <map:redirect-to uri="index.html"/> |
| </map:match> |
| </pre> |
| |
| |
| <p> |
| Just a convenience for redirecting the null pattern to the home page. |
| </p> |
| |
| |
| <pre class="code"> |
| Match #2 ... |
| <map:match pattern="*.html"> |
| <map:aggregate element="site"> |
| <map:part src="cocoon:/book-{1}.xml"/> |
| <map:part src="cocoon:/body-{1}.xml"/> |
| </map:aggregate> |
| <map:transform src="stylesheets/site2xhtml.xsl"> |
| <map:parameter name="use-request-parameters" value="true"/> |
| <map:parameter name="header" value="graphics/{1}-header.jpg"/> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| </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"><site></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 ... |
| <map:match pattern="**/*.html"> |
| <map:aggregate element="site"> |
| <map:part src="cocoon:/{1}/book-{1}/{2}.xml"/> |
| <map:part src="cocoon:/body-{1}/{2}.xml"/> |
| </map:aggregate> |
| <map:transform src="stylesheets/site2xhtml.xsl"> |
| <map:parameter name="use-request-parameters" value="true"/> |
| <map:parameter name="header" value="graphics/{2}-header.jpg"/> |
| </map:transform> |
| <map:serialize/> |
| </map:match> |
| </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 ... |
| <map:match pattern="**book-**.xml"> |
| <map:generate src="xdocs/{1}book.xml"/> |
| <map:transform src="stylesheets/book2menu.xsl"> |
| <map:parameter name="use-request-parameters" value="true"/> |
| <map:parameter name="resource" value="{2}.html"/> |
| </map:transform> |
| <map:serialize type="xml"/> |
| </map:match> |
| </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 ... |
| <map:match pattern="body-todo.xml"> |
| <map:generate src="xdocs/todo.xml"/> |
| <map:transform src="stylesheets/todo2document.xsl"/> |
| <map:transform src="stylesheets/document2html.xsl"/> |
| <map:serialize/> |
| </map:match> |
| |
| <map:match pattern="body-changes.xml"> |
| <map:generate src="xdocs/changes.xml"/> |
| <map:transform src="stylesheets/changes2document.xsl"/> |
| <map:transform src="stylesheets/document2html.xsl"/> |
| <map:serialize/> |
| </map:match> |
| |
| <map:match pattern="body-faq.xml"> |
| <map:generate src="xdocs/faq.xml"/> |
| <map:transform src="stylesheets/faq2document.xsl"/> |
| <map:transform src="stylesheets/document2html.xsl"/> |
| <map:serialize/> |
| </map:match> |
| </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 ... |
| <map:match pattern="body-**.xml"> |
| <map:generate src="xdocs/{1}.xml"/> |
| <map:transform src="stylesheets/document2html.xsl"/> |
| <map:serialize/> |
| </map:match> |
| </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> |