This page mostly contains tips for beginners, but see bottom of the page for more advanced enhancement tips... The list may help as a guide but it does not claim to be the "best approach".

Tips for beginners

Read the first 3 Tutorials of this wiki

Restart only your webapp

Instead of restarting the whole container, I only restart the cocoon app, when needed. This usually takes only a few seconds. For enabling the automatic webapp restart (= Hot Deploy) read the instructions on the Wiki page about HotDeploy.

Use released Cocoon versions

You can use un-released CVS versions, but be careful because CVS might be in the middle of refactoring certain pieces.

Additional tip: Before cocoon-2.0.4 the sitemap reloading had a bug, that crashed Cocoon under certain circumstances. This bug has been fixed with cocoon-2.0.4.

Proceed in "baby steps"

Doing incremental development can lead to more productivity. Redeploying Cocoon doesn't cost you a lot of time. For XSLT changes it's usually simple to proceed in baby steps since you can usually edit the live sheets and resubmit the page and immediately see the results. In addition you can break your pipelines into pieces so that you can capture the output XML and feed it into an XML Editor or Xselerator and debug your XSLT that way.

Follow KISS (keep it simple, stupid)

I keep as much as possible with the basics of Cocoon and don't use (yet) the more fancy stuff.

Use the XSLT transformer rather than XSLTC for debugging

XSLT error messages reports are way clearer than XSLTC stacktraces: they contain termination messages and often the line and column number of offending XSL code. XSLTC stacktrace do not contain these valuable informations.

During debugging, I suggest to explicitly use <map:transform type="xslt" src="..."/> instead of <map:transform type="xsltc" src="..."/> in your sitemap, and to avoid using XSLTC as your default transformer (<map:transformers default="xslt"> instead of <map:transformers default="xsltc">).

Turn on again the XSLTC transformer only when everything runs as expected!

Use subsitemaps

Separate your app into BeginnerSimpleWebappOrganisation and subdirs with related issues.

Use the cocoon-wiki

Especially use the "search" function to discover interesting docs.

Use books on cocoon

I started using the "Cocoon Developer's Handbook" written by Lajos Moczar and Jeremy Aston. What I like most, is the huge amount of code examples.

There is also "Cocoon: Building XML Applications" written by Matthem Langham and Carsten Ziegeler (New Riders publishers), which I found very valuable and easy to read. Two sample chapters may be found online at New Riders site: Chapter 6 "A User's Look at the Cocoon Architecture" and Chapter 11 "Designing Cocoon Applications". Chapter 6 provides a good introduction and overview of Cocoon's 2.0 architecture.

Tips for enhanced users

Enable other xslt processors

For XSLT processing I have added Saxon-6.5.2. It's not straight forward to install, but sometimes it can be utilised with less pain than xalan (just a matter of taste). Look into DocbookTransformation for a quick description or look at for a quickinstall step by step instruction.

Use entity resolver wherever possible.

See Cocoon docs: Entity resolution with catalogs

Embrace FlowScript (see WhatIsFlow)

Use this to get MVC design for your webapp, and to make navigational issues a cinch.

  • No labels