You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Pietschmann <de...@gmail.com> on 2005/07/21 19:02:27 UTC

two generators in one pipeline

Howdy,

 

i need your help, urgently :-)

 

I need to write a matcher which processes two files. I should look something
like this:

 

<map:match pattern="**/*.coc">

            <!-transform and save the first file -->

<map:generate src="{1}/{2}.ccia"/>

            <map:transform ./>

            <map:transform type="foto" ../>

<!-now transform the second file which needs the first one -->

<map:generate src="{1}/{2}.coc"/>

            <map:transform ./>

            <map:transform ./>

            <map:serialize type="text"/>

</map:match>

 

Thanx,

Stefan


AW: AW: two generators in one pipeline

Posted by Stefan Pietschmann <de...@gmail.com>.
Ya, sure I know how map:aggregate works. When I read "concurrent requests"
in the last response I had an idea which works pretty well. It's not very
efficient, but I just need that to work as a prototype for a presentation
next week, so I'm doing it this way:

<map:match pattern="**/*.coc">
	<map:generate src="{1}/{2}.ccia"/>
	<map:transform .../>
	<map:transform .../>
	<map:transform type="xslt-with-parameters"
src="loadCoComponent.xslt">
		<map:parameter name="path" value="{1}/{2}.truecoc"/>
	</map:transform>
	<map:serialize type="xhtml.full"/>
</map:match>

<map:match pattern="**/*.truecoc">
	<map:generate src="{1}/{2}.coc"/>
	<map:transform .../>
	<map:serialize type="vrml"/>
</map:match>

So after transforming the first file I'm sending back a html file which
redirects to *.truecoc. Then the second file is transformed.. easy does it
:)

Stefan 

> -----Ursprüngliche Nachricht-----
> Von: Dale Frye [mailto:dale@greatsky.us]
> Gesendet: Donnerstag, 21. Juli 2005 21:49
> An: users@cocoon.apache.org
> Betreff: Re: AW: two generators in one pipeline
> 
> I'm a bit confused. You can't just append one XML file to another. It
> would not be a valid XML document. There can only be one root node and
> appending them together would create two root nodes. Either one has to
> include the other (using CInclude or XInclude) or both must be included
> in another xml file (it could contain just one node that would become
> the root node of the two documents). This is (in essence) what aggregate
> does. In either case you may have to write some glue XSL that converts
> it into the format needed for the existing XSL. Most likely the glue XSL
> would be pretty simple.
> 
> Stefan Pietschmann wrote:
> 
> >Thanx for the quick reply,
> >
> >I actually tried that out before, but I didn't write those xslt
> >transformations and they are well complicated and only work with the pure
> >files, not if both are aggregated. That's my problem :(
> >
> >
> >
> >
> >>-----Ursprüngliche Nachricht-----
> >>Von: Dale Frye [mailto:dale@greatsky.us]
> >>Gesendet: Donnerstag, 21. Juli 2005 19:49
> >>An: users@cocoon.apache.org
> >>Betreff: Re: two generators in one pipeline
> >>
> >>How about something like this? (Please forgive spelling and missing
> >>attributes.)
> >>
> >><map:match pattern="**/*.coc">
> >>
> >><map:aggretate> <!-- There are some attributes to set , I'm working from
> >>memory -->
> >>
> >><map:part src="cocoon:/{1}/{2}.ccia"/>
> >>
> >><map:part src="{1}/{2}.coc"/>
> >>
> >></map:aggretate>
> >>
> >><map:transform …/>
> >>
> >><map:transform …/>
> >>
> >><map:serialize type="text"/>
> >>
> >></map:match>
> >>
> >>
> >><!-- You may want to put this in a seperate pipeline that is not public
> --
> >>
> >>
> >><map:match pattern="**/*.ccia">
> >>
> >><!—transform and save the first file -->
> >>
> >><map:generate src="{1}/{2}.ccia"/>
> >>
> >><map:transform …/>
> >>
> >><map:transform type="foto" ../>
> >>
> >><map:serialize type="xml"/>
> >>
> >></map:match>
> >>
> >>
> >>Stefan Pietschmann wrote:
> >>
> >>
> >>
> >>>Howdy,
> >>>
> >>>i need your help, urgently J
> >>>
> >>>I need to write a matcher which processes two files. I should look
> >>>something like this:
> >>>
> >>><map:match pattern="**/*.coc">
> >>>
> >>><!—transform and save the first file -->
> >>>
> >>><map:generate src="{1}/{2}.ccia"/>
> >>>
> >>><map:transform …/>
> >>>
> >>><map:transform type="foto" ../>
> >>>
> >>><!—now transform the second file which needs the first one -->
> >>>
> >>><map:generate src="{1}/{2}.coc"/>
> >>>
> >>><map:transform …/>
> >>>
> >>><map:transform …/>
> >>>
> >>><map:serialize type="text"/>
> >>>
> >>></map:match>
> >>>
> >>>Thanx,
> >>>
> >>>Stefan
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: AW: two generators in one pipeline

