You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by rachid harradi <ra...@gmx.net> on 2006/09/20 17:38:13 UTC

use: SaveFilesTransformer

hello together,

i had use the SaveFilesTransformer but i have any file stored in filesystem



so is my Sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

<map:components>

	<!--map:generators default="objectionHTMLGenerator">
      <map:generator name="objectionHTMLGenerator" src="ameliGenerator.MyGenerator"/>
   </map:generators-->
   
     <map:generators default="myGenerator">
      <map:generator name="savingGenerator" src="ameliGenerator.SavingGenerator"/>
      <map:generator name="objectionGenerator" src="ameliGenerator.MyGenerator"/>
   </map:generators>
   
   
   	 <map:transformers default="tofile">
   		<map:transformer name="tofile" src="ameliTransformer.AmeliTransformer"/> 	
   		 <map:transformer
                logger='transformer.savefiles'
                name='savefiles'
                src='ameliTransformer.SaveFilesTransformer'/>
    	<map:transformer name="write-source" 
    		src="org.apache.cocoon.transformation.SourceWritingTransformer">
		<map:parameter name="serializer" value="xml"/>  
 	</map:transformer>
 	</map:transformers>
    
   
   
</map:components>

<map:pipelines>
   <map:pipeline internal-only="false">
   <map:match pattern="wohland">
      <map:generate type="file" src="ObjectionHTML.xml"/>
       <map:transform type="xslt" src="objection04.xslt"/>
      <map:serialize type="html"/>
   </map:match>
   </map:pipeline>
<map:pipeline> 
    <map:match pattern="">
   	 <map:generate type="file" src="cocoon:/wohland"/>
   		 <!--map:generate type="file" src="ObjectionHTML.xml"/-->
    	<map:transform type="savefiles">
    	<save:file
        src="cocoon:/wohland"
        target="E:/temp/objectionhtml.html"
        xmlns:save="http://daidalos.nl/cocoon/save/1.0" />
    	</map:transform>
  		 <map:serialize type="xml"/>
	</map:match>
   </map:pipeline> 
   
    <map:pipeline> 
     <map:match pattern="tofiles">
   	 <map:generate type="savingGenerator" src="cocoon:/wohland"/>
  		 <map:serialize type="xml"/>
	</map:match>
   </map:pipeline> 
   
</map:pipelines>

</map:sitemap>




i use this URL:http://localhost:8080/cocoon/savefiles/
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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


RE: RE: SaveFilesTransformer

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

I'm not sure I understand you fully, but to set filepath dynamically you
have a few options I guess:

1. Use an input module to read the value and pass it to the XSL with a
construct like this:

	<map:parameter name="filepath" value="{request-param:outputdir}"
/>

(this reads a request-param named 'outputdir' and replaces the {..} part
by the value)

2. Same thing, but wrapped in an action that sets a parameter or wrapped
in a FlowScript call that sets a request-param, request-attribute or
else..

3. Forget about the filepath parameter alltogether and change the XSL to
inspect the input (result from cocoon:/wohland), to get an output path
from there.

4. ...

Kind regards,
Geert

> Hi Josten,
> thank you very much for help
> 
> it work very nice :)
> 
> i have another Question. the filepath is dynamic i get it 
> from "cocoon:/wohland"  or from Servelt Application.
> 
> how can i acces "the path" during Sitemape like "global variable"?
> 
> Rachid Harradi

> >             <map:transform src="saveFile.xsl">
> >               <map:parameter name="serializer" value="html" />
> >               <map:parameter name="filepath"
> > value="E:/temp/objectionhtml.html" />
> >             </map:transform>
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

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


Re: RE: SaveFilesTransformer

Posted by rachid harradi <ra...@gmx.net>.
Hi Josten,
thank you very much for help

it work very nice :)

i have another Question. the filepath is dynamic i get it from "cocoon:/wohland"  or from Servelt Application.

how can i acces "the path" during Sitemape like "global variable"?

Rachid Harradi


-------- Original-Nachricht --------
Datum: Wed, 20 Sep 2006 18:36:24 +0200
Von: "Geert Josten" <ge...@daidalos.nl>
An: users@cocoon.apache.org
Betreff: RE: SaveFilesTransformer

