cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <>
Subject Re: limiting rowset size in SQLTransformer
Date Mon, 07 Apr 2003 14:18:16 GMT
Ferenc Kiraly wrote:

> Vadim Gritsenko wrote:
>> Ferenc Kiraly wrote:
>>>     Hi!
>> ...
>>> In particular, I wanted to write a logicsheet, that processes a
>>> <browseable-table> tag. The logicsheet template takes parameters, 
>>> such as
>>> <offset>, <limit> and <query>. The values for these parameters
>>> from
>>> the request or from the session. I was not able to pass these 
>>> parameters
>>> to the logicsheet _and_ use them in ESQL at the same time, 
>> are you talking about use-limit-clause parameter? Similar to this 
>> should work:
>> <esql:use-limit-clause><xsp-session:get-attribute 
>> name="limit"/></esql:use-limit-clause>
> Yes, I agree. But this will not:
> XSP:========================================
> <myns:mytag>
>  <myns:limit><xsp-session:get-attribute name="limit"/></myns:limit>
>  ...
> </myns:mytag>
> XSL for myns:================================
> <xsl:include href="logicsheet-util.xsl"/>
> <xsl:template match="myns:mytag">
>  <xsl:variable name="limit">
>    <xsl:call-template name="get-parameter">
>      <xsl:with-param name="name" select="'limit'"/>
>    </xsl:call-template>
>  </xsl:variable>
>  <esql:execute-query>
>     <esql:use-limit-clause>auto</esql:use-limit-clause>
>     <esql:max-rows><xsl:value-of select="$limit"></esql:max-rows> 

xsp-session:get-attribute tag gets rolled out by xsp-session logicsheet 
into SEVERAL XSP TAGS. Here, instead of placing those tags, you are 
taking text value of them. See how other logicsheets pass the 
parameters. IIRC, you have to use xsl:copy-of (copy those several XSP 
tags, so later they can be translated to Java) instead of value-of (text 
of those several XSP tags, which does not make much sense).

>     ...
>  </esql:execute-query>
> </xsl:template>
> ============================================
> Replacing <xsp-session:get-attribute name="limit"/> in the above example
> with a literal, e.g. 15, will work though.
> And as far as I can tell this is not particular to ESQL or 
> logicsheet-util.xsl.
> In some circumstances <xsp-session:get-attribute .../> looses it's 
> value when
> passed through a logicsheet. An I would sure want to understand why. 

Please do the exercise. Have a simple pipeline starting with XML 
generator for your xsp page and several xslt transformers, for each 
logicsheet you are using:

<map:generate src="my.xsp"/>
<map:transform src=".../xsp-session.xsl"/>
<map:transform src=".../my-logicsheet.xsl"/>
<map:transform src=".../esql.xsl"/>
<map:transform src=".../xsp.xsl"/>
<map:serialize type="xml"/>

Examine results after each transformation step (start with one 
transformer, and keep on adding, see how page is getting transformed 
into program).

> It's
> probably because I don't understand things properly, but from a web app
> developer point of view there is no reason why the above should not be
> allowed. 

It's allowed; it's just the matter of writing logicsheet with proper 
parameter processing.


> Please enlighten me about why I am resoning wrong. I have brought
> this up on cocoon-user already, as have others, with no satisfactory
> explanation. Thanks.
>     feri. 


View raw message