Posted by Dale Frye <da...@greatsky.us>.
I'm a bit confused. You can't just append one XML file to another. It 
would not be a valid XML document. There can only be one root node and 
appending them together would create two root nodes. Either one has to 
include the other (using CInclude or XInclude) or both must be included 
in another xml file (it could contain just one node that would become 
the root node of the two documents). This is (in essence) what aggregate 
does. In either case you may have to write some glue XSL that converts 
it into the format needed for the existing XSL. Most likely the glue XSL 
would be pretty simple.

Stefan Pietschmann wrote:

>Thanx for the quick reply,
>
>I actually tried that out before, but I didn't write those xslt
>transformations and they are well complicated and only work with the pure
>files, not if both are aggregated. That's my problem :(
>
> 
>  
>
>>-----Ursprüngliche Nachricht-----
>>Von: Dale Frye [mailto:dale@greatsky.us]
>>Gesendet: Donnerstag, 21. Juli 2005 19:49
>>An: users@cocoon.apache.org
>>Betreff: Re: two generators in one pipeline
>>
>>How about something like this? (Please forgive spelling and missing
>>attributes.)
>>
>><map:match pattern="**/*.coc">
>>
>><map:aggretate> <!-- There are some attributes to set , I'm working from
>>memory -->
>>
>><map:part src="cocoon:/{1}/{2}.ccia"/>
>>
>><map:part src="{1}/{2}.coc"/>
>>
>></map:aggretate>
>>
>><map:transform …/>
>>
>><map:transform …/>
>>
>><map:serialize type="text"/>
>>
>></map:match>
>>
>>
>><!-- You may want to put this in a seperate pipeline that is not public --
>>    
>>
>><map:match pattern="**/*.ccia">
>>
>><!—transform and save the first file -->
>>
>><map:generate src="{1}/{2}.ccia"/>
>>
>><map:transform …/>
>>
>><map:transform type="foto" ../>
>>
>><map:serialize type="xml"/>
>>
>></map:match>
>>
>>
>>Stefan Pietschmann wrote:
>>
>>    
>>
>>>Howdy,
>>>
>>>i need your help, urgently J
>>>
>>>I need to write a matcher which processes two files. I should look
>>>something like this:
>>>
>>><map:match pattern="**/*.coc">
>>>
>>><!—transform and save the first file -->
>>>
>>><map:generate src="{1}/{2}.ccia"/>
>>>
>>><map:transform …/>
>>>
>>><map:transform type="foto" ../>
>>>
>>><!—now transform the second file which needs the first one -->
>>>
>>><map:generate src="{1}/{2}.coc"/>
>>>
>>><map:transform …/>
>>>
>>><map:transform …/>
>>>
>>><map:serialize type="text"/>
>>>
>>></map:match>
>>>
>>>Thanx,
>>>
>>>Stefan
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>  
>


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


Re: AW: two generators in one pipeline

Posted by Zbigniew Bomert OP <zb...@dominikanie.pl>.
If you really don't want to change xslts, then you can try flow script.
Send request matching **/*.coc to flowscript.

In script generate and transform the first document with
processPipelineTo() and save it to a file.

Then transform second document and send it to the client with sendPage().

But consider names for file to be saved. How about concurrent requests?

Zb


Stefan Pietschmann wrote:
> Thanx for the quick reply,
> 
> I actually tried that out before, but I didn't write those xslt
> transformations and they are well complicated and only work with the pure
> files, not if both are aggregated. That's my problem :(
> 
>  
> 
>>-----Ursprüngliche Nachricht-----
>>Von: Dale Frye [mailto:dale@greatsky.us]
>>Gesendet: Donnerstag, 21. Juli 2005 19:49
>>An: users@cocoon.apache.org
>>Betreff: Re: two generators in one pipeline
>>
>>How about something like this? (Please forgive spelling and missing
>>attributes.)
>>
>><map:match pattern="**/*.coc">
>>
>><map:aggretate> <!-- There are some attributes to set , I'm working from
>>memory -->
>>
>><map:part src="cocoon:/{1}/{2}.ccia"/>
>>
>><map:part src="{1}/{2}.coc"/>
>>
>></map:aggretate>
>>
>><map:transform …/>
>>
>><map:transform …/>
>>
>><map:serialize type="text"/>
>>
>></map:match>
>>
>>
>><!-- You may want to put this in a seperate pipeline that is not public --
>>
>><map:match pattern="**/*.ccia">
>>
>><!—transform and save the first file -->
>>
>><map:generate src="{1}/{2}.ccia"/>
>>
>><map:transform …/>
>>
>><map:transform type="foto" ../>
>>
>><map:serialize type="xml"/>
>>
>></map:match>
>>
>>
>>Stefan Pietschmann wrote:
>>
>>
>>>Howdy,
>>>
>>>i need your help, urgently J
>>>
>>>I need to write a matcher which processes two files. I should look
>>>something like this:
>>>
>>><map:match pattern="**/*.coc">
>>>
>>><!—transform and save the first file -->
>>>
>>><map:generate src="{1}/{2}.ccia"/>
>>>
>>><map:transform …/>
>>>
>>><map:transform type="foto" ../>
>>>
>>><!—now transform the second file which needs the first one -->
>>>
>>><map:generate src="{1}/{2}.coc"/>
>>>
>>><map:transform …/>
>>>
>>><map:transform …/>
>>>
>>><map:serialize type="text"/>
>>>
>>></map:match>
>>>
>>>Thanx,
>>>
>>>Stefan
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 


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


