cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <>
Subject Re: Conditional branching
Date Mon, 23 May 2005 12:01:08 GMT
David Perez wrote:
> Hi all,
> I need branching depending on the current contents of some tag in the 
> XML at a given pipeline step.
> So the first thing comes up to my mind is to use a matcher.
> I've found the WildcardParameterMatcher that allows me to use sitemap 
> variable and an input module called XmlFileModule. This input module 
> allows me to use any XPath expression of any pipeline.
> The problem is how can I pass the current XML flow to the XmlFileModule?
> The generator isn't file based, it parses the body of a post request.
> Here is a possible sketch of this solution:
> <map:match pattern="myurl">
>    <map:generate type="mygenerator"/>
>    <map:transform pattern="sheet1.xsl"/>
>    <!--I would like to branch here if  /*/branching-tag='valueA'-->
>    <map:match type="wildcard-param" pattern="valueA">
>        <map:parameter name="parameter-name" value="my-param"/>
>        <map:parameter name="my-param" 
> value="{xml-file-module:/*/branching-tag}"/>
>        <map:transform pattern="sheet2a.xsl"/>
>       <map:serialize/>
>    </map:match>
>    <map:transform pattern="sheet2b.xsl"/>
>    <map:serialize type='myserializer'>
>  </map:match>
> Has anyone tried any better solution?
> Is this solution viable?
> Thanks in advance for any hint.

Branching based on the content of the XML stream is disallowed by design. There 
have been some discussions about this that can be found in the archives of the 
users and the dev mailing list.

Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}


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

View raw message