Previous: Finite State Machine Grammar, Up: Definitions File [Contents][Index]
There are several methods for supplying data values for templates.
It is entirely possible to write a template that does not depend upon external definitions. Such a template would likely have an unvarying output, but be convenient nonetheless because of an external library of either AutoGen or Scheme functions, or both. This can be accommodated by providing the --override-tpl and --no-definitions options on the command line. See Invoking autogen.
AutoGen behaves as a CGI server if the definitions input is from stdin
and the environment variable REQUEST_METHOD
is defined
and set to either "GET" or "POST", See AutoGen as a CGI server. Obviously,
all the values are constrained to strings because there is no way
to represent nested values.
AutoGen comes with a program named, xml2ag
. Its output can
either be redirected to a file for later use, or the program can
be used as an AutoGen wrapper. See Invoking xml2ag.
The introductory template example (see A Simple Example) can be rewritten in XML as follows:
<EXAMPLE template="list.tpl"> <LIST list_element="alpha" list_info="some alpha stuff"/> <LIST list_info="more beta stuff" list_element="beta"/> <LIST list_element="omega" list_info="final omega stuff"/> </EXAMPLE>
A more XML-normal form might look like this:
<EXAMPLE template="list.tpl"> <LIST list_element="alpha">some alpha stuff</LIST> <LIST list_element="beta" >more beta stuff</LIST> <LIST list_element="omega">final omega stuff</LIST> </EXAMPLE>
but you would have to change the template list-info
references
into text
references.
Of course. :-)