cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruyn Bill" <>
Subject RE: cinclude usage/alternatives
Date Tue, 21 Feb 2006 12:10:53 GMT
Mmmmmm.  I'd actually forgotten about map:aggregate.  I'm not sure it fits this use-case though...
 does it?  In this case, the dynamic part is a rendered CForm (via flowscript sendPageAndWait),
but all markup application-wide should be wrapped with this static content.  So I thought
I'd pull that down in my simple-page2html stylesheet (stolen from sample and modified slightly).
Lemme get some coffee in me and think this thorugh some more.  Thanks for your help so far.


From: Derek Hohls []
Sent: Tue 2/21/2006 4:32 AM
Subject: RE: cinclude usage/alternatives


Sorry, I still am not sure where the dynamic part is... what I was
suggesting was:

  <map:match pattern="test/graph-*">
       <map:aggregate element="document">
         <map:part src="cocoon:/doc-date"/>
         <map:part src="cocoon:/app-graphs-{1}"/>

where "doc-date" might be another pipeline retrieving a static
XML file and "app-graphs-{1}"/" yet other pipeline with a
dynamic component.

It was "xinclude", retrieving xpath data from multiple (hundreds)
of XML files that I found slow.


>>> 2006/02/21 01:22 PM >>>
Thanks, Derek. That's what I thought exactly. But the aggregation step is the cinclude, yes?
Am I going about this the right way? I have something like the following ATM: (and btw, any
thoughts on the speed issue? I saw some posts from you a while back on that...)


<map:resource name="simple-page2html">
<map:transform src="context://stylesheets/simple-page2html.xsl">
<map:parameter name="contextPath" value="{request:contextPath}"/>
<map:parameter name="servletPath" value="{request:servletPath}"/>
<map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
<map:parameter name="file" value="{file}"/>
<map:parameter name="remove" value="{../0}"/>
<map:transform type="cinclude"/>


<map:match pattern="presentation-template">
<map:generate type="file" src=""/>
<map:transform src="context://stylesheets/dreamweavertemplate-page2html.xsl"/>
<map:serialize type="xml"/>

<map:match pattern="forms/view/*.jx">
<map:generate type="jx" src="forms/view/{1}.xml" label="content1">
<map:parameter name="locale" value="{flow-attribute:locale}"/>
<map:transform type="browser-update"/>
<map:call resource="simple-page2html">
<map:parameter name="file" value="forms/view/{1}.xml"/>
<map:transform type="i18n">
<map:parameter name="locale" value="{flow-attribute:locale}"/>
<map:transform src="context://stylesheets/forms-styling.xsl"/>

<map:select type="ajax-request">
<map:when test="true">
<map:serialize type="xml"/>
<map:serialize type="html"/>

<?xml version="1.0" encoding="utf-8"?>
<page xmlns:ft="" xmlns:fi=""
<jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
<title>Find Treatment Provider</title>

<h4> Enter search criteria to find a provder that best suits your needs.
You'll need to supply part of a provider name <i>or</i> a search area (zip code),
but the rest of the options are optional.

<ft:form-template action="#{$continuation/id}.kont" method="POST" ajax="true">
<fi:label>Search Criteria</fi:label>
<fi:styling type="fieldset" layout="columns"/>
<ft:widget id="rowCount"/>
<ft:widget id="organizationName"/>
<ft:widget id="zipcode"><fi:styling size="8" maxlength="5"/></ft:widget>
<ft:widget id="addictionTreated"/>
<ft:widget id="careBasis"/>
<ft:widget id="paymentOption"/>
<ft:widget id="specialInterests">
<fi:styling list-type="checkbox"/>
<jx:if test="${cocoon.request.getUserPrincipal() != null}">
<input type="button" value="Create" onClick="'add.flow');"/>
<input type="submit" value="Search"/>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="" version="1.0"
xmlns:html="" exclude-result-prefixes="html">

<!-- The identity transform -->
<xsl:template match="@*|node()">
<xsl:apply-templates select="@*|node()"/>

<xsl:template match="html:td[@class='main-body']">
<!-- copy the element in question -->
<xsl:copy >
<xsl:apply-templates select="@*"/>
<!-- and wrap our dynamic content in it -->


<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:inc=""
<xsl:param name="contextPath"/>
<xsl:param name="servletPath" select="string('/drugfreeaz')"/>
<xsl:param name="sitemapURI"/>
<xsl:variable name="directory" select="substring-before($servletPath,$sitemapURI)"/>
<!-- assume that sitemapURIs don't occur in servletPath more than once -->
<xsl:variable name="sitemap" select="concat($directory,'sitemap.xmap')"/>

<xsl:template match="page">
<inc:include src="cocoon:/presentation-template"/>
<xsl:template match="title">


From: Derek Hohls []
Sent: Tue 2/21/2006 12:04 AM
Subject: Re: cinclude usage/alternatives


Just 2c worth of thought from the side. I am not sure I understand your problem
as a whole... but can you not have a pipeline with an aggregation step in it;
one part of the aggregate is the static file below, and the other is a pointer to
the pipeline that generates the dynamic data. You can then run the aggregated
xml through a normal transform to get your result... "looking up" the dynamic
section and adding it in to the <td class="webapp"></td> element (basic XSL).

Just an idea.

>>> 2006/02/21 07:01:17 AM >>>

For various reasons, I need to retrieve some markup from a remote resource, and insert my
jx result inline. e.g., I have some remote file called wrapper.xhtml that looks like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
" ">
<html xmlns="">
<td>Here is some static content</td>
<td class="webapp">and a placeholder for dynamic stuff</td>

Where I need to replace the contents of //td[@class='webapp'] with 'whatever'. It isn't the
way I would have chosen to put it together, but it seems like a reasonable requirement that
I should be able to handle with the sitemap and a cinclude transform. Right?

No luck though with several hours of experimentation and the usual looking through google,
samples, wiki, archives, userdoc, etc. BTW, the cinclude is really very slow... Is this the
recommended method, or am I barking up the wrong tree here?



This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.

CSIR E-mail Legal Notice

CSIR Copyright, Terms and Conditions

For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to

This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message