Hi all,
I would like to have a web application where I can initially load data from
a cocoon pipeline into my session context. I have successfully written a
style sheet were in two steps I create a session context (createcontext) and
then manually load data in it using the setxml tag.

Example 1.  Here is a simple pipeline and xslt example that is applied to an
empty xml file (dummy.xml) and outputs: "<monContexte>It
works</monContexte>".

The style sheet:
<?xml version="1.0"?>
<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="/">
                <monContexte>
                        <session:createcontext name="monContexte"/>
                        <session:setxml context="monContexte"
path="/profile/usager">It works</session:setxml>
                        <session:getxml context="monContexte"
path="/profile/usager">dop!</session:getxml>
                </monContexte>
        </xsl:template>
</xsl:stylesheet>

and the pipeline:
<map:pipeline>
        <map:match pattern="initContexte">
                <map:generate src="dummy.xml"/>
                         <map:transform
src="stylesheets/initContexte.xslt"/>
                        <map:transform type="session"/>
                         <map:serialize type="xml"/>
          </map:match>
</map:pipeline>



However I would like to fill my session context with a cocoon pipeline that
retrieves data from a database. I tried using the load attribute in the
createcontext tag without any success ( <createcontext name="mycontext"
load="cocoon://load-from-db" save="cocoon://save-to-db"/> ). 

Example 2. Here is a simple example that I can't get to work but should
output: "<monContexte>It works</monContexte>". I'm presently getting the
following output: "<monContexte>dop!</monContexte>". The same pipeline as
example 1 is used here also:

<?xml version="1.0"?>
<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="/">
                <monContexte>
                        <session:createcontext name="monContexte"
load="cocoon:/profileAnonyme"/>
                        <session:getxml context="monContexte"
path="/profile/usager">dop!</session:getxml>
                </monContexte>
        </xsl:template>
</xsl:stylesheet>

Here is the cocoon:/profileAnonyme pipeline output:
<?xml version="1.0" encoding="ISO-8859-1" ?> 
<profile> 
        <usager>It works</usager> 
</profile>

Are there examples or more documentation available other then what is found
in the cocoon user docs
(http://cocoon.apache.org/2.1/developing/webapps/contexts.html)? Has anybody
successfully used the createcontext "load" and "save" attributes?

Cheers

Héryk Julien
Laboratoire de cartographie numérique et de photogrammétrie (LCNP)
Commission géologique du Canada, CGC-Québec
Ressources naturelles du Canada

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to