You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "K.P.Majoor" <kp...@7bulls.com> on 2001/05/24 15:34:56 UTC

esql-get as parameter

Hi everybody!


I'm trying to get recursively results from my dbase like this :

<xsl:template match="kblib:root-cat">

  <esql:execute-query>
    <esql:query>SELECT name, category_id FROM categories WHERE
categoryPar=null</esql:query>
    <esql:results>

       <esql:row-results>
       <category>
          <name>
              <xsl:call-template name="kids">
               <xsl:with-param name="id"><esql:get-string
column="name"/></xsl:with-param>
              <xsl:with-param name="ancestor"><xsl:number level="any"
count="kblib:root-cat" format="1"/></xsl:with-param>
             </xsl:call-template>

                  <esql:get-string column="name"/>
          </name>
    </category>
  </esql:row-results>

 </esql:results>
</esql:execute-query>

<xsl:template match="kblib:kid-cat" name="kids">
 <xsl:param name="id"/>
 <category> <name> <xsl:value-of select="$id"/> </name> </category>
</xsl:template>

I don't understand why the esql-get does not return anything into the id
parameter of the kid template....? If I replace it with a string, it
works.
The second esql-get returns the values perfect like I want to have them.

Eventually the structure shoudl be sth like this :

  <category>
    <name></name>
    <category>
        <name></name>
        <category>
            <name></name>
        </category>
  </category>
</category>

Does anybody have an idea why this does not work?

Thanx!





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

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: esql-get as parameter

Posted by "K.P.Majoor" <kp...@7bulls.com>.
Thanks Donald,

I figured that it (unfortunately) has to be done like that,  a Java function
getting all these categoyr/pairs in an XML structure, and XSL making
something way cool out of it ;-)

I'll post the result hopefully soon.


Donald Ball wrote:

> On Thu, 24 May 2001, K.P.Majoor wrote:
>
> > I'm trying to get recursively results from my dbase like this :
> >
> > <xsl:template match="kblib:root-cat">
> >
> >   <esql:execute-query>
> >     <esql:query>SELECT name, category_id FROM categories WHERE
> > categoryPar=null</esql:query>
> >     <esql:results>
> >
> >        <esql:row-results>
> >        <category>
> >           <name>
> >               <xsl:call-template name="kids">
> >                <xsl:with-param name="id"><esql:get-string
> > column="name"/></xsl:with-param>
> >               <xsl:with-param name="ancestor"><xsl:number level="any"
> > count="kblib:root-cat" format="1"/></xsl:with-param>
> >              </xsl:call-template>
> >
> >                   <esql:get-string column="name"/>
> >           </name>
> >     </category>
> >   </esql:row-results>
> >
> >  </esql:results>
> > </esql:execute-query>
> >
> > <xsl:template match="kblib:kid-cat" name="kids">
> >  <xsl:param name="id"/>
> >  <category> <name> <xsl:value-of select="$id"/> </name> </category>
> > </xsl:template>
> >
> > I don't understand why the esql-get does not return anything into the id
> > parameter of the kid template....? If I replace it with a string, it
> > works.
> > The second esql-get returns the values perfect like I want to have them.
> >
> > Eventually the structure shoudl be sth like this :
> >
> >   <category>
> >     <name></name>
> >     <category>
> >         <name></name>
> >         <category>
> >             <name></name>
> >         </category>
> >   </category>
> > </category>
> >
> > Does anybody have an idea why this does not work?
>
> yeah - esql/xsp is _not_ able to handle creation of arbitrarily deep
> nested content like this - it would require creating and recursively
> calling a java method, which isn't the easiest thing in the world to do in
> xsp. however, if you generate a simple list of category/name pair things,
> you should be able to massage it into an arbitrarily deep nested tree
> structure using xslt.
>
> - donald
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


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

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: esql-get as parameter

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 24 May 2001, K.P.Majoor wrote:

> I'm trying to get recursively results from my dbase like this :
>
> <xsl:template match="kblib:root-cat">
>
>   <esql:execute-query>
>     <esql:query>SELECT name, category_id FROM categories WHERE
> categoryPar=null</esql:query>
>     <esql:results>
>
>        <esql:row-results>
>        <category>
>           <name>
>               <xsl:call-template name="kids">
>                <xsl:with-param name="id"><esql:get-string
> column="name"/></xsl:with-param>
>               <xsl:with-param name="ancestor"><xsl:number level="any"
> count="kblib:root-cat" format="1"/></xsl:with-param>
>              </xsl:call-template>
>
>                   <esql:get-string column="name"/>
>           </name>
>     </category>
>   </esql:row-results>
>
>  </esql:results>
> </esql:execute-query>
>
> <xsl:template match="kblib:kid-cat" name="kids">
>  <xsl:param name="id"/>
>  <category> <name> <xsl:value-of select="$id"/> </name> </category>
> </xsl:template>
>
> I don't understand why the esql-get does not return anything into the id
> parameter of the kid template....? If I replace it with a string, it
> works.
> The second esql-get returns the values perfect like I want to have them.
>
> Eventually the structure shoudl be sth like this :
>
>   <category>
>     <name></name>
>     <category>
>         <name></name>
>         <category>
>             <name></name>
>         </category>
>   </category>
> </category>
>
> Does anybody have an idea why this does not work?

yeah - esql/xsp is _not_ able to handle creation of arbitrarily deep
nested content like this - it would require creating and recursively
calling a java method, which isn't the easiest thing in the world to do in
xsp. however, if you generate a simple list of category/name pair things,
you should be able to massage it into an arbitrarily deep nested tree
structure using xslt.

- donald


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

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>