You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jonathan Stimmel <js...@taos.com> on 2000/07/05 20:58:52 UTC

Dynamic arguments to a Logicsheet?

I've finally begun ot play with logicsheets over the past couple
weeks, and for the most part they've worked as I expected.

One thing I can't see how to do is to pass dynamic data to a custom
tag. I can do:
  <ns:myTag param="value"/>
but not:
  <ns:myTag>
    <xsp:attribute name="param">
      <request:get-parameter name="param"/>
    </xsp:attribute>
  </ns:myTag>

Also, my logicsheet is just a wrapper around the sql taglib, however
I have to add "xmlns:sql='http://www.apache.org/1999/SQL' to both the
logicsheet and xsp page (the latter shouldn't need to know about the
implementation of the taglib, IMO).

Are these actual limitations, or am I just missing something obvious?


-- 

Jonathan Stimmel                    Pager:  408-939-7876
jstimmel@taos.com                 jstimmel.page@taos.com

Re: Dynamic arguments to a Logicsheet?

Posted by Jonathan Stimmel <jo...@stimmel.net>.
On Wed, Jul 05, 2000 at 11:58:52AM -0700, Jonathan Stimmel wrote:

> One thing I can't see how to do is to pass dynamic data to a custom
> tag. I can do:
>   <ns:myTag param="value"/>
> but not:
>   <ns:myTag>
>     <xsp:attribute name="param">
>       <request:get-parameter name="param"/>
>     </xsp:attribute>
>   </ns:myTag>

Ok, I've almost got this working, thanks to some documentation in the
cocoon2 source branch. The catch is that you must use child nodes
to pass dynamic data:
  <ns:myTag>
    <ns:param><request:get-parameter name="param"/></ns:param>
  </ns:myTag>
However, I now have the following ugly code in my logicsheet:
  <sql:query>
    <xsl:text>SELECT * FROM Table</xsl:text>
    <xsl:text> WHERE Column=" +</xsl:text>
    <xsl:call-template name="get-nested-string">
      <xsl:with-param name="content" select="dir:category"/>
    </xsl:call-template>
    <xsl:text>+ "</xsl:text>
  </sql:query>
I borrowed get-nested-string from the sql logicsheet. Note the '" +'
and '+ "' I had to add to get the generated code correct. The <xsl:text>
nodes are also rather annoying; without them, I had to place the entire
query on a single line.

Re: Dynamic arguments to a Logicsheet?

Posted by Uli Mayring <ul...@denic.de>.
On Wed, 5 Jul 2000, Jonathan Stimmel wrote:

> 
> tag. I can do:
>   <ns:myTag param="value"/>
> but not:
>   <ns:myTag>
>     <xsp:attribute name="param">
>       <request:get-parameter name="param"/>
>     </xsp:attribute>
>   </ns:myTag>

In XSL you would do:

<xsl:element name="ns:myTag">
<xsl:attribute name="param"> ...

I don't know if XSP also has a <xsp:element> thing, you should check it
out.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Softwareentwicklung