cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Painter-Wakefield" <paint...@mc.duke.edu>
Subject Re: [c1]<esql:get-int ...> as param for <xsl:call-template ...>
Date Thu, 16 Aug 2001 14:52:21 GMT

Hubert,

you are mixing two different things.  Keep in mind that when you are
writing a logicsheet, you are writing an XSLT stylesheet that will
transform based only on what is available to it in your XML file.  This
happens once and only once, statically, to generate Java code which will
then be compiled.  The output of the Java code will then be run to produce
the actual XML which feeds into the rest of the pipeline (stylesheets and
so forth).

The ESQL taglib is also a logicsheet, so it produces Java code.  The
results of the <esql:get-int ...> operation won't be available until after
it is transformed by the esql logicsheet into Java code, compiled, then
run.  Your logicsheet, however, is trying to use the result long before any
of that happens.  In other words, you are not passing the results of a
database operation as a parameter into your <xsl:call-template>, you are
passing XML that happens to look like <esql:get-int ...>.  Or, if the esql
logicsheet happens to be applied first, then you are passing Java code,
*not* the results of running that code.

Hope this helps.

-Christopher





Please respond to cocoon-users@xml.apache.org

To:   <cocoon-users@xml.apache.org>
cc:

Subject:  [c1]<esql:get-int ...> as param for <xsl:call-template ...>


Hi all,

    I want to get something like this:

<elem id="top_el_id">
    <sub_elements count="sub_cnt">
        <elem id="sub_el_id_1"></elem>
        <elem id="sub_el_id_2"></elem>
        <elem id="sub_el_id_3"></elem>
        <elem id="sub_el_id_4"></elem>
    </sub_elements>
</elem>

XML file:
<?xml version="1.0" encoding="iso-8859-2"?>
<?xml-logicsheet href="my_taglib.xsl"?>
<?cocoon-process type="xsp"?>
<xsp:page
    xmlns:my_taglib="http://my_host/my_taglib"
    xmlns:xsp="http://www.apache.org/1999/XSP/Core"
    xmlns:esql="http://apache.org/cocoon/SQL/v2">
    ...
    <my_taglib:loc id="1"/>
    ...
</xso:page>

logcsheet: my_taglib.xsl:
<?xml version="1.0" encoding="iso-8859-2"?>
<xsl:stylesheet version="1.1"

    xmlns:my_taglib="http://my_host/my_taglib"
    xmlns:esql="http://apache.org/cocoon/SQL/v2"
    xmlns:xsp="http://www.apache.org/1999/XSP/Core"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="xsp:page">
        ...
    </xls:template>

    <xsl:template match="my_taglib:loc" name="loc-tag">
        <!-- selecting data from DB, based on parameter id,
            parameter id is set to attribute id if attribute id is valid
number,
            if element has any subelements, i want them to be in
sub_element
tag,
            but ids of this subelements are stored in DB and are depending
on id of current
            element, so i try: -->

        <xsl:call-template name="loc-tag">
            <xsl:with-param name="id"><esql:get-int
column="sl"/></xsl:with-param>
        </xsl:call-template>

        <!-- unfortunetly <esql:get-int column="sl"/> is not substituted
with any value
            and i get infinite recursion, beacause if id param or attribute
are not provided
            i try to work, and process all elements in DB, but some
elements
have subelements,
            and again <xsl:call-template name="loc-tag"> with no param -->
    </xsl:template>

I think error may be in order of inclusion taglibs, but can't find good
one,

Thanks in advance,
    Hubert.







---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message