I'm not an expert (sorry) so this is only a suggestion

1)  some whitespaces might interfere between the string
'add_to_favourites_session' and the value of the $webaction-value variable.
I would suggest a formula more like ;


 <xsl:if test="contains(normalize-space($webaction-value),
and contains('add_to_favourites_session',

...just to make sure.

2) In xsl, calling a variable by xsl:value-of only selects the string part
of the nodes (the text()). It means that if the variable is more than simple
text and include nodes around it or inside it (it's called a node-set or
nodeset because it contains tags and text, hope I'm not making too much
mistakes saying that), only the text will appear when asking for

xsl-copy-of on the other hand, copies all what is inside the variable, nodes
(tags) and text and attributes ...

The best referenc is at the xsl FAQ (in the "variable"  page):

Solution (if that is the problem, which is not sure at all):
Most xsl processor have a "node-set" or "nodeset" function which is an
extension of the xsl specification. For xalan it's xalan:nodeset, but you've
got some for saxon or xt. (beware, you've got to add the specific namespace
of your processor on top of your page for this tags to be executed)

This stuff enable you to check parts by parts the inside of the variable,
for exemple calling by templates for each part (nodes attributes and text)

Hope it helps, but I guess you might want better information. The xsl list
is very active.

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

François Parlant

----- Original Message ----- 
From: "C Bram Dit Saint Amand" <[EMAIL PROTECTED]>
Sent: Sunday, June 29, 2003 10:50 PM
Subject: <xsp-request:get-parameter> into <xsl:variable> problem

> This is an extract from "request_attributes.xsl", a logicsheet which is
> called by "some_page.xsp"
> ----
> <xsl:template match="request-attributes:get/webaction">
>     <xsl:variable name="webaction-value"><xsp-request:get-parameter
> name="webaction"/></xsl:variable>
>     <xsl:if test="contains($webaction-value, 'add_to_favourites_session')
> and contains('add_to_favourites_session', $webaction-value)">
>         <esql:connection>
>           <esql:pool>perso-mysql</esql:pool>
>           <esql:execute-query>
>             <esql:query>INSERT INTO FavouritesBasketSession(SessionID,
> URL) VALUES('<xsp-session:get-id/>', '<xsp-request:get-attribute
> name="relative-url"/>');</esql:query>
>           </esql:execute-query>
>         </esql:connection>
>     </xsl:if> </xsl:template>
> ----
> When I access "some_page.xsp?webaction=add_to_favourites_session", the
> template is executed: the <xsl:variable> is created, but what is inside
> the <xsl:if> *isn't* executed, which suggests that there is a problem with
> the <xsl:variable>. For information, displaying the variable's content
> with <xsl:copy-of> works (it correctly displays
> 'add_to_favourites_session'), but with <xsl:value-of> it doesn't display
> anything.
> The questions:
> --------------
> - Why doesn't it work?
> - I'm a Cocoon newbie, so if you have any comments on my code (how to
> write it better), I'm open to suggestions.
> Thanks in advance.

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

Reply via email to