cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Orgalist" <orgal...@wanadoo.fr>
Subject RE: XSP code reuse
Date Fri, 31 Aug 2001 12:25:55 GMT
If you know the values of idtype-inf you will use, you
can use this query :
select * from v_inf where idtype_inf=6 OR idtype_inf=7 OR idtype_inf=8...

or if the values follow each other ( 6,7,8,9...), use
for(int i=6; i<=9; i++)
{
...
select...<esql:parameter><xsp:expr>i</xsp:expr><esql:parameter>
...
}

hope this will help.
C.

-----Message d'origine-----
De : Alexandru COSTIN [mailto:acostin@interakt.ro]
Envoyé : vendredi 31 août 2001 15:02
À : cocoon-users@xml.apache.org
Objet : XSP code reuse


        Hello,
        I have created succesfully some dynamic pages using cocoon, but
I have one question about code reusability.
        The main problem is that in the XSP file, I have XML trees that
are very similar, except for a parameter.

        I will paste a code snippet below

<calevel>
        <esql:execute-query>
                <esql:query>
                        select * from v_inf where idtype_inf=6
                </esql:query>
                <esql:results>
                <esql:row-results>
                        <row>
				<id_inf><esql:get-string
					column="id_inf"/></id_inf>
				<name_itm><esql:get-string
					 column="name_itm"/></name_itm>
                        </row>
                 </esql:row-results>
                 </esql:results>
        </esql:execute-query>
</calevel>

        This part has to be repeated (with the same columns and
structure) with
idtype_inf=7,8, etc.
        How can I do this without rewritting this code snippet x-times?
A standard include mecanism has to be possible in Cocoon, or this can be
done otherwise.
        I think I have a solution, but I don't know if it's the best
one. This part can be embedded in a XSP:logic loop that uses an array
with the 6,7,8 values and pass the values to the embedded part.

                        Alexandru


--
-----------------------
Alexandru COSTIN
Product Manager
http://www.interakt.ro/
+401 777 1998


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


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