cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Billard <obill...@rennes.jouve.fr>
Subject Re: AW: AW: File existence
Date Wed, 17 Sep 2003 13:43:38 GMT
try a

<map:generate src="{request-param:ID}.xml"/>
<map:serialize type="xml"/>

instead, with an "ID" param leading to a non-existing and existing file...
with a non-existing file, you should have an error telling that the file <ID>.xml does
not 
exist. It should show you that the replacement is done.

you can also try to remove the "context://" from the url parameter

--
Olivier Billard

On 17/09/2003 15:32, Mustafa Ali, Halgurt wrote:

> Well, I tried it, but the <act>....</act> part will be always ignored, no
matter whether the file exists or not, I am not getting any Error messages, I think cocoon
takes {request-param:ID}.xml as a file name and not the value of {request-param:ID} with the
extension .xml as a file name, or am I seeing it worng?
> 
> Thanks,
> 
> -----Ursprüngliche Nachricht-----
> Von: Olivier Billard [mailto:obillard@rennes.jouve.fr] 
> Gesendet: Mittwoch, 17. September 2003 12:20
> An: users@cocoon.apache.org
> Betreff: Re: AW: File existence
> 
> <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:obillard@rennes.jouve.fr] 
>>Gesendet: Mittwoch, 17. September 2003 10:25
>>An: users@cocoon.apache.org
>>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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org

-- 

-- 
Olivier BILLARD



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message