Hi there,

I have been using Cocoon 1 for a while but I am completely new to
Cocoon2.

If I have well understood, processing instructions that were defining
in Cocoon 1 the way the documents had to be processed has been replaced
in Cocoon 2 by entries the sitemap file.

Here is my problem : I wonder how to tell Cocoon 2 to do the following
processings :
-> read the content from a XML file
-> introduce the logic with a XSP file
-> introduce the style with a XSL file

Apparently, in Cocoon 2, XSP generation has to be the first of the 
pipline, and I've not seen XSP transformers.

So how can I tell Cocoon 2 to process an XML document with an XSP as I 
was doing it with Cocoon 1 ?

If it could help you to understand , here is way I was doing with Cocoon 1 :


The XML file : foo.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="/igware-xml/xsp/foo-xsp.xsl" type="text/xsl"?>
<page>
         <foo/>
</page>


The XSP file : foo-xsp.xsl

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xsp="http://www.apache.org/1999/XSP/Core";>

<xsl:template match="page">
  <xsl:processing-instruction 
name="cocoon-process">type="xsp"</xsl:processing-instruction>
  <xsl:processing-instruction 
name="cocoon-process">type="xslt"</xsl:processing-instruction>
  <xsl:processing-instruction 
name="xml-stylesheet">href="/igware-xml/xsl/foo-html.xsl" 
type="text/xsl"</xsl:processing-instruction>
  <xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core";>
   <xsp:structure> ... </xsp:structure>
   <xsl:copy><xsl:apply-templates/></xsl:copy>
  </xsp:page>
</xsl:template>

<xsl:template match="page/foo">
  <xsp:logic> ... </xsp:logic>
  <xsl:copy><xsp:expr>foo</xsp:expr></xsl:copy>
</xsl:template>

</xsl:stylesheet>


The XSL file : foo-html.xsl

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="html"/>

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match="page">
  <html>
   ...
  </html>
</xsl:template>

<xsl:template match="foo">
  <xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to