cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [2.1.11] Selectors in map:transform
Date Sat, 16 Feb 2008 16:06:51 GMT
On 2/16/08, Bertrand Delacretaz <> wrote:
> On Feb 14, 2008 5:02 PM,  <> wrote:
>  > ...<map:generate src="empty.xml"/>
> > <map:transform src="test.xsl">
>  >   <map:parameter name="test1" value="hardcoded"/>
> >   <map:select type="resource-exists">...
>  Instead of using empty.xml, your input could be another pipeline,
>  which output depends on your resource-exists selector. And use that
>  info in your xsl transform.
>  -Bertrand

Thank you for the idea.  The real code does not use empty.xml; that
was just to simplify the example.  Your suggested code would look

   <map:part src="the real XML"/>
   <map:part src="cocoon:/XML for one parameter">

<map:match pattern="XML for one parameter">
  <map:generate src="empty.xml"/>
  <map:select type="resource-exists">
    <map:when test="myfile">
      <map:transform src="putParameterInXML.xsl">
        <map:parameter name="test2" value="myfile"/>
    <map:when test="otherFile">
      <map:transform src="putParameterInXML.xsl">
        <map:parameter name="test2" value="otherFile"/>
      <map:transform src="putParameterInXML.xsl">
        <map:parameter name="test2" value="missing"/>
  <map:serialize type="xml"/>

This requires:
- One extra Pipeline.
- One extra Generate, Transform, Serialize.
- Much duplication of the code for the Transform.
- One extra XML.
- Slightly more complicated XSLT (getting variable from XML rather
than as a parameter, and ignoring the extra XML in the templates)

My apologies.  The original post was not asking for assistance about
how to program this.  I just wanted to verify that I had found an
undocumented feature that prevented obvious functionality from working
properly.  I was hoping the mistake was in my code rather than


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

View raw message