cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Perryman <bperryman...@yahoo.com>
Subject Re: <session:getxml> not allowed in this position in the styleshe et
Date Fri, 12 Dec 2003 16:27:35 GMT
Thanks for responding, Julien.

I understand this example and have used it in my
application in other areas, but for this specific use
it doesn't seem to work for me.
I would need session:getxml to work like a
xsl:value-of tag. It seems that I can only get
session:getxml to work within it's own tag (ie.
<name><session:getxml.../></name>)
If I try to use it within an <xsl:variable> or
<xsl:attribute> tag, it doesn't retrieve the value for
me.

In summary, I need an xsl stylesheet which will
retrieve the color, which I store in the session, and
place it in the bgcolor attribute of the body tag of
the html. This stylesheet has to be self-contained,
because I want to include it in other stylesheets to
save duplicating code.

I have all the pieces working with the exception of
retrieving the color from the session because of my
session:getxml problem. I can pass the color along
from another stylesheet preceding the main as a
work-around, but that might be too "clunky". 

Any suggestions would be appreciated. Sorry for this
thread going so long.

Thanks.
--- julien bloit <Julien.Bloit@ircam.fr> wrote:
> You can take a look at this little shopping-cart
> example :
> http://wiki.osmosis.gr/Wiki.jsp?page=SimpleCart
> 
> it uses session tags to store and retreive data from
> a context from within
> an xsl, with parameters passed to it. It might not
> perfectly match your
> problem but it's one working example.
> 
> regards,
> julien
> 
> ----- Original Message ----- 
> From: "Bruce Perryman" <bperryman_us@yahoo.com>
> To: <users@cocoon.apache.org>
> Sent: Friday, December 12, 2003 3:06 PM
> Subject: RE: <session:getxml> not allowed in this
> position in the styleshe
> et
> 
> 
> > Sorry about the closing attribute tag. That was a
> typo
> > that was in my message but wasn't in my
> application.
> > I'm a bit confused by your response.
> >
> > If I store your name in a session context, can I
> > retrieve it using a session action in the sitemap
> and
> > pass it as a parameter to my stylesheet? That
> would
> > work, but I didn't think that I could do that.
> >
> > --- Fleischer Roman <roman.fleischer@siemens.com>
> > wrote:
> > > I tried to check your solution and find out,
> that
> > > you typed mismatch in the
> > > closing </xsl:attribute> tag. You wrote
> "attribue".
> > > I think this is the error. If not, please try my
> > > solution wit a
> > > request-param.
> > >
> > > #### file sessionTest.xsl ##########
> > > <?xml version="1.0" encoding="UTF-8"
> > >
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"?>
> > > <xsl:stylesheet version="1.0">
> > > <xsl:param name="sessionId"/>
> > > <xsl:param name="color"/>
> > > <xsl:template match="/">
> > > <sessionId><xsl:value-of
> > > select="$sessionId"/></sessionId>
> > > <html>
> > >  <body>
> > >    <xsl:attribute name="bgcolor"><xsl:value-of
> > > select="$color"/></xsl:attribute>
> > > <p>Hello</p>
> > > </body>
> > > </html>
> > > </xsl:template>
> > > </xsl:stylesheet>
> > >
> > > #### matcher in the sitemap ####
> > > <map:match pattern="sessionTest">
> > > <map:act type="session">
> > > <map:generate type="request"/>
> > > <map:transform type="xslt"
> src="sessionTest.xsl">
> > > <map:parameter name="sessionId"
> > > value="{session:id}"/>
> > > <map:parameter name="color"
> > > value="{request-param:color}"/>
> > > </map:transform>
> > > <map:serialize type="html"/>
> > > </map:act>
> > > </map:match>
> > >
> > > This works for me
> > > Greetings
> > > Roman
> > >
> > > -----Original Message-----
> > > From: Bruce Perryman
> [mailto:bperryman_us@yahoo.com]
> > > Sent: Mittwoch, 10. Dezember 2003 17:45
> > > To: users@cocoon.apache.org
> > > Subject: Re: <session:getxml> not allowed in
> this
> > > position in the
> > > stylesheet
> > >
> > >
> > > Hi everyone,
> > >
> > > Thanks for responding.
> > >
> > > I've tried Julien's and Roman's suggestion
> before
> > > and
> > > again, but I haven't had any success. Here are
> the
> > > results:
> > >
> > > <html>
> > >  <body>
> > >    <xsl:attribute name="bgcolor">
> > >      <session:getxml context="usrstuff"
> > > path="/bcolr"/>
> > >    </xsl:attribue>
> > >  </body>
> > > </html>
> > >
> > > This yields:
> > > <html>
> > >  <body bgcolor=""/>
> > > </html>
> > >
> > > I added an additional
> > >
> > > <bc>
> > >  <session:getxml context="usrstuff"
> path="/bcolr"/>
> > > </bc>
> > >
> > > tag and session request before the above body
> tag
> > > just
> > > to see what would happen. The result was:
> > >
> > > <html>
> > >  <bc>
> > >    blue
> > >  </bc>
> > >  <body bgcolor=""/>
> > > </html>
> > >
> > > When attempting Stephanie's suggestion, I
> received
> > > the
> > > error that said that <session:getxml> is not
> allowed
> > > in this position in the stylesheet in the
> error.log
> > > file.
> > >
> > > Thanks.
> > >
> > > --- julien bloit <Julien.Bloit@ircam.fr> wrote:
> > > >
> > > > ----- Original Message ----- 
> > > > From: "Bruce Perryman"
> <bperryman_us@yahoo.com>
> > > > To: <users@cocoon.apache.org>
> > > > Cc: <Julien.Bloit@ircam.fr>
> > > > Sent: Wednesday, December 10, 2003 1:52 PM
> > > > Subject: Re: <session:getxml> not allowed in
> this
> > > > position in the stylesheet
> > > >
> > > >
> > > > > Hi Julien,
> > > > >
> > > > > Thanks for your response.
> > > > >
> > > > > I have the session namespace declared in my
> > > > > stylesheet,  and a simple request will work.
> For
> > > > > example:
> > > > >
> > > > > <name>
> > > > >  <session:getxml context="usrstuff"
> > > > path="/fname"/>
> > > > > </name>
> > > > >
> > > >
> > > > Does this return
> > > > <name>nameReturned</name>
> > > > ?
> > > >
> > > > > works fine. But if I want to have the
> background
> > > > color
> > > > > of an html page to be retrieved from the
> session
> > > > and
> > > > > placed in a body tag, I can't get it to
> work.
> > > > >
> > > > > <html>
> > > > >  <body bgcolor="X"> (where 'X' would come
> from
> > > > > session)
> > > > >  </body>
> > > > > </html>
> > > > >
> > > > > I've tried xsl:variables, xsl:attributes
> with no
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


Mime
View raw message