I'm trying to create a logicsheet to act as a page hit counter. I want to
expand on the functionality of cocoon's counter but I'm having problems
getting the simplest of logicsheets to work correctly. Cocoon finds the
logic sheet ok but applies it as if it were a plain style sheet. None of the
xsp tags are parsed or executed. I'm running Cocoon 2.0.2-dev, Tomcat 4.1.3b
and JDK1.4. I know the logicsheet is pretty much pointless right now but I
figured I'd try to get something simple working first. Here are my files and
directory structure.

-Eric Dalquist


<TOMCAT>
    \WebApps
        \cocoon
            \WEB-INF
                coccon.xconf
            \logicsheets
                pgutil.xsl
            page_info.xsp

----------------------------------------------------------------------------
----
Here is my logicsheet definition in cocoon.xconf:
  <markup-languages>
    <xsp-language logger="core.markup.xsp" name="xsp">
      <parameter name="prefix" value="xsp"/>
      <parameter name="uri" value="http://apache.org/xsp"/>

      <target-language name="java">

         <!-- ... a bunch of built in logicsheets ... -->

        <builtin-logicsheet>
          <parameter name="prefix" value="pgutil"/>
          <parameter name="uri"
value="http://www.incoherentramlbings.net/XML/xmlns/pgutil/1.0"/>
          <parameter name="href" value="file:///C:/Program Files/Apache
Group/Tomcat 4.1/webapps/cocoon/logicsheets/pgutil.xsl"/>
        </builtin-logicsheet>

    <!-- all the tags are actually closed -->
----------------------------------------------------------------------------
----

----------------------------------------------------------------------------
----
Here is the logicsheet:
<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xsp="http://www.apache.org/1999/XSP/Core";
        xmlns:esql="http://apache.org/cocoon/SQL/v2";

xmlns:pgutil="http://www.incoherentramlbings.net/XML/xmlns/pgutil/1.0";
        version="1.0">

<!-- rewrite the page -->
<xsl:template match="xsp:page">
    <xsl:copy>
        <xsl:apply-templates select="@*"/>
        <xsl:apply-templates/>
    </xsl:copy>
</xsl:template>

<!-- a counter for any page, matches on its uri -->
<xsl:template match="pgutil:page-counter">
    <xsp:logic>
        String uri = request.getRequestURI();

        <pageURI><xsp:expr>uri</xsp:expr></pageURI>
    </xsp:logic>
</xsl:template>

<!-- This template simply copies stuff that doesn't match other -->
<!-- templates and applies templates to any children.           -->
<xsl:template match="@*|node()" priority="-1">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>
----------------------------------------------------------------------------
----

----------------------------------------------------------------------------
----
Here is the XSP I'm trying to use the logicsheet in:
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:esql="http://apache.org/cocoon/SQL/v2";
    xmlns:xsp-session="http://apache.org/xsp/session/2.0";
    xmlns:pgutil="http://www.incoherentramlbings.net/XML/xmlns/pgutil/1.0";
    >

    <page>
        <page_header/>
        <page_body>
            <pgutil:page-counter/>
        </page_body>
    </page>
</xsp:page>
----------------------------------------------------------------------------
----




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