Unicorn Templates Specification
Presentation
One mission of UniCORN is to provide several output results to fit with any client type (browsers, command-line software, automatic tools, ...). So it needs to handle several formats. For example, most of the users will need an (X)HTML output, but some tools may prefer a SOAP or EARL one, ...
So, the framework will possess an output engine that will allow to easily add new output formats, only writing a template document that will be used to build the results. The CSS Validator has an embryo of such a feature, but still needs Java classes to handle each output correctly.
Template principle is illustrated by the figure below:
The template format will look like this (for a plain text output for example):
#if( $valid ) The document is valid #else The document contains $errorsCount errors #foreach( $error in $errorList ) * Line: $error.line $error.message #end #end
Words with a leading $ are keywords provided by the framework, while
words with a leading # allows things such as iteration over a collection
of elements or conditional branch.
Velocity
Velocity (http://jakarta.apache.org/velocity/) is a template engine written in and for Java. We will use it as it seems to fit all our needs.
