Articles
More
Links
This document describes some features used in the sitemap of the CssColumnSite.
This section explains in detail the reasons for using the
map:aggregate, and map:part sitemap elements.
Moreover the attributes element, and strip-root
are explained in more detail.
The sitemap contains following snippet:
<!-- generate a page by merging all parts making up a page
-->
<map:resource name="show-page">
<map:aggregate element="site">
<map:part src="cocoon:/page-{page}-top-col-1"
element="top-col-1" strip-root="true"/>
<map:part src="cocoon:/page-{page}-mid-col-1"
element="mid-col-1" strip-root="true"/>
<map:part src="cocoon:/page-{page}-mid-col-2"
element="mid-col-2" strip-root="true"/>
<map:part src="cocoon:/page-{page}-mid-col-3"
element="mid-col-3" strip-root="true"/>
<map:part src="cocoon:/page-{page}-mid-col-4"
element="mid-col-4" strip-root="true"/>
<map:part src="cocoon:/page-{page}-bottom-col-1"
element="bottom-col-1" strip-root="true"/>
</map:aggregate>
<map:transform src="stylesheets/site2html.xsl"/>
<map:serialize/>
</map:resource>
The reason for using the map:aggregate, and
map:part is simple, we want to merge documents from the
section directories to a single xml document. The sitemap
map:aggregate, and map:part elements
provides this functionality.
As merged-in documents should be contained inside a common
root-element. The attribute element of the map:aggregate
specifies the name of this root-element name.
In the sitemap
snippet <map:aggregate element="site"/>
the root-element is specified to have the element name site.
Hence the xml document serialized by this snippet should look like this
...
<site>
<!-- content of part top-col-1 -->
...
<!-- content of part bottom-col-1 -->
</site>
The sitemap map:part defines the parts making up the
total aggregation. Each part defines its source in the src
attribute.
Moreover the attribute element is used to mark in the
xml document that this xml document subtree has been merged in using
this part. This is used later on in the stylesheet site2html.xsl
to treat each part in a special way.
The attribute strip-root="yes" strips off the
root element of each part document source. This is done for
convenience, later on in the stylesheet you can write a bit more
simpler xpath expression.
Enhancing the example above, the serialized xml document looks like this:
...
<site>
<!-- content of part top-col-1 -->
<top-col-1>
<!-- content of part top-col-1 w/o it root element -->
</top-col-1>
...
<!-- content of part bottom-col-1 -->
<bottom-col-1>
<!-- content of part bottom-col-1 w/o it root element -->
</bottom-col-1>
</site>
This site defaults to a default document per section. If a requested
page does not find its xml-document in the section directory, the xml
document index.xml is used for generating the section
content.
For example, the mid-col-1 section directory does not
contain an xml document for the faq.html page. Does the
mid-col-1 section for the faq.html page uses
the document mid-col-1/index.xml for providing the content
of the mid-col-1 section of the faq.htmlpage.
The following section of the sitemap checks the resolvability of a section xml-document:
<map:match pattern="page-*-mid-col-1">
<map:act type="resource-exists" src="docs/mid-col-1/{1}.xml">
<map:call resource="load-page">
<map:parameter name="sect" value="mid-col-1"/>
<map:parameter name="page" value="{../1}"/>
<map:parameter name="resource-exists"
value="{resource-exists}"/>
</map:call>
</map:act>
</map:match>
The action resource-exists checks if its src
attribute value is resolvable. If it is resolvable it sets the sitemap
parameter resource-exists to "true",
else the sitemap parameter resource-exists to "false".
The invoked resource load-page evaluates the sitemap
parameter resource-exists.
PDF
sitemap-tutorial
Hints
» Use Search to search all documents.
» Use Recreate Index to create the inital index.
This may be neccessary once at startup.
» Search and Recreate Index are available
at HTML Cocoon online deployment, only.
» Search and Recreate Index are not available
on WML online, WML offline, and HTML offline deployments.