I use ESQL in one of my logicsheet (see below).
I think you have to put xmlns:esql="http://apache.org/cocoon/SQL/v2"; in your
XML file if you use ESQL in a logicsheet (I use ESQL in both the XML file
and the logicsheet, so I didn't have any troubles).

##########################################################
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsp="http://www.apache.org/1999/XSP/Core";
xmlns:esql="http://apache.org/cocoon/SQL/v2";
xmlns:request="http://www.apache.org/1999/XSP/Request";
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fragmentation="http://localhost/fragmentation";>

   <xsl:include href="../xsl/common-copy.xsl" /> <!-- to copy all the
elements (@*, nodes...) not processed here-->

        <xsl:template match="xsp:page">
                <xsp:page>
                        <xsl:apply-templates select="@*"/>
                        <xsp:logic>
                                String frag_query = null;
                        </xsp:logic>
                <xsl:apply-templates />
                </xsp:page>
        </xsl:template>

   <xsl:template match="fragmentation:get-fragment">
        <xsp:logic>
        frag_query = "select e.idensemble as id, e.xml as xml from ensemble
e";
        </xsp:logic>

      <esql:connection>
         <esql:pool>foo</esql:pool>

         <esql:execute-query>
            <esql:query><xsp:expr>frag_query</xsp:expr></esql:query>

            <esql:results>
               <esql:row-results>
                        <xsp:content>
                                                <fragmentation:fragment>
                                                        <xsl:if test =
"@get-id='true'">
        
<xsp:attribute name="id"><esql:get-int column="id" /></xsp:attribute>
                                                        </xsl:if>
                                                <esql:get-xml column="xml"
root="fragment"/>
                                                </fragmentation:fragment>
                                </xsp:content>
               </esql:row-results>

               <esql:no-results>...</esql:no-results>
            </esql:results>
         </esql:execute-query>
      </esql:connection>
   </xsl:template>

   ...
</xsl:stylesheet>


I my XML file:
##########################################################
<?xml version="1.0" encoding="iso-8859-1"?>
<?cocoon-process type="xsp"?>
<?xml-logicsheet href="xsp/foo-xsp.xsl"/?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="xsl/transform.xsl" type="text/xsl"?>
<xsp:page
  ...
  xmlns:fragmentation="http://localhost/fragmentation";
  xmlns:esql="http://apache.org/cocoon/SQL/v2";
  ...
>
...
        <fragmentation:get-fragment>
                ...
        </fragmentation:get-fragment>
...
</xsp:page>

> I've read through the ESQL docs and looked at many ESQL examples but I
> havent found an example which uses ESQL in the stylesheet 
> instead of the XML
> document.  I added the XML namespace for ESQL in my stylesheet tag:
> 
> <xsl:stylesheet version="1.0"
>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>      xmlns:esql="http://apache.org/cocoon/SQL/v2";
>      xmlns:xsp="http://www.apache.org/1999/XSP/Core";
> >
> ...
> 
> When I simply run esql tags in one of my templates it ignores 
> those tags and
> just prints out the data (like XSP isn't processing the ESQL tags).
> 
> I think it may have something to do with the <xsp:page> tags 
> or something.
> I poked around in some of the sample code, in the newsgroups 
> and the mailing
> list to try and find where someone used esql in their 
> stylesheet but couldnt
> find anything.
> 
> Any help would be appreciated!  Oh, and Olivier Jeulin, thanks for the
> pointer to the auth taglib - that works great!
> 
> - Brent
The auth taglib is in the list of "3rdparty" on cocoon's site
Olivier

---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to