You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nicolai P Guba <np...@frontwire.com> on 2001/09/18 13:48:38 UTC

Getting Started with XSP on Coccon2

Hello Coccon users!

I'm going through the XSP documentation and try to do the following
example (which, surprisingly, is not part of the supplied examples.  I
would recommend that releases should include a working setup of the
documentations example so that one can see how they integrate with
other, more complicated concepts such as sitemaps).

<!-- greeting2.xml -->
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="greeting.xsl"?>

  <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core">
    <xsp:logic>
      String msg = "Hello World!";
    </xsp:logic>

    <greeting>
      <xsp:expr>msg</xsp:expr>
    </greeting>

  </xsp:page>

But the output are just the html tags as specified in greeting.xsl.
No hello World whatsoever :(

I am using a sub sitemap for these examples.  I suspect it is the
culprit.

<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Components ================================ -->

 <map:components>

  <map:generators default="file"/>
  <map:transformers default="xslt"/>
  <map:readers default="resource"/>
  <map:serializers default="html"/>
  <map:selectors default="browser"/>
  <map:matchers default="wildcard">
   <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcherFactory"/>
  </map:matchers>

 </map:components>

<!-- =========================== Pipelines ================================= -->

 <map:pipelines>
  <map:pipeline>

   <map:match pattern="">
    <map:redirect-to uri="welcome"/>
   </map:match>

   <map:match pattern="welcome">
    <map:generate src="greeting.xml"/>
    <map:transform src="greeting.xsl"/>
    <map:serialize/>
   </map:match>

   <map:match pattern="*.xml">
    <map:generate src="{1}.xml"/>
    <map:transform src="greeting.xsl"/>
    <map:serialize/>
   </map:match>

   <map:handle-errors>
    <map:transform src="../stylesheets/error2html.xsl"/>
    <map:serialize status-code="500"/>
   </map:handle-errors>

  </map:pipeline>
 </map:pipelines>

</map:sitemap>

<!--
 Local Variables:
 mode: xml
 End:
-->

Please, could somebody help me in getting this trivial (but important)
bit going.  I'd like to see how well coccon integrates with J2EE
technologies.


-- 
  Nicolai P Guba    http://www.gnu.org         http://www.frontwire.com
                    mailto:nicolai@gnu.org     mailto:npg@frontwire.com
                    GSM: +44 (0)7909 960 751   DDI: +44 (0)20 7368 9708

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


Re: Getting Started with XSP on Coccon2

Posted by Nicolai P Guba <np...@frontwire.com>.
"Torsten Curdt" <tc...@dff.st> writes:

> > "Torsten Curdt" <tc...@dff.st> writes:
> > 
> > > > I still don't know why this doesn't work then.  I didn't suspect the
> > > > PI's in the file being the problem but removed them nevertheless.
> > > > Still, no result ie no output of the java string.  I still suspect the
> > > > sitemap not telling it to use XSP as processor.  Could you have a
> > > > second look?
> > > 
> > > Why don't you just look under webapp/cocoon/docs/samples/xsp/simple.xsp?
> > 
> > Tried that but cannot get mine to work.  I reckon it's a problem with
> > the sitemap because it doesn't look like it's recognising/processing
> > the XSP namespace.
> 
> Does your simple.xsp sample work? Have you looked up the pipeline match
> for the simple.xsp sample?

The simple.xsp sample works.  I'll study the setup for simple.xsp a
bit further and let you guys know.

-- 
  Nicolai P Guba    http://www.gnu.org         http://www.frontwire.com
                    mailto:nicolai@gnu.org     mailto:npg@frontwire.com
                    GSM: +44 (0)7909 960 751   DDI: +44 (0)20 7368 9708

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


RE: Getting Started with XSP on Coccon2

Posted by Torsten Curdt <tc...@dff.st>.
> "Torsten Curdt" <tc...@dff.st> writes:
> 
> > > I still don't know why this doesn't work then.  I didn't suspect the
> > > PI's in the file being the problem but removed them nevertheless.
> > > Still, no result ie no output of the java string.  I still suspect the
> > > sitemap not telling it to use XSP as processor.  Could you have a
> > > second look?
> > 
> > Why don't you just look under webapp/cocoon/docs/samples/xsp/simple.xsp?
> 
> Tried that but cannot get mine to work.  I reckon it's a problem with
> the sitemap because it doesn't look like it's recognising/processing
> the XSP namespace.

Does your simple.xsp sample work? Have you looked up the pipeline match
for the simple.xsp sample?
--
Torsten

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


Re: Getting Started with XSP on Coccon2

Posted by Nicolai P Guba <np...@frontwire.com>.
Chris Finn <ya...@yahoo.com> writes:

> --- Nicolai P Guba <np...@frontwire.com> wrote:
> > "Torsten Curdt" <tc...@dff.st> writes:
> > 
> > > > I still don't know why this doesn't work then. 
> > I didn't suspect the
> > > > PI's in the file being the problem but removed
> > them nevertheless.
> > Tried that but cannot get mine to work.  I reckon
> > it's a problem with
> > the sitemap because it doesn't look like it's
> > recognising/processing
> > the XSP namespace.
> 
> Several problems I see.  First, you have the wrong
> namespace defined for XSP for Cocoon2:
> 
> Instead of:
> xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> 
> use:
> xmlns:xsp="http://apache.org/xsp"
> 
> Second, the xslt processing instructions are no longer
> recognized in the XSP--so make sure they're in the
> sitemap.
> 
> Remove these from your XSP:
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet type="text/xsl" href="greeting.xsl"?>
> 
> The sitemap looks okay, so I'm thinking it's just a
> problem with your XSP definition.  Since you're
> getting the tags from the XSL, you should know that
> the pipeline is working okay for the transformation
> step.

I removed the instructions as someone suggested earlier on.  I'll give
the namespace a go and recommend that the cocoon2 examples should be
updated.  Having wrong examples can be very frustrating for people
evaluating a product like this for a production environment ;)