> Hi Rachid,
> 
> Yes, you are going wrong at the point where you actually call the
> savefiles transformer. This transformer is content driven, not parametrized with a
> save:file element.
> 
> You have two options:
> 1. Wrap the result from the generate inside a save:file element using for
> instance the attached XSL, by adding the following transform between the
> generate and savefiles transform:
> 
>             <map:transform src="saveFile.xsl">
>               <map:parameter name="serializer" value="html" />
>               <map:parameter name="filepath"
> value="E:/temp/objectionhtml.html" />
>             </map:transform>
> 
> 2. Not generate the dynamic content of cocoon:/wohland, but a static xml
> file with contents:
> 
>      	<?xml version="1.0"?>
> 	<save:file
>          src="cocoon:/wohland"
>          target="E:/temp/objectionhtml.html"
>          xmlns:save="http://daidalos.nl/cocoon/save/1.0" />
> 
> Hope this helps!
> 
> Kind regards,
> Geert
> 
> > 
>    
>  
> Drs. G.P.H. Josten
> Consultant
>  
>  
> 
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665  JZ  Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> www.daidalos.nl
> KvK 27164984
> 
> 
> De informatie - verzonden in of met dit emailbericht - is afkomstig van
> Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit
> bericht kunnen geen rechten worden ontleend.
>  
> 
> > Van: rachid harradi [mailto:rachid.harradi@gmx.net] 
> > Verzonden: woensdag 20 september 2006 17:38
> > Aan: users@cocoon.apache.org
> > Onderwerp: use: SaveFilesTransformer
> > 
> > hello together,
> > 
> > i had use the SaveFilesTransformer but i have any file stored 
> > in filesystem
> > 
> > 
> > 
> > so is my Sitemap:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> > 
> > <map:components>
> > 
> > 	<!--map:generators default="objectionHTMLGenerator">
> >       <map:generator name="objectionHTMLGenerator" 
> > src="ameliGenerator.MyGenerator"/>
> >    </map:generators-->
> >    
> >      <map:generators default="myGenerator">
> >       <map:generator name="savingGenerator" 
> > src="ameliGenerator.SavingGenerator"/>
> >       <map:generator name="objectionGenerator" 
> > src="ameliGenerator.MyGenerator"/>
> >    </map:generators>
> >    
> >    
> >    	 <map:transformers default="tofile">
> >    		<map:transformer name="tofile" 
> > src="ameliTransformer.AmeliTransformer"/> 	
> >    		 <map:transformer
> >                 logger='transformer.savefiles'
> >                 name='savefiles'
> >                 src='ameliTransformer.SaveFilesTransformer'/>
> >     	<map:transformer name="write-source" 
> >     		
> > src="org.apache.cocoon.transformation.SourceWritingTransformer">
> > 		<map:parameter name="serializer" value="xml"/>  
> >  	</map:transformer>
> >  	</map:transformers>
> >     
> >    
> >    
> > </map:components>
> > 
> > <map:pipelines>
> >    <map:pipeline internal-only="false">
> >    <map:match pattern="wohland">
> >       <map:generate type="file" src="ObjectionHTML.xml"/>
> >        <map:transform type="xslt" src="objection04.xslt"/>
> >       <map:serialize type="html"/>
> >    </map:match>
> >    </map:pipeline>
> > <map:pipeline> 
> >     <map:match pattern="">
> >    	 <map:generate type="file" src="cocoon:/wohland"/>
> >    		 <!--map:generate type="file" 
> > src="ObjectionHTML.xml"/-->
> >     	<map:transform type="savefiles">
> >     	<save:file
> >         src="cocoon:/wohland"
> >         target="E:/temp/objectionhtml.html"
> >         xmlns:save="http://daidalos.nl/cocoon/save/1.0" />
> >     	</map:transform>
> >   		 <map:serialize type="xml"/>
> > 	</map:match>
> >    </map:pipeline> 
> >    
> >     <map:pipeline> 
> >      <map:match pattern="tofiles">
> >    	 <map:generate type="savingGenerator" src="cocoon:/wohland"/>
> >   		 <map:serialize type="xml"/>
> > 	</map:match>
> >    </map:pipeline> 
> >    
> > </map:pipelines>
> > 
> > </map:sitemap>
> > 
> > 
> > 
> > 
> > i use this URL:http://localhost:8080/cocoon/savefiles/
> > --
> > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> >

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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


