You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2003/09/11 17:45:59 UTC

Moving Lenya page processing to core

Hi Lenya developers,

to simplify the processing of a page in a publication,
I wondered which steps could be factored out to the core
and how we could get rid of lenya-specific XML like
<cmsbody> in a publication.

The most promising approach looks as follows
(examples from default publication):

publication - publication-sitemap.xmap
--------------------------------------

<map:match pattern="*/**.html">
   <map:act type="uriparametrizer" src="{1}/{2}.html">
     <map:parameter name="doctype" .../>

     <map:generate src="cocoon:/lenyabody/{page-envelope:publication-id}/
         {page-envelope:area}/{doctype}/{page-envelope:document-id}"/>

     <map:transform
         src="cocoon://lenya-page/{page-envelope:publication-id}/
         {../1}/{../2}.xml"/>

   </map:act>
   <map:serialize type="html"/>
</map:match>

The generation step produces an XHTML document (no <cmsbody> etc).

The transformation step applies a stylesheet containing the
Lenya HTML code, like HTML header, menubar etc.

Note that it is not necessary to aggregate the menu together with
the publication page. The stylesheet is generated in
global-sitemap.xmap:

core - global-sitemap.xmap
--------------------------

This pipeline matches the meta-stylesheet URL.
It calls the approriate menu and transforms it into
a stylesheet that creates the HTML page. For this
purpose, a simple meta stylesheet is used.

The resulting stylesheet just forwards the HTML page for
the live area and adds menubar etc. for the other areas.

<!-- lenya-page/{publication-id}/{complete-area}/... -->
<map:match pattern="lenya-page/*/*/**">
   <map:generate src="cocoon:/menu/{1}/{2}/{3}"/>
   <map:transform src="lenya/xslt/menu/menu2xslt.xsl">
     <map:parameter name="context-prefix" value="{request:contextPath}"/>
     <map:parameter name="publication-id" value="{1}"/>
     <map:parameter name="area" value="{2}"/>
     <map:parameter name="document-url"
          value="{page-envelope:document-url}"/>
   </map:transform>
   <map:serialize type="xml"/>
</map:match>

This pipeline calls the menu XML pipeline and applies all
transformations to produce the Lenya menubar XHTML
fragment. Note that the menu XHTML fragment is produced
_separately_ from the publication page. This avoids
element name clashes. Besides that, a dedicated namespace
is used for the menu XML.

<!-- menu/{publication-id}/{complete-area}/... -->
<map:match pattern="menu/*/*/**">
   <map:generate src="cocoon:/menu-xml/{1}/{2}/{3}"/>
   <map:transform type="workflowmenu"/>
   <map:transform type="usecasemenu"/>
   <map:transform src="lenya/xslt/menu/menu2xhtml.xsl">
     <map:parameter name="context-prefix" value="{request:contextPath}"/>
     <map:parameter name="publication-id" value="{1}"/>
     <map:parameter name="complete-area" value="{2}"/>
     <map:parameter name="document-area" value="{page-envelope:area}"/>
     <map:parameter name="document-url"
          value="{page-envelope:document-url}"/>
   </map:transform>
   <map:serialize type="xml"/>
</map:match>

This pipeline reads the menu XML from the publication.
The publication must contain a menus.xmap sitemap, but we
could agree on a fallback solution here.

<map:match pattern="menu-xml/*/**" internal-only="true">
   <map:mount uri-prefix="menu-xml/{1}/"
              src="lenya/pubs/{1}/menus.xmap" ... />
</map:match>

In menus.xmap, a page-specific menu (based on area, doctype etc.)
can be generated.

publication - menus.xmap
------------------------

<map:match pattern="**">
   <map:generate type="serverpages"
        src="config/menus/generic.xsp"/>
   <map:serialize type="xml"/>
</map:match>

----------------------------------------------------------------

As a proof of concept, I implemented this in my workspace,
but I wanted to get your opinion before checking it in.

To illustrate the sitemap flow, I made a little sketch:
http://www.wyona.org/andreas/lenya-menu.gif

So, what do you think?

Andreas





---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Moving Lenya page processing to core

Posted by Christian Egli <ch...@wyona.com>.
Andreas Hartmann <an...@apache.org> writes:

> to simplify the processing of a page in a publication,
> I wondered which steps could be factored out to the core
> and how we could get rid of lenya-specific XML like
> <cmsbody> in a publication.

> The most promising approach looks as follows
> (examples from default publication):
> 
> publication - publication-sitemap.xmap
> --------------------------------------
> 
> <map:match pattern="*/**.html">
>    <map:act type="uriparametrizer" src="{1}/{2}.html">
>      <map:parameter name="doctype" .../>
> 
>      <map:generate src="cocoon:/lenyabody/{page-envelope:publication-id}/
>          {page-envelope:area}/{doctype}/{page-envelope:document-id}"/>
> 
>      <map:transform
>          src="cocoon://lenya-page/{page-envelope:publication-id}/
>          {../1}/{../2}.xml"/>
> 
>    </map:act>
>    <map:serialize type="html"/>
> </map:match>

Yup, I like it, especially the meta-stylesheet which is generated on
the fly based on publication-id, area and document-id.

This simplifies things and gives us more flexibility at the same time.

> As a proof of concept, I implemented this in my workspace, but I
> wanted to get your opinion before checking it in.

As I said, I like it. Go for it.

-- 
Christian Egli       christian.egli@wyona.com   +41 1 272 9161
                     Wyona AG, Hardstrasse 219, CH-8005 Zurich
Open Source CMS      http://www.wyona.org http://www.wyona.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Moving Lenya page processing to core

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> Hi Lenya developers,
> 
> to simplify the processing of a page in a publication,
> I wondered which steps could be factored out to the core
> and how we could get rid of lenya-specific XML like
> <cmsbody> in a publication.

i like the approach. some of the implications will be apparent only 
after a while, but getting rid of redudant stylesheets and pipelines is 
a good thing.

+1

-gregor


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org


Re: Moving Lenya page processing to core

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> Hi Lenya developers,
> 
> to simplify the processing of a page in a publication,
> I wondered which steps could be factored out to the core
> and how we could get rid of lenya-specific XML like
> <cmsbody> in a publication.

[...]

Here's a diagram to illustrate the page processing:
http://www.wyona.org/andreas/lenya-page.png

Andreas



---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org