Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Lenya Process for Displaying Documents

This article follows the process Lenya uses to turn standard Lenya documents into HTML with navigation.

It starts in publication-sitemap.xmap:
<map:match pattern="**.html">
<map:generate src="cocoon:/lenyabody-view/
<map:serialize type="html"/>

Notice the {page-envelope:document-type}. That is when Lenya checks parameter-doctype.xmap to get a value. Each numbered variable is set to the * in the match pattern:
{1} = "view"
{2} = publication-id
{3} = area
{4} = document-type
{5} = document-url with first slash removed.
2, 3, and 4 could (or should) have been added to the code later rather than passed as parameters. Doing it in the match pattern accomplishes:
1. Getting document-type requires some processing, so this calls that code once.
2. It allows shorter names in the src parameters.
3. It confuses everybody because they have to remember which number refers to which variable.
4. It allows other pipelines to call this pipeline overriding these variables. This is very useful for things like my Website Map because they can change the body without repeating the code for formatting.

<map:match pattern="lenyabody-*/*/*/*/**">
<map:aggregate element="cmsbody">
<map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
<map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
<map:part src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/>
<map:transform src="xslt/page2xhtml-{4}.xsl"/>
<map:serialize type="xml"/>

Skip to the content, since the navigation pulls from other files. The parameters are:

<map:match pattern="lenya-document-*/*/*/**.xml">
<map:mount check-reload="true" reload-method="synchron" src="doctypes.xmap" uri-prefix="lenya-document-"/>

{1} = "view"
{2} = area
{3} = document-type
{4} = document=path with final ".xml" removed

<map:match pattern="*/*/*/**.xml">
<map:generate src="content/{2}/{4}.xml"/>
<map:transform src="xslt/{3}2xhtml.xsl">
<map:parameter name="rendertype" value="{1}"/>
<map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
<map:parameter name="language" value="{page-envelope:document-language}"/>
<map:serialize type="xml"/>

This pulls the XML from {pub}/content, and performs a transformation xslt/{document-type}2xhtml.xsl.


You probably do not need to understand this, but here is how the navigation XML is generated:

The navigation elements come from here, passing the parameters after removing the first.
<map:match pattern="navigation/**">
<map:mount uri-prefix="navigation" src="lenya/navigation.xmap" check-reload="true" reload-method="synchron"/>

{1} = publication-id
{2} = area
{3} = navigation element name
{4} = document-url with first slash and final ".xml" removed

<!-- pattern: {pub-id}/{area}/{nav-element}/{url}.xml -->
<map:match pattern="*/*/*/**.xml">
<map:generate src="cocoon:/{1}/{2}/sitetree/{4}.xml"/>
<map:call resource="fallback-transformation">
<map:parameter name="publication-id" value="{1}"/>
<map:parameter name="url" value="{4}"/>
<map:parameter name="stylesheet" value="{3}"/>

The XML source comes from pubs/{publication-id}/content/{area}/sitetree.xml, and is passed through sitetree2nav.xsl:
{1} = publication-id
{2} = area
{3} = document-url with first slash and final ".xml" removed

<map:match pattern="*/*/sitetree/**.xml">
<map:generate src="pubs/{1}/content/{2}/sitetree.xml"/>
<map:call resource="fallback-transformation">
<map:parameter name="publication-id" value="{1}"/>
<map:parameter name="url" value="{3}"/>
<map:parameter name="stylesheet" value="sitetree2nav"/>

<< Usecase SitemapsDocTypes >>

Contact Solprovider
Paul Ercolino