Hi!

I think your problem is right in this line:

<esql:get-int column="nu_descr_metricas_tst" ancestor="1"/>

Sometime ago I was trying to use the ancestor attribute with XSP, but this
does not work. :-(

As a workaround, create a <xsp:logic> block that will take the value you
need for the WHERE of the nested query.

Surely you will solve your problem with the workaround. It works for me.

Best Regards,

Antonio Gallardo


Luis Gois dijo:
>
> Hello.
>
> I'm facing a situation where I've tried almost everything and don't
> understand why ESQL doesn't work for a particular situation :
>
>       a) I have 3 cascading queries, i.e., the 2nd query placed inside
> esql:row-results of 1st query and 3rd query inside esql:row-results of
> 2nd query;
>       b) for the 3rd query, something strange happens :
>               1) Cocoon 2.0.2 :
> Using esql:get-string (2nd line from bottom):
> ===========================================
>
>       <!-- 3rd query -->
>       <esql:execute-query>
>               <esql:query>
>                       select aqa.nu_qms_activity_area
> asnum_activity_area, aqa.name_qms_activity_area as name_activity_area
>                       FROM opqa_metrics_tst omt, activities_qms_areas
> aqa
>                       WHERE omt.nu_descr_metrics_tst=<esql:get-int
> column="nu_descr_metricas_tst" ancestor="1"/>
>                       AND
> omt.name_project_tst='<xsp:expr>currentProduct</xsp:expr>'
>                       AND omt.name_release_project in
> <xsp:expr>releasesSet</xsp:expr>
>                       AND
> TO_CHAR(omt.date_input,'dd-mm-yyyy')='<xsp:expr>currentDate</xsp:expr>'
>                       AND aqa.nu_qms_activity_area =
> omt.nu_qms_activity_area
>                       order by num_activity_area asc
>               </esql:query>
>               <esql:results>
>               <esql:row-results>
>                       <metric>
>                               <xsp:attribute
> name="name"><xsp:expr>metricName</xsp:expr></xsp:attribute>
>                               <!-- =============== HERE IT IS
> ================================== -->
>                               <xsp:attribute
> name="activity_area"><esql:get-string
> column="name_activity_area"/></xsp:attribute>
>                               <xsp:logic>
>
>                               (...)
>
>
>
> the generated java is:
> =====================
>
>                       xspAttr.addAttribute(
>                       "",
>                               "activity_area",
>                             "activity_area",
>                             "CDATA",
>                             String.valueOf(.getBytes() != null ?
> EsqlHelper.getStringFromByteArray(.getBytes (), ) : "" )
>                   );
>
>
> Findings :
> ========
>
>       Looking at the esql.xsl, I see that the xsl:choose element at
> get-encoded-string template isn't properly processed when retrieving a
> value for the encoding variable, since even if I use <esql:get-string
> column="name_activity_area" encoding="default"/>, $encoding won't
> default to 'default'. If I copy that xsl:choose element outside the
> variable element do debugging purposes and watch at the generated java,
> I see that it correctly evaluates to a default value situation
> (xsl:otherwise). Again, specifying the encoding attribute in
> esql:get-string and then retrieving at the esql.xsl file the $encoding
> and  @encoding values, the first is '' and the second 'default'. How can
> this be possible?
>
>       Using esql:get-string in previous queries had a completely
> diferent JAVA code replacement, using getAscii() method for example. The
> call to esql:get-string has exactly the same attributes, the column
> types are exactly the same (though at XML->JAVA code transformation
> that's irrelevant).
>
>       Moving to Cocoon 2.0.4 didn't solve this problem. Now, the
> generated JAVA file has have something like
> EsqlHelper.getStringFromByteArray(default.getBytes()) -- notice at the
> default object. The error generated at compile time is related to
> getStringFromByteArray() method not found in EsqlHelper class. (I can
> give you more detailed error messages later, since those errors where
> generated yesterday night at work).
>
>       I thought that I was using a bad Xalan in my classpath or
> something similar but I've tried the code in 2 different platforms, an
> HP-UX and a Win2K machine and both generated the same java code and the
> same compilation errors.
>
>       This is really frustrating for me, a Cocoon1 "Vet" and for the
> persons who are now using Cocoon for the first time. I've developed some
> of applications in our project and never experienced this behaviour, but
> now, I'm lost!:( Help ...
>
>
> Regards,
> Luis Gois
>
>
>
> _______________________________________________________
> Vizzavi Mail powered by Vodafone - http://www.vizzavi.pt
> Virus protected by TrendMicro - http://www.antivirus.com
>
> ---------------------------------------------------------------------
> 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]>




---------------------------------------------------------------------
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