cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ferenc Kiraly <>
Subject passing request parameters to templates
Date Mon, 10 Mar 2003 12:13:52 GMT

I am trying to use <xsp-request:get-parameter name="..."/> as a
parameter to a template defined in my own logicsheet.

I have looked at the mailing list archives, the documentation and
actually found info on how it is supposed ot be done, but it seems
that the above parameter does not get passed on. I must be missing
something. Please help, cause I'm getting desperate.

In the code bellow, the custom <mobi:fmd-request> tag correctly writes
out the second DEBUG: line, but in the first DEBUG: line, the
variable $dowhat seems to be empty. If instead of supplying
a dynamic parameter to mobi:fmd-request, I supply an attribute
'dowhat', the code works as expected. If I supply a literal
string instead of <xsp-request:get-parameter name="dothething"/>,
the string does get passed on to the template as expected.

I am using Cocoon 2.0.4, with tomcat 4.1.18 and Java 1.4 from Sun.



I tried the following in my XSP:

    <mobi:param name="dowhat"><xsp-request:get-parameter

And in the logischeet:

<xsl:template match="mobi:fmd-request">
   <xsl:variable name="dowhat">
     <xsl:call-template name="get-parameter">
      <xsl:with-param name="name">dowhat</xsl:with-param>

   <xsl:text>DEBUG: dowhat: </xsl:text><xsl:value-of select="$dowhat"/><br/>
   <xsl:text>DEBUG: dowhat: </xsl:text><xsp-request:get-parameter 



<xsl:template name="get-parameter">
<xsl:param name="name"/>
<xsl:param name="default"/>
<xsl:param name="required">false</xsl:param>

<xsl:variable name="qname">
   <xsl:value-of select="concat('mobi', ':param')"/>

   <xsl:when test="@*[name(.) = $name]">
     <xsl:value-of select="@*[name(.) = $name]"/>
   <xsl:when test="(*[name(.) = $qname])[@name = $name]">
     <xsl:call-template name="get-nested-content">
       <xsl:with-param name="content"
         select="(*[name(.) = $qname])[@name = $name]"/>
   <xsl:otherwise>... handle default and error ...</xsl:otherwise>

<xsl:template name="get-nested-content">
<xsl:param name="content"/>
   <xsl:when test="$content/*">
     <xsl:apply-templates select="$content/*"/>
   <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message