cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@neonics.com
Subject Cocoon2 Logicsheet example with static functions (fwd)
Date Tue, 09 Jan 2001 15:44:54 GMT


Hello fellow cocoon-users,

I see a lot of replies to other questions, but not to mine.

I dare you to make an XSP taglib in Cocoon2 which implements
the static count() function..

The util.xsp file in the Cocoon2 repository does not work. All the
tags are ignored, somehow. The log and request taglib work fine.
(I haven't tested the rest). The docs/samples/slides/lib-page.xml
does not work (it shows the util taglib)..

Has anybody gottem them to work? 


One more 'lame' question: it seems that Cocoon 2 does not support the
<?cocoon-process ...?> and <?xml-stylesheet ?> tags anymore.
Do you really have to put everything in the sitemap? That means
restarting Tomcat every time you add a page needing special treatment,
like a different stylesheet... this works kinda slow.


Greetings..

---------- Forwarded message ----------
Date: Tue, 9 Jan 2001 03:28:41 +0000 (UTC)
From: Forge <forge@homenet.neonics.com>
To: cocoon-users@xml.apache.org
Subject: [C2] Logicsheet example with static functions


Hello there,

Does anyone have a logicsheet example with static functions in it?
At the end i've included my logicsheet. It does not seem to work..
What does work is the generation of the 'count();' template.
This all worked fine in Cocoon 1. Maybe I'm missing something here;
the logicsheet-concepts document tells me that you should make
a helper class, preferably, but it also speaks about the
<xsp:logic> tag right below the <xsp:page> tag, which is used
to generate class-level static functions. Maybe this does not go
for tag-libs, but just for generator-level xsp pages (I mean that
the xsp page must be the first in the pipeline..).

Also I've noticed that the xsp:expr tag does not work the same:
<xsp:expr>count()</xsp:expr> worked fine in cocoon 1, but in Cocoon2
it seems to literally copy it in the java-source for the generator,
which gives a compilation error because it misses the ';'.

Anyway, when I run a simple xml page through cocoon it gives me the
compiler error:

Error compiling _index_xml: Line 188, column 9: Method count() not found
in class _home._forge._work._neostream._pages._index_xml.

which is because it ignores the <xsl:logic/> tag's content..

Can anybody please help?

Greetings!



-----------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
   xmlns:nsp="http://www.neonics.com/2000/NSP/Core"
>
  
  <xsl:template match="xsp:page">
    <xsp:page>
      <xsl:apply-templates select="@*"/>

      <xsp:structure>
          <xsp:include>com.first8.util.*</xsp:include>
          <xsp:include>com.first8.dbinterface.*</xsp:include>
          <xsp:include>java.sql.*</xsp:include>
          <xsp:include>com.neonics.neostream.db.*</xsp:include>
          <xsl:for-each select="nsp:db">
                  <xsp:include><xsl:value-of
select="@library"/></xsp:include>
          </xsl:for-each>
      </xsp:structure>


      <xsp:logic>
        static private int counter = 0;

        private static synchronized int count() {
          return counter++;
        }

      </xsp:logic>
      <xsl:apply-templates/>

    </xsp:page>
  </xsl:template>

  <xsl:template match="nsp:count">
   <xsp:expr>count()</xsp:expr>
  </xsl:template>



  <xsl:template match="@*|*|text()|processing-instruction()">
    <xsl:copy>
      <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

-----------------------------------------------------------------------



Mime
View raw message