Monday, January 03, 2005

Fun with Forrest

This past few weeks at work have been slower than usual due to the holidays. So I took the time to play around with Apache Forrest, which really seems to be coming into its own.

Forrest is a publishing tool based on a subset of Cocoon. It's very good at taking XML documents and presenting them in a nice neat format using the xdocs format. It contains hordes of transformations based on xdocs that allows you to get pdf, html, etc out of them.

However, I'm doing some fairly extensive "light" hacking onto the tool. I'm using it to document XML based rules that are used to drive parsing algorithms of printer files. Bascially, these parsing algorithms are defined by two XML files. I was able, after hunting around, to dynamically create an index page that listed all of the directories underneath itself. Each directory contains the two rule files for a client. When someone clicks on the directory:
  • The cocoon engine, finds the names of the files using the directory generator.
  • Passes the directory listing to an XSL stylesheet that creates a small xml file with the names of the actual files that contain the rules
  • That file is used for another XSL stylesheet that merges the two files so that each definition matches with each execution rule.
  • The merged file is converted into xdocs.
  • Forrest then takes that xml file and converts it to HTML or PDF, or whatever you need.
I'm very impressed with it so far. I converted a homegrown JSF application to present other documentation to the tool, and it works like a charm also. Even better than the JSF/XSL app due to the power of the engine.

I'm just now starting to see what goes wrong if I use 0.7-dev release, and have found a couple things that need to be fixed with my app, but I do not think it will be too difficult to resolve these issues.

No comments:

ShareThis