The session transformer in a pipeline manipulates the session.
You give it an input document:
<work xmlns:s="http://apache.org/cocoon/session/1.0"> <s:createcontext name="mystuff"/> <s:setxml context="mystuff" path="/"> <stuff/> </s:setxml> <s:getxml context="mystuff" path="/"/> </work>
And it does what you say.