You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Aurelien <au...@fractals.be> on 2001/09/28 13:01:09 UTC

help: logicsheet's isn't expanded

Hi,

I'm trying to understand the logicsheet mechanism. Basically, I have the 
following files:

hello.xsp:
<?xml version="1.0"?>

<xsp:page
   xmlns:xsp="http://apache.org/xsp"
   xmlns:ctwig="http://www.fractals.be/xsp/greeting/1.0">
   <greeting>
     <ctwig:hello-world/>
   </greeting>
</xsp:page>















logicsheet.xsl:

<?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:ctwig="http://www.fractals.be/xsp/greeting/1.0"
   version="1.0">

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

<xsl:template match="ctwig:hello-world">
<!-- more complex XSLT is possible here as well -->
    <ul>
      <xsp:logic>
   <![CDATA[
        for (int i=0; i<5; i++) {
   ]]>
<li>
<xsp:expr>i</xsp:expr>
</li>
   <![CDATA[
        }
   ]]>
      </xsp:logic>
    </ul>
</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>














in cocoon.xconf, I have the following entry:

         <builtin-logicsheet>
           <parameter name="prefix" value="ctwig"/>
           <parameter name="uri" 
value="http://www.fractals.be/xsp/greeting/1.0"/>
           <parameter name="href" 
value="file:///usr/local/tomcat/webapps/cocoon/stylesheets/logicsheet.xsl"
/>
         </builtin-logicsheet>







I've looked int the "work" directory of tomcat, and that's what I get in 
the generated hello_xsp.java source:

[...]
     for (int i = 0; i < 5; i++) {
       this.contentHandler.startElement("", "li", "li", xspAttr);
       xspAttr.clear();
       i
       this.contentHandler.endElement("", "li", "li");
     }
[...]





Conclusion: "<xsp:expr>i</xsp:expr>" is translated to simply "i" by the 
logicsheet...


What am I doing wrong ?

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