On Aug 4, 2004, at 8:22 PM, Tony Edwards wrote:

Mark,
Thanks for the pointer regarding the session object. I'll check it out.
To get my document into the pipeline, I do the following:

Once I've stored the xml document in session I user the session generator in my pipeline to grab it and transform it:

<map:match pattern="internal/tree-menu"> <map:generate type="session-attr">
<map:parameter name="attr-name" value="hrcyDoc"/>
</map:generate>
<map:tansform src="xml2tree.xsl"/> <map:serialize type="html" />
</map:match>

The session-attr generator refers to the SessionAttributeGenerator, declared thus:
<map:generator name="session-attr" logger="sitemap.generator.session-attr" src="org.apache.cocoon.generation.SessionAttributeGenerator"/>

It just grabs a session attribute object which in this case is the xml document we've cobbled together from the flowscript.

Hope this helps!

That does help. It helps a lot! Thanks, Tony...

It's now on my to-do list to spiff up the userdoc for SessionAttributeGenerator :-)... there's not a whole lot there right now :-/.

It would be slightly more elegant to be able to pass the source data in directly to sendPage() instead of stashing it in the session, but that hardly seems to justify the trouble of writing a whole damn generator! Anyway, it was quite instructive to look at the implementation of SessionAttributeGenerator... I learned a little more about how Cocoon works, and also see the better way if I were to write an "XMLGenerator" component — viz., let XMLUtils.valueOf() do all the work for me :-)

So, thx-a-lot!
~ml

Reply via email to