Quoting Michael Homeijer <[EMAIL PROTECTED]>:
> In a part of the sitemap I want to check if a requested file exists,
> if it doesn't i want to return the contents of a default file.
>
> Is this the way I should implement something like that
> or are the easier methods? :
>
> <map:match pattern="annotation\*"
> <map:select type="fileexists">
> <map:parameter name="filename" value="annotation\{1}"/>
>
> <map:when test="fileexists">
> <map:generate src="annotation\{1}"/>
> </map:when>
> <map:otherwise>
> <map:generate src="annotation\default.xml"/>
> </map:otherwise>
> </map:select>
> <map:transform src="annotation.xsl"/>
> </map:match>
This might be one approach. Another one could be with an Action like this:
<map:match pattern="annotation/*"
<map:act type="fileexists" src="annotation/{1}">
<map:parameter name="default" value="annotation/default.xml"/>
<map:generate src="{the-file}"/>
</map:act>
<map:transform src="annotation.xsl"/>
</map:match>
the mentioned Action will check for the file and return a Map containing
"the-file" as the key and the filename as its value depending on the existance
test (either the value of the source attribute or of the parameter "default").
Giacomo
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>