Frequently Asked Questions

 

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

tells Cocoon that the stylesheet hello.xsl should be applied to the current XML file that contains this line as default. If you want to add browser depending styling you add

<?xml-stylesheet href="hello.xsl" type="text/xsl" media="xxx"?>

Where xxx is the media type of your browser. Currently, there is no standardized way of recognizing the browsing client but mapping their identifier string. Cocoon is preconfigured to handle these browsers:

servlet.org.apache.cocoon.Cocoon.initArgs=properties=<cocoon>/bin/cocoon.properties

After you specify this, the Cocoon servlet will look for this file at startup instead of using its internal defaults. We suggest you to extract the default file from the jar file or use the /src/org/apache/cocoon/cocoon.properties file from the distribution as a template.

browser.0=explorer=MSIE
browser.1=netscape=Mozilla
browser.2=lynx=Lynx
browser.3=opera=Opera
browser.4=java=Java

indicates that Cocoon should look for the string MSIE first, then Mozilla and so on. If you want to recognize different generations of the same browser you should do find the specific string you should look for and indicate the order of searching since more browsers may contain the same string.

Following the XSL model, such logic language should not pose any restriction to your XML format and should not force you to use specific logic tags to incorporate some logic (as ColdFusion, ASP, JSP and many others do), but should be able to allow you to define your own tags in your XML file (for example, <query>,  <banner> or <counter>) and to dynamically interpret them using this language placed on a different file. Think of it as a logicsheet, the logic equivalent of a stylesheet.

This approach is what would allow you to place the three different document layers (content, logic and style) on different files, which can be modified, reused and designed indipendely and in a complete parallel way. We aim to work with other open-source XML groups (such as OpenXML) to define such language for both XML batch processing and server side processing.

The Cocoon publishing framework works in this way:

  1. Converts a document in a DOM structure
  2. Passes this DOM structure into a DOM processor pipeline
  3. This pipeline generates the output DOM
  4. The DOM is printed back to the client

Currently, only a single DOM processor is used (the XSL processor), but you could add your own to convert your own tags, entities or processing instructions. Look at the source code for more details on how to create a DOM processor and watch out since this is not for Java server side beginners.

When you have created your processor, simply add the class reference into the configurations like this:

processor.0 = org.fool.MyDOMProcessor
processor.1 = org.apache.cocoon.processor.LotusXSLProcessor

and Cocoon will create your processor and add it to the processing pipeline with the order specified by the number.

Copyright (c) 1999 The Java Apache Project.
$Id: faq.html,v 1.1 1999/03/14 22:18:36 stefano Exp $
All rights reserved.