You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Colin Eberhardt <co...@tecsphere.com> on 2005/02/11 16:14:00 UTC
Resource re-use between sitemaps
Dear All,
I am creating a few cocoon applications which have common patterns. I
have created a common sitemap and a number of sub-sitemaps. The
sub-sitemaps are able to access all the components defined in the common
sitemap, however if I try to call a resource which is defined in the
common sitemap cocoon complains that it is unable to find the specified
resource.
Here is a very simple example of what I am trying to achieve...
Here is the base sitemaps:
<?xml version="1.0" encoding="ISO-8859-1"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:generators default="file"/>
<map:transformers default="xslt"/>
<map:serializers default="html"/>
<map:readers default="resource"/>
<map:matchers default="wildcard"/>
</map:components>
<map:resources>
<map:resource name="common-resource">
<map:generate src="test.html" type="file" />
<map:serialize type="html" />
</map:resource>
</map:resources>
<map:pipelines>
<map:pipeline>
<map:mount check-reload="yes"
src="subsitemap.xmap" uri-prefix=""/>
</map:pipeline>
</map:pipelines>
</map:sitemap>
And here is the sitemap which it references:
<?xml version="1.0" encoding="ISO-8859-1"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:generators default="file"/>
<map:transformers default="xslt"/>
<map:serializers default="html"/>
<map:readers default="resource"/>
<map:matchers default="wildcard"/>
</map:components>
<map:pipelines>
<map:pipeline>
<map:call resource="common-resource"/>
</map:pipeline>
</map:pipelines>
</map:sitemap>
However, the call to the resource named "common-resource" fails.
What am I doing wrong, or are resources not re-useable!
Colin Eberhardt
Software Engineer
eMail: colin.eberhardt@tecsphere.com
TecSphere Ltd
Centre for Advanced Industry
Coble Dene, Royal Quays
Newcastle upon Tyne NE29 6DE
United Kingdom
Direct Dial: +44 (191) 270 31 13
Fax: +44 (191) 270 31 09
http://www.tecsphere.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Resource re-use between sitemaps
Posted by Geert Josten <Ge...@daidalos.nl>.
Hi Colin,
Luca Garulli wrote:
> AFAIK you cannot call resources defined in the parent sitemap.
Besides this, map:call is not allowed withing map:pipeline. It has to be wrapped in a map:match.
> You should try to use XPatch or write an ant target that build the
> final sitemap merging all sub-sitemaps ;-)
You can also rewrite the resource to a match that is inside an 'internal-only' pipeline.
For instance:
Parent sitemap:
<map:match pattern="common-resource">
<!-- generate, transform and serialize or simply 'read' your html -->
</map:match>
Sub sitemap:
<map:match pattern="call-resource">
<map:read src="cocoon://path-to-parent-sitemap/common-resource" />
</map:match>
Cheers,
Geert
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Resource re-use between sitemaps
Posted by Luca Garulli <l....@gmail.com>.
AFAIK you cannot call resources defined in the parent sitemap.
You should try to use XPatch or write an ant target that build the
final sitemap merging all sub-sitemaps ;-)
bye,
Luca Garulli
www.Pro-Netics.com (member of Orixo.com - The XML business alliance)
OrienTechnologies.com - Light ODBMS, All in one JDO solution
On Fri, 11 Feb 2005 15:14:00 -0000, Colin Eberhardt
<co...@tecsphere.com> wrote:
> Dear All,
>
> I am creating a few cocoon applications which have common patterns. I
> have created a common sitemap and a number of sub-sitemaps. The
> sub-sitemaps are able to access all the components defined in the common
> sitemap, however if I try to call a resource which is defined in the
> common sitemap cocoon complains that it is unable to find the specified
> resource.
>
> Here is a very simple example of what I am trying to achieve...
>
> Here is the base sitemaps:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:components>
> <map:generators default="file"/>
> <map:transformers default="xslt"/>
> <map:serializers default="html"/>
> <map:readers default="resource"/>
> <map:matchers default="wildcard"/>
> </map:components>
> <map:resources>
> <map:resource name="common-resource">
> <map:generate src="test.html" type="file" />
> <map:serialize type="html" />
> </map:resource>
> </map:resources>
> <map:pipelines>
> <map:pipeline>
> <map:mount check-reload="yes"
> src="subsitemap.xmap" uri-prefix=""/>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
> And here is the sitemap which it references:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:components>
> <map:generators default="file"/>
> <map:transformers default="xslt"/>
> <map:serializers default="html"/>
> <map:readers default="resource"/>
> <map:matchers default="wildcard"/>
> </map:components>
> <map:pipelines>
> <map:pipeline>
> <map:call resource="common-resource"/>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
> However, the call to the resource named "common-resource" fails.
>
> What am I doing wrong, or are resources not re-useable!
>
> Colin Eberhardt
> Software Engineer
> eMail: colin.eberhardt@tecsphere.com
>
> TecSphere Ltd
> Centre for Advanced Industry
> Coble Dene, Royal Quays
> Newcastle upon Tyne NE29 6DE
> United Kingdom
>
> Direct Dial: +44 (191) 270 31 13
> Fax: +44 (191) 270 31 09
> http://www.tecsphere.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org