cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <>
Subject Re: help!
Date Thu, 12 Oct 2000 21:29:42 GMT
Oppinderjeet Virdi - Customer Engineering <> 
>I have created an XML-encoded database where each record in the db 
>represents an
>API and some related info regarding the API.  A colleague who no longer 
>here has written some Cocoon XSL stylesheets to display our db on the web, 
>but I
>cannot seem to get them to work TOGETHER.  So here are my questions:
>1.  How do I apply multiple stylesheets to one XML document? (i.e. one to
>     transform the document, and another to display it?)

See the FAQ. Note that one of the suggested methods doesn't work as stated, 
because of a bug (see Todo).

>2.  How do I use the XSLT processor to create a new html document specified 
>     a stylesheet?

What, you mean just output it to the browser?
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="mysheet.xsl"?>

If you want to write a file that's different.

>3.  Where can I find a list of PIs?

Er, there isn't one. Off the top of my head...

<?cocoon-process?> - Apply a processor
<?xml-stylesheet?> - Associate a stylesheet (this is a declaration rather 
than an instruction; it has to be accompanied by a cocoon-process 
type="xslt" or similar) Media types can be specified to differentiate 
between different user agents.
<?xml-logicsheet?> - Associate a logicsheet (XSP use only; logicsheets are 
applied in the order specified)
<?cocoon-format?> - Apply a formatter to "format" the output (i.e. convert 
from in-memory XML representation, as a DOM, to an output representation 
which may not be XML at all). HTML format is assumed by default.

You can pick all that up from reading the docs (apart from xml-logicsheet 
which isn't yet documented anywhere - when someone submits a suitable "how 
to write a taglib guide" to cocoon-dev or commits it to CVS, it can be 
explained there).

Note that PIs will go away in Cocoon 2, to be replaced by the sitemap 
concept, which centralises management of the way in which pages should be 
processed. ("When is Cocoon 2?" is in the FAQ.)

>4.  Using one XML document (my DB), can I create an html page with a bunch 
>     links such that each link applies a different set of transformations 
>to the
>     document?

Another FAQ - this one isn't in the FAQ yet, I guess because Stefano (Cocoon 
creator) discourages the use of dynamically generated processing 
instructions in this way because it can be a slight security risk if you're 
not careful and don't do validation (e.g. <paranoid mode>clever combinations 
of xml+xsl sheets on a server could allow a cracker to expose confidential 
information such as a database password,</paranoid mode> in principle, 
although it would be unlikely.) Basically if you want to do it you need to 
use XSP and the <xsp:pi> tag to dynamically create PIs. Note, the 
documentation supplied with Cocoon 1.7.x is wrong on the syntax of this, but 
the 1.8 docs (which are on the website as well) are correct.

>5.  How do I run Cocoon from the command line?

This should definitely be documented. I think it's

(after putting all the jars on the CLASSPATH)

java org.apache.cocoon.Cocoon -p /path/to/ InFile.xml 

Get Your Private, Free E-mail from MSN Hotmail at

Share information about yourself, create your own public profile at

View raw message