cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@socialchange.net.au
Subject Re: taglib, logichseet - no output
Date Fri, 29 Dec 2000 02:38:56 GMT


> here are 3 files
> simple.xml
> simplelogic.xsl
> simpledisplay.xsl
> 
> I get blank output and I get no error message. I have been trying to make
> this work since 2 days but without luck.

Don't wait so long before posting next time ;)

> Could someone please point out what am I missing ? ( yes I did modify to
> include SimpleClass.class in my classpath

FYI, C1 has a bug where WEB-INF/classes/* classes aren't accessible
from XSP. (http://marc.theaimsgroup.com/?t=97374220700001&w=2&r=1)

> and cocoon.properties to include namespace - logicsheet mapping ).

You don't need this if you're using <?xml-logicsheet?> PIs.

Corrections inline.

> 
> <?xml version='1.0'?>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <?xml-logicsheet href="simplelogic.xsl" type="text/xsl"?>

Most people don't declare a 'type' attribute here, but it doesn't
seem to matter.

> <?xml-stylesheet href="simpledisplay.xsl" type="text/xsl"?>
> 
> <xsp:page language="java"
> xmlns:simple="http://ntbo3.imagine-sw.com/2000/XSP/Simple"
>                           xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> <page>
> <title>
> My Page
> </title>
> <p>Simple Sentence <simple:sayHello/></p>
> </page>
> </xsp:page>
> 
> ______________________________________________
> 
> simplelogic.xsl
> 
> <?xml version="1.0"?>
> <xsl:stylesheet
>   xmlns:simple="http://ntbo3.imagine-sw.com/2000/XSP/Simple"
>   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
>   xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> 
> 
>   <xsl:template match="xsp:page">
>     <xsp:page>
>       <xsl:copy>
>         <xsl:apply-templates select="@*"/>
>       </xsl:copy>
>       <xsp:structure>
>         <xsp:include>simplePackage.*</xsp:include>
>       </xsp:structure>
>       <xsp:apply-templates/>
           ^^^
should be <xsl:apply-templates/>. Don't you feel silly now ;)

>       </xsp:page>
>       </xsl:template>
> 
>   <xsl:template match="simple:sayHello">
>   <xsp:logic>
> 
>       SimpleClass obj = new SimpleClass( "John" );
>       private String greet()
>       {
>          obj.sayHello();
>       }

Here's another problem.. you can't declare methods anywhere 
except in <xsp:logic> sections directly below <xsp:page>.
Move your greet() method to a section below <xsp:structure>.
Also, your method doesn't return anything.
I'll paste the final thing below.

--Jeff

> 
>       </xsp:logic>
>     <xsp:expr>
>     greet()
>     </xsp:expr>
>     </xsl:template>
>   <xsl:template match="@*|node()" priority="-1">
>     <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
>     </xsl:template>
>     </xsl:stylesheet>
> __________________________________________________________
> 
> simpledisplay.xsl
> 
> <?xml version="1.0"?>
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>   <xsl:template match="page">
>    <xsl:processing-instruction
> name="cocoon-format">type="text/html"</xsl:processing-instruction>
>    <html>
>     <head>
>      <title><xsl:apply-templates select="title"/></title>
>      </head>
>     <body>
>      <xsl:copy>
>      <xsl:apply-templates select="p"/>
>      </xsl:copy>
>      </body>
>    </html>
>   </xsl:template>
>   </xsl:stylesheet>
> _______________________________________________________


Corrected simplelogic.xsl

<?xml version="1.0"?>
<xsl:stylesheet
xmlns:simple="http://ntbo3.imagine-sw.com/2000/XSP/Simple"
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
  <xsl:template match="xsp:page">
    <xsp:page>
      <xsl:copy>
        <xsl:apply-templates select="@*" />
      </xsl:copy>

      <xsp:structure>
        <xsp:include>simplePackage.*</xsp:include>
      </xsp:structure>

      <xsp:logic>private String greet(SimpleClass c) { return
      c.sayHello(); }</xsp:logic>

      <xsl:apply-templates />
    </xsp:page>
  </xsl:template>

  <xsl:template match="simple:sayHello">
    <xsp:logic>SimpleClass obj = new SimpleClass( "John"
    );</xsp:logic>

    <xsp:expr>greet(obj)</xsp:expr>
  </xsl:template>

  <xsl:template match="@*|node()" priority="-1">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>



Mime
View raw message