-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Jason, you might be bringing me on the right track here.
Let me clarify: >> Unfortunately I seem not to be able to get the session context in the >> sitemap to log anything meaningful. I mean the DefaultContextManager class does not _log_ anything meaningful to actually debug the problem. Here is my locally patched version to see what actually goes on in there - --- /** * Get a public context. * The session context with the given name is returned. If the context does * not exist <CODE>null</CODE> is returned. */ public SessionContext getContext(String name) throws ProcessingException { // synchronized if (this.getLogger().isDebugEnabled() ) { this.getLogger().debug("BEGIN getContext name=" + name); } SessionContext context; if (this.isReservedContextName(name) ) { context = this.getReservedContext(name); } else { Session session = this.getSession(false); if ( session != null) { synchronized (session) { final Map contexts = this.getSessionContexts( session ); context = (SessionContext)contexts.get(name); } } else { if (this.getLogger().isDebugEnabled() ) { this.getLogger().debug("getContext no session"); } context = null; } } if (this.getLogger().isDebugEnabled() ) { this.getLogger().debug("END getContext context=" + context + "; nodes="+(context==null?"":(context.getNodeList("/").toString()))); } return context; } - --- However, what I try to do is the following: * I have a registration page (form) that goes through the session transformer to write to a file users.xml a new entry for a user. * I have an XSL transformation, creation a confirmation key. * I need to send an e-mail to the person registering, with that generated authentication key. If I hear you correctly it is not possible in the _same request_ to have this key generated (via XSLT) written to a session context via the session transformer and then read it in the sitemap (in order to get it into the e-mail body.). I thought the existence of the temporary session context would point to exactly this use case. Am I wrong? By the way what exactly is a session attribute? I'm using the session-context input module. Is session-attr simply a synonym? Because it appears that one could access xml elements "/my_element" as well as attributes "/my_element/@my_attribute" from the context. Thanks for the help! I really appreciate it. K<o> Jason Johnston wrote: > Kaj Kandler wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Hi Joeren, >> thanks for helping me here. I tried a lot of things, off course. But >> after hours of experimenting and trying to find some decent logging that >> would reveal my problem, I resorted to looking for help. >> >> According to >> http://cocoon.apache.org/2.1/developing/webapps/contexts.html, there is >> always a temporary context available to do what I want to do (preserve a >> value until the end of the request. "Using the tempory context it is >> possible to store any XML information for processing the current >> request." >> >> The attempt to use a path="/key" does no difference. >> >> <session:createcontext name="temp"></session:createcontext> >> <session:setxml context="temp" path="/key"><xsl:value-of >> select="concat('cu',$rnd)"/></session:setxml> >> >> Makes no difference either. > ... >> Unfortunately I seem not to be able to get the session context in the >> sitemap to log anything meaningful. > > When you say "get the session context in the sitemap", what exactly are > you trying to do? Trying to access a session attribute in the sitemap > via the {session-attr:blah} input module or something? If so, then this > will not work with the session transformer. The reason is that the > sitemap is completely evaluated to set up the pipeline *before* any > content starts to be fed through the pipeline. So it's impossible to > make any choices in the sitemap based on content going through the > pipeline. > > If you mean something else, could you give details? > > >> >> Once again, thanks for helping me out here. >> K<o> >> >> Jeroen Reijn wrote: >>> Hi Kaj, >>> >>> i do not have a lot of experience with the session-context and session >>> transformer, but i will try as much as I can to help you out. >>> >>>> I have a stylesheet that creates a key >>>> - --- >>>> <xsl:stylesheet >>>> version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >>>> xmlns:session="http://apache.org/cocoon/session/1.0"> >>>> >>>> <xsl:template match="key"> >>>> <!-- create some random number as base for a confirmation URL --> >>>> <xsl:variable name="rnd" select="translate(math:random(),'.','x')" >>>> xmlns:math="xalan://java.lang.Math"/> >>>> <xsl:copy> >>>> <xsl:value-of select="concat('cu',$rnd)"/> >>>> </xsl:copy> >>>> <session:setxml context="temporary" path="my_key"><xsl:value-of >>>> select="concat('cu',$rnd)"/></session:setxml> >>>> </xsl:template> >>>> ... >>> >>> Looking at the documentation about the session-context the following >>> issues come to mind: >>> >>> In the example they create their own context first by doing: >>> <session:createcontext name="trackdemo"/> >>> >>> Where trackdemo is the context used somewhere else in the xml body like: >>> <session:mergexml context="trackdemo" path="/context"> >>> >>> So my first question: did you set your context? If so did you try to add >>> a / in front of your path? >>> >>> What happens if you do it like this? >>> >>> Regards, >>> >>> Jeroen Reijn >>> Hippo > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - -- [EMAIL PROTECTED] http://conficio.blogspot.com/ ================================================ | We teach software one screencast at a time | ================================================ http://www.conficio.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) iD8DBQFFRhYoRDUvrJRNjTARAnuMAJ44EUAgwHgW6psRVGDobB4J5RQNtgCfVZ4c +Zq0wuuMEjtO6I7Km8G5Rz0= =DhzF -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]