cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Wyles <>
Subject Re: Matching Subdirectories
Date Mon, 01 Nov 2004 21:25:25 GMT
Hi Brent,

If I understood you correctly I think a matcher like this might be what 
you need:

     <map:match pattern="**/*/*.html">
         <map:generate type="jx" src="public/layouts/{1}/{2}/{3}.jx"/>
         <map:transform type="cinclude"/>
         <map:transform src="themes/{global:theme}/main.xsl"/>
         <map:serialize type="html"/>

The ** corresponding to the {1} in the generate will be any number of 
directories in at the start of the uri.

The first *, {2} matches your directory name, and the last *, {3} 
matches the file name.

Hope this helps,


On 1 Nov 2004, at 20:38, Brent Johnson wrote:

> I'm sure I am missing something key in the sitemap but I'm trying to
> find a way to wildcard match to any number of subdirectories.  It
> looks like the way to accomplish this is to use a matching like
> "**/*.html" or something similar.  Problem is.. its not working as I
> expected.
> Here's my example (without subdirectories):
>   <map:pipeline internal-only="true">
>     <map:match pattern="blocks/*">
>         <map:generate type="jx" src="public/blocks/{1}.jx"/>
>         <map:serialize type="xml"/>
>     </map:match>
>   </map:pipeline>
>   <map:pipeline type="noncaching">
>     <map:match pattern="*.html">
>         <map:call function="showPage">
>             <map:parameter name="page" value="{1}"/>
>         </map:call>
>     </map:match>
>     <map:match pattern="content/*.html">
>         <map:generate type="jx" src="public/layouts/{1}.jx"/>
>         <map:transform type="cinclude"/>
>         <map:transform src="themes/{global:theme}/main.xsl"/>
>         <map:serialize type="html"/>
>     </map:match>
> ...etc...
> Long story short.. the user requests "/index.html".. flow then does a
> cocoon.sendPage("content/index.html", ...).  Then the JXTemplate
> "public/layouts/index.jx" gets called.. which in turn does some
> content aggregation of the pipeline "blocks/about.jx" which looks for
> the file "public/blocks/about.jx."
> Hope that doesnt sound too confusuing.  Anyways.. I want to be able to
> match for "/whatever/dir/index.html".. which in turn looks in
> "content/whatever/dir/index.html", which finds the file
> "public/layouts/whatever/dir/index.jx".. etc.. same for the blocks.
> I tried this with **/*.html and **/*.jx, etc... but this got
> unpredictable results.  Most notably.. adding a match for **/*.html
> along with a match for *.html (since apparently /index.html doesnt
> match **/*.html) results in Cocoon just sending a blank page to the
> browser.
> Anyone tried anything like this?
> Thanks.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message