RE: SaveFilesTransformer

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

Yes, you are going wrong at the point where you actually call the savefiles transformer. This transformer is content driven, not parametrized with a save:file element.

You have two options:
1. Wrap the result from the generate inside a save:file element using for instance the attached XSL, by adding the following transform between the generate and savefiles transform:

            <map:transform src="saveFile.xsl">
              <map:parameter name="serializer" value="html" />
              <map:parameter name="filepath" value="E:/temp/objectionhtml.html" />
            </map:transform>

2. Not generate the dynamic content of cocoon:/wohland, but a static xml file with contents:

     	<?xml version="1.0"?>
	<save:file
         src="cocoon:/wohland"
         target="E:/temp/objectionhtml.html"
         xmlns:save="http://daidalos.nl/cocoon/save/1.0" />

Hope this helps!

Kind regards,
Geert

> 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
 

> Van: rachid harradi [mailto:rachid.harradi@gmx.net] 
> Verzonden: woensdag 20 september 2006 17:38
> Aan: users@cocoon.apache.org
> Onderwerp: use: SaveFilesTransformer
> 
> hello together,
> 
> i had use the SaveFilesTransformer but i have any file stored 
> in filesystem
> 
> 
> 
> so is my Sitemap:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> 
> <map:components>
> 
> 	<!--map:generators default="objectionHTMLGenerator">
>       <map:generator name="objectionHTMLGenerator" 
> src="ameliGenerator.MyGenerator"/>
>    </map:generators-->
>    
>      <map:generators default="myGenerator">
>       <map:generator name="savingGenerator" 
> src="ameliGenerator.SavingGenerator"/>
>       <map:generator name="objectionGenerator" 
> src="ameliGenerator.MyGenerator"/>
>    </map:generators>
>    
>    
>    	 <map:transformers default="tofile">
>    		<map:transformer name="tofile" 
> src="ameliTransformer.AmeliTransformer"/> 	
>    		 <map:transformer
>                 logger='transformer.savefiles'
>                 name='savefiles'
>                 src='ameliTransformer.SaveFilesTransformer'/>
>     	<map:transformer name="write-source" 
>     		
> src="org.apache.cocoon.transformation.SourceWritingTransformer">
> 		<map:parameter name="serializer" value="xml"/>  
>  	</map:transformer>
>  	</map:transformers>
>     
>    
>    
> </map:components>
> 
> <map:pipelines>
>    <map:pipeline internal-only="false">
>    <map:match pattern="wohland">
>       <map:generate type="file" src="ObjectionHTML.xml"/>
>        <map:transform type="xslt" src="objection04.xslt"/>
>       <map:serialize type="html"/>
>    </map:match>
>    </map:pipeline>
> <map:pipeline> 
>     <map:match pattern="">
>    	 <map:generate type="file" src="cocoon:/wohland"/>
>    		 <!--map:generate type="file" 
> src="ObjectionHTML.xml"/-->
>     	<map:transform type="savefiles">
>     	<save:file
>         src="cocoon:/wohland"
>         target="E:/temp/objectionhtml.html"
>         xmlns:save="http://daidalos.nl/cocoon/save/1.0" />
>     	</map:transform>
>   		 <map:serialize type="xml"/>
> 	</map:match>
>    </map:pipeline> 
>    
>     <map:pipeline> 
>      <map:match pattern="tofiles">
>    	 <map:generate type="savingGenerator" src="cocoon:/wohland"/>
>   		 <map:serialize type="xml"/>
> 	</map:match>
>    </map:pipeline> 
>    
> </map:pipelines>
> 
> </map:sitemap>
> 
> 
> 
> 
> i use this URL:http://localhost:8080/cocoon/savefiles/
> --
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>