I'll give this a whirl and post my results.

Cheers!
-- 
  Nicolai P Guba    http://www.gnu.org         http://www.frontwire.com
                    mailto:nicolai@gnu.org     mailto:npg@frontwire.com
                    GSM: +44 (0)7909 960 751   DDI: +44 (0)20 7368 9708

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


Re: Getting Started with XSP on Coccon2

Posted by Nicolai P Guba <np...@frontwire.com>.
Chris Finn <ya...@yahoo.com> writes:

> Several problems I see.  First, you have the wrong
> namespace defined for XSP for Cocoon2:
> 
> Instead of:
> xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> 
> use:
> xmlns:xsp="http://apache.org/xsp"

I can now confirm that this was the error.  Thanks for your patience
so far :)

-- 
  Nicolai P Guba    http://www.gnu.org         http://www.frontwire.com
                    mailto:nicolai@gnu.org     mailto:npg@frontwire.com
                    GSM: +44 (0)7909 960 751   DDI: +44 (0)20 7368 9708

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


Re: Getting Started with XSP on Coccon2

Posted by Chris Finn <ya...@yahoo.com>.
--- Nicolai P Guba <np...@frontwire.com> wrote:
> "Torsten Curdt" <tc...@dff.st> writes:
> 
> > > I still don't know why this doesn't work then. 
> I didn't suspect the
> > > PI's in the file being the problem but removed
> them nevertheless.
> Tried that but cannot get mine to work.  I reckon
> it's a problem with
> the sitemap because it doesn't look like it's
> recognising/processing
> the XSP namespace.

Several problems I see.  First, you have the wrong
namespace defined for XSP for Cocoon2:

Instead of:
xmlns:xsp="http://www.apache.org/1999/XSP/Core"

use:
xmlns:xsp="http://apache.org/xsp"

Second, the xslt processing instructions are no longer
recognized in the XSP--so make sure they're in the
sitemap.

Remove these from your XSP:
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="greeting.xsl"?>

The sitemap looks okay, so I'm thinking it's just a
problem with your XSP definition.  Since you're
getting the tags from the XSL, you should know that
the pipeline is working okay for the transformation
step.


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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


Re: Getting Started with XSP on Coccon2

Posted by Nicolai P Guba <np...@frontwire.com>.
"Torsten Curdt" <tc...@dff.st> writes:

> > I still don't know why this doesn't work then.  I didn't suspect the
> > PI's in the file being the problem but removed them nevertheless.
> > Still, no result ie no output of the java string.  I still suspect the
> > sitemap not telling it to use XSP as processor.  Could you have a
> > second look?
> 
> Why don't you just look under webapp/cocoon/docs/samples/xsp/simple.xsp?

