On 03.Jan.2003 -- 02:46 PM, Richard Bounds wrote:
> Dear all,
> 
> I'm trying to write a logicsheet that accepts dynamic parameters from the
> XSP page (e.g. maybe request parameters, or session attributes), and uses
> them to request data from our application. I'd like the xsp code to look
> something like this:
> 
> 
> 
>       <xsp:logic>
>               String sortParameter = request.getParameter("sort");
>       </xsp:logic>
> 
>       <data>
>          <parameters:categories>
>                       <xsp:param name="sortBy">
>                               <xsp:expr>sortParameter</xsp:expr>                     
>                                         </xsp:param>
>          </parameters:categories>
>       </data>
> 
> 
> 
> What do I need to put in my logicsheet code to pick up the "sortParameter"
> value? At the moment I've got the following:
> 
> 
> 
> <xsl:template match="parameters:categories">
> 
>   <xsl:variable name="sortBy">
>   <xsl:choose>
>       <xsl:when test="sortBy">
>         <xsl:call-template name="get-nested-content">
>           <xsl:with-param name="content" select="parameters:sortBy"/>
>         </xsl:call-template>
>       </xsl:when>
>     </xsl:choose>
>   </xsl:variable>
> 
>       <xsp:logic>
>                  System.out.println("Got value: " + "<xsl:copy-of select="$sortBy" 
>/>");
>       </xsp:logic>
> 
> </xsl:template>
> 
>  <xsl:template name="get-nested-content">
>     <xsl:param name="content"/>
>     <xsl:choose>
>       <xsl:when test="$content/*">
>         <xsl:apply-templates select="$content/*"/>
>       </xsl:when>
>       <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
>     </xsl:choose>
>   </xsl:template>

Look at the logicsheet-utils.xsl included in cocoon. It provides the
most commonly used templates including a get-nested-content named
template. Look at util.xsl as well as that logicsheet uses
logicsheet-utils.xsl for an idea how to do it.

        Chris.
-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to