<map:pipeline>
 <map:match pattern="handling">

  <map:act type="resource-exists">
   <map:parameter name="url" value="context://{request-param:ID}.xml"/>

   <!-- if resource exists : -->
   <map:generate type="file" src="default.xml" />
   <map:transform type="xslt" src="form2data.xsl">
     <map:parameter name="use-request-parameters" value="true" />
   </map:transform>
   <map:transform type="write-source">
   <map:parameter name="use-request-parameters" value="true" />
   </map:transform>
   <map:transform type="xslt" src="form2html.xsl" mime-type="text/xml">
    <map:parameter name="use-request-parameters" value="true" />
   </map:transform>
   <map:serialize type="html" />
  </map:act>

   <!-- else -->
   <map:generate type="file" src="default.xml" />
   <map:transform type="xslt" src="form2data.xsl" />
   <map:serialize type="html" />
  </map:match>
</map:pipeline>

--
Olivier Billard

On 17/09/2003 11:52, Mustafa Ali, Halgurt wrote:
My files are in the same directory like my sitemap.xmap, I do not even now how to use the Action, can you please tell me how to write my pipeline with this action?

Many thanks

-----Urspr�ngliche Nachricht-----
Von: Olivier Billard [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. September 2003 10:25
An: [EMAIL PROTECTED]
Betreff: Re: File existence


Hi Halgurt...

Where do you intend to find your file ? In the root of the webapp ?

You can try
*/_    <map:when test="/{request-param:ID}.xml">_/* (add the slash)
With this, your file will be searched relatively to the context root of the webapp.
see [1].

But if your only have one resource to look for, why don't you use the ResourceExistAction, which is more suited to the check of one file ?
The selector is more for a set of resources... (see [1])


[1] http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/selection/ResourceExistsSelector.html


-- Olivier Billard



On 17/09/2003 11:00, Mustafa Ali, Halgurt wrote:

Hi,



I had a Problem yesterday and asked for help, I try it now again, is the pipeline below correct or not? I am getting an Error:

"Invalid pattern '{request-parameter}:ID�



What is a better way to check if a file exists or not? I am getting the file name from a request parameter.





<map:pipeline>

<map:match pattern="handling">

<map:select type="resource-exists">

*/_ <map:when test="{request-param:ID}.xml">_/*

<map:generate type="file" src="default.xml" />

<map:transform type="xslt" src="form2data.xsl">

<map:parameter name="use-request-parameters" value="true" />

</map:transform>

<map:transform type="write-source">

<map:parameter name="use-request-parameters" value="true" />

</map:transform>

<map:transform type="xslt" src="form2html.xsl" mime-type="text/xml">

<map:parameter name="use-request-parameters" value="true" />

</map:transform>

</map:when>

<map:otherwise>

<map:generate type="file" src="default.xml" />

<map:transform type="xslt" src="form3data.xsl" />

</map:otherwise>

</map:select>

<map:serialize type="html" />

</map:match>

</map:pipeline>



Am I doing something wrong?



Many thanks,

Halgurt



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to