On 2/16/08, Bertrand Delacretaz <[EMAIL PROTECTED]> wrote:
> On Feb 14, 2008 5:02 PM, <[EMAIL PROTECTED]> 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
like:
<map:aggregate>
<map:part src="the real XML"/>
<map:part src="cocoon:/XML for one parameter">
</map:aggreagate>
<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:transform>
</map:when>
<map:when test="otherFile">
<map:transform src="putParameterInXML.xsl">
<map:parameter name="test2" value="otherFile"/>
</map:transform>
</map:when>
<map:otherwise>
<map:transform src="putParameterInXML.xsl">
<map:parameter name="test2" value="missing"/>
</map:transform>
</map:otherwise>
</map:select>
<map:serialize type="xml"/>
</map:match>
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
Cocoon-2.1.
solprovider
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]