Tried that but cannot get mine to work.  I reckon it's a problem with
the sitemap because it doesn't look like it's recognising/processing
the XSP namespace.
-- 
  Nicolai P Guba    http://www.gnu.org         http://www.frontwire.com
                    mailto:nicolai@gnu.org     mailto:npg@frontwire.com
                    GSM: +44 (0)7909 960 751   DDI: +44 (0)20 7368 9708

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


RE: Getting Started with XSP on Coccon2

Posted by Torsten Curdt <tc...@dff.st>.
> > > Hello Coccon users!
> > > 
> > > I'm going through the XSP documentation and try to do the following
> > > example (which, surprisingly, is not part of the supplied examples.  I
> > > would recommend that releases should include a working setup of the
> > > documentations example so that one can see how they integrate with
> > > other, more complicated concepts such as sitemaps).
> > 
> > Just have a look there are plenty of them now...

[snip]

> > > I am using a sub sitemap for these examples.  I suspect it is the
> > > culprit.
> > 
> > Looks fine at the first glance...
> 
> I still don't know why this doesn't work then.  I didn't suspect the
> PI's in the file being the problem but removed them nevertheless.
> Still, no result ie no output of the java string.  I still suspect the
> sitemap not telling it to use XSP as processor.  Could you have a
> second look?

Why don't you just look under webapp/cocoon/docs/samples/xsp/simple.xsp?
--
Torsten

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


Re: Getting Started with XSP on Coccon2

Posted by Nicolai P Guba <np...@frontwire.com>.
"Torsten Curdt" <tc...@dff.st> writes:

> > Hello Coccon users!
> > 
> > I'm going through the XSP documentation and try to do the following
> > example (which, surprisingly, is not part of the supplied examples.  I
> > would recommend that releases should include a working setup of the
> > documentations example so that one can see how they integrate with
> > other, more complicated concepts such as sitemaps).
> 
> Just have a look there are plenty of them now...
> 
> > 
> > <!-- greeting2.xml -->
> > <?xml version="1.0"?>
> > 
> > <?cocoon-process type="xsp"?>
> > <?cocoon-process type="xslt"?>
> 
> You don't use PIs in C2. You use the sitemap for this.

Ah!  Thanks for pointing this out.  What puzzles me is that this code
is straight from the example delivered with the C2b2 docs.
 
> > <?xml-stylesheet type="text/xsl" href="greeting.xsl"?>
> 
> Here as well.

Ta

> > I am using a sub sitemap for these examples.  I suspect it is the
> > culprit.
> 
> Looks fine at the first glance...

I still don't know why this doesn't work then.  I didn't suspect the
PI's in the file being the problem but removed them nevertheless.
Still, no result ie no output of the java string.  I still suspect the
sitemap not telling it to use XSP as processor.  Could you have a
second look?

-- 
  Nicolai P Guba    http://www.gnu.org         http://www.frontwire.com
                    mailto:nicolai@gnu.org     mailto:npg@frontwire.com
                    GSM: +44 (0)7909 960 751   DDI: +44 (0)20 7368 9708

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


RE: Getting Started with XSP on Coccon2

Posted by Torsten Curdt <tc...@dff.st>.
> Hello Coccon users!
> 
> I'm going through the XSP documentation and try to do the following
> example (which, surprisingly, is not part of the supplied examples.  I
> would recommend that releases should include a working setup of the
> documentations example so that one can see how they integrate with
> other, more complicated concepts such as sitemaps).

Just have a look there are plenty of them now...

> 
> <!-- greeting2.xml -->
> <?xml version="1.0"?>
> 
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>

You don't use PIs in C2. You use the sitemap for this.

> <?xml-stylesheet type="text/xsl" href="greeting.xsl"?>

Here as well.

>   <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>     <xsp:logic>
>       String msg = "Hello World!";
>     </xsp:logic>
> 
>     <greeting>
>       <xsp:expr>msg</xsp:expr>
>     </greeting>
> 
>   </xsp:page>
> 
> But the output are just the html tags as specified in greeting.xsl.
> No hello World whatsoever :(
> 
> I am using a sub sitemap for these examples.  I suspect it is the
> culprit.

Looks fine at the first glance...
--
Torsten

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