cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Writing a Transformer, getting a Serializer
Date Mon, 03 Dec 2001 11:37:08 GMT
At 10:49 am +0000 2/12/01, Jeremy Quinn wrote:

>Maybe I'll have a go at writing a test "FileResourceWriterTransformer", to
>investigate the process of taking input from the user, having it modify a
>Resource using XSLT then writing it out again.

Would someone mind helping me with some Cocoon internals?

I am pretty sure I know how to write a Transformer (at least I have some
great examples!), but I do not know how to get a Serialiser inside a
Transformer.

What I am thinking of is this:

I would like to pass as a parameter to the Transformer, the name of the
Serialiser (as set up in the SiteMap), that you want the Transformer to use
when it writes out your XML Fragment to file.

Something like this:


  <map:transformers default="xslt">
   	<map:transformer
			name="write-file"
			src="org.apache.cocoon.transformation.FileResourceWriterTransformer"
      pool-max="16" pool-min="8" pool-grow="2">
    	<serializer>xml</serializer> <!-- say which Serialiser to use -->
   	</map:transformer>
  </map:transformers>


  <map:serializers default="html">
   	<map:serializer name="xml"
			mime-type="text/xml"
			src="org.apache.cocoon.serialization.XMLSerializer"
      pool-max="32" pool-min="16" pool-grow="4">
			<omit-xml-declaration>no</omit-xml-declaration>
		</map:serialzer>
  </map:serializers>


	<map:pipeline>
		<map:match pattern=" ... ">
				<map:generate ...../>

				<map:transform type="write-file" src="cocoon:/thefile.xml">
					<!-- the Node in the current document, that is
						to become the root Node of the saved file-->
					<map:parameter name="file-root" value="doc"/>
				</map:transform>

				<map:serialize>
		</map:match>
	</map:pipeline>


Then in the "compose()" method, I want to take the (SiteMap) name of the
Serialser, and retrieve the Component, releasing it in the "dispose()"
method.


Is this possible?
Am I looking at this the right way?


Thanks for any help


regards Jeremy






-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <mailto:sharkbait@mac.com>     		 <http://www.media.demon.co.uk>
   <phone:+44.[0].20.7737.6831>             <pager:jermq@vizzavi.net>

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


Mime
View raw message