You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Linczak, Jonathan W." <Li...@hiram.edu> on 2005/02/18 20:56:06 UTC

Read file and use it's contents in pipeline?

OK,

This is probably a really simple question, but I didn't find any quick answers, so I really hope you can help.

Say I have a very simple XML file (simple.xml) with the following contents:

<roottag>
  <option>Some value</option>
</roottag>

I would like to create a pipeline that reads the XML file above, and then use it in the pipeline, perhaps like this:

<map:pipeline>
  <map:match pattern="something">
    <map:read src="simple.xml"/>
    <map:redirect-to url="http://www.someplace.com/test.php?id={value inside <option> tag}"/>
  </map:match>
</map:pipeline>

Any way to grab the contents of the file read and use it in the pipeline?

Jon

Re: Read file and use it's contents in pipeline?

Posted by Geert Josten <Ge...@daidalos.nl>.
Hi,

Question looks simple, but doesn't have to be.

If your roottag xml is static (some config file), you can define a customized XMLInputModule.

Otherwise, you can resort to cinclude, with which you can specify request parameters and request 
method in a xml that you could generate and then transform with type="cinclude". I believe there are 
other transformers as well.

Other question is, what is the result of test.php, not (XML) content you want to process?

Cheers

Linczak, Jonathan W. wrote:

> OK,
> 
> This is probably a really simple question, but I didn't find any quick 
> answers, so I really hope you can help.
> 
> Say I have a very simple XML file (simple.xml) with the following contents:
> 
> <roottag>
>   <option>Some value</option>
> </roottag>
> 
> I would like to create a pipeline that reads the XML file above, and 
> then use it in the pipeline, perhaps like this:
> 
> <map:pipeline>
>   <map:match pattern="something">
>     <map:read src="simple.xml"/>
>     <map:redirect-to url="http://www.someplace.com/test.php?id={value 
> inside <option> tag}"/>
>   </map:match>
> </map:pipeline>
> 
> Any way to grab the contents of the file read and use it in the pipeline?
> 
> Jon
> 

-- 
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV, Zoetermeer (NL)

http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464

GPG: 1024D/12DEBB50

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