AW: two generators in one pipeline

Posted by Stefan Pietschmann <de...@gmail.com>.
Thanx for the quick reply,

I actually tried that out before, but I didn't write those xslt
transformations and they are well complicated and only work with the pure
files, not if both are aggregated. That's my problem :(

 
> -----Ursprüngliche Nachricht-----
> Von: Dale Frye [mailto:dale@greatsky.us]
> Gesendet: Donnerstag, 21. Juli 2005 19:49
> An: users@cocoon.apache.org
> Betreff: Re: two generators in one pipeline
> 
> How about something like this? (Please forgive spelling and missing
> attributes.)
> 
> <map:match pattern="**/*.coc">
> 
> <map:aggretate> <!-- There are some attributes to set , I'm working from
> memory -->
> 
> <map:part src="cocoon:/{1}/{2}.ccia"/>
> 
> <map:part src="{1}/{2}.coc"/>
> 
> </map:aggretate>
> 
> <map:transform …/>
> 
> <map:transform …/>
> 
> <map:serialize type="text"/>
> 
> </map:match>
> 
> 
> <!-- You may want to put this in a seperate pipeline that is not public --
> >
> 
> <map:match pattern="**/*.ccia">
> 
> <!—transform and save the first file -->
> 
> <map:generate src="{1}/{2}.ccia"/>
> 
> <map:transform …/>
> 
> <map:transform type="foto" ../>
> 
> <map:serialize type="xml"/>
> 
> </map:match>
> 
> 
> Stefan Pietschmann wrote:
> 
> > Howdy,
> >
> > i need your help, urgently J
> >
> > I need to write a matcher which processes two files. I should look
> > something like this:
> >
> > <map:match pattern="**/*.coc">
> >
> > <!—transform and save the first file -->
> >
> > <map:generate src="{1}/{2}.ccia"/>
> >
> > <map:transform …/>
> >
> > <map:transform type="foto" ../>
> >
> > <!—now transform the second file which needs the first one -->
> >
> > <map:generate src="{1}/{2}.coc"/>
> >
> > <map:transform …/>
> >
> > <map:transform …/>
> >
> > <map:serialize type="text"/>
> >
> > </map:match>
> >
> > Thanx,
> >
> > Stefan
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: two generators in one pipeline

Posted by Dale Frye <da...@greatsky.us>.
How about something like this? (Please forgive spelling and missing 
attributes.)

<map:match pattern="**/*.coc">

<map:aggretate> <!-- There are some attributes to set , I'm working from 
memory -->

<map:part src="cocoon:/{1}/{2}.ccia"/>

<map:part src="{1}/{2}.coc"/>

</map:aggretate>

<map:transform …/>

<map:transform …/>

<map:serialize type="text"/>

</map:match>


<!-- You may want to put this in a seperate pipeline that is not public -->

<map:match pattern="**/*.ccia">

<!—transform and save the first file -->

<map:generate src="{1}/{2}.ccia"/>

<map:transform …/>

<map:transform type="foto" ../>

<map:serialize type="xml"/>

</map:match>


Stefan Pietschmann wrote:

> Howdy,
>
> i need your help, urgently J
>
> I need to write a matcher which processes two files. I should look 
> something like this:
>
> <map:match pattern="**/*.coc">
>
> <!—transform and save the first file -->
>
> <map:generate src="{1}/{2}.ccia"/>
>
> <map:transform …/>
>
> <map:transform type="foto" ../>
>
> <!—now transform the second file which needs the first one -->
>
> <map:generate src="{1}/{2}.coc"/>
>
> <map:transform …/>
>
> <map:transform …/>
>
> <map:serialize type="text"/>
>
> </map:match>
>
> Thanx,
>
> Stefan
>


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