xmlt [-n ns.py..] dtml-file xmlt-files.. html-file
The first argument is a dtml-file describing the layout of the generated document. A dtml-file is a HTML file width some additional dtml semantics. These includes conditional statements and attributes. Check the Zope home page for a more detailed description of this format. The layout file for this document and the layout file in the example directory are examples of such dtml-files.
The last argument is the name of the generated HTML file. Xmlt can
not write the result to stdout since it needs the name of the
generated HTML file. You can in the layout-file refer to this name in
the current
attribute. E.g., if the generated file is ex.html
, then
the current
attribute has the value "ex.html"
.
The rest of the arguments (xmlt-files..
) are the contents of the
document. This usually includes two files, one with some global
settings and one with the actual text. The example in the example
directory uses a def.xmlt
file for the global settings. The actual
contents of the documents are found in the ex.xmlt
and fx.xmlt
files,
respectively.
Optionally you can specify one or more Python name space files
(using the -n
flag) containing attributes and functions used in
the dtml-file (or in the xmlt-files).
Xmlt, examples and some documentation are available from the Python Starship.
<BODY>
and
</BODY>
tag including the tags). The difference is
that some of the comments have a special meaning and the user can add
new user defined tags. Below is an example of the contents of a
simple xmlt-file (simple.xmlt
):
Xmlt will work with a valid HTML file too. The stuff outside the body part of an HTML file are ignored (except the title, user defined values [vtags] and some of the comments).<!-- vtags:comment --> <!-- toc --> <!-- tag:mark:<em>::</em> --> <title>A title</title> <comment> This is an example document. </comment> <body> <h2>This is a sub-title</h2> This is the text in the document. <h2>This is another sub-title</h2> This is <mark>more<mark> text in the document. </body> <!-- hhmts start --> Last modified: Thu Feb 3 09:53:07 CET 2000 <!-- hhmts end -->
english
used to specify that the
layout of this document should be adjusted for the English language
(language specific parts are presented in English). This flag is set
in the beginning of the xmlt-file with the following line:
An attribute is given a value. Most attributes are interpreted as a text string. An attribute is usually used to insert document specific text in the layout description. An attribute<!-- english -->
author
is given
the value "A Name"
with the following line:
An attribute and a flag can be used inside the xmlt-file too. This is not the common use, but it is sometimes convenient. The syntax is equal to the syntax used in the layout file (see below).<!-- author:A Name -->
vtags
attribute,
the toc
flag and the tag
attribute. Each flag and attributed with a
special meaning are given a short description below.
toc
toc
attribute (the flag became an attribute). The toc
attribute is
usually used in the layout file.
vtags
comment
and
about
. These tags are then later used once in the xmlt-file.
The result is that an attribute with the name of the tag is
given the value (contents) of the tag. These attributes are
then usually used in the layout file.
tag
vtags
is a list of
tags used to insert a value (text) in a generated attribute. A
value tag in this list can only be used once. However, tag
are
used to create user defined tags. The simple xmlt file above
creates one such tag, the mark
tag. Use one such tag creation
expression for each tag you create.
clevel
toc
toc
flag
is set.
title
body
vtags
) are
available in and attribute with the name of the tag. The
simple.xmlt example above will generate the following
attributes: comment
and about
.
current
xmlt.html
in this user guide.
rcs
Keyword
<!-- $Date: 2000/07/25 11:04:29 $ -->
and <!-- $Author: aa $ -->
are examples of such keywords in an xmlt file. Read your RCS (or
CVS) documentation for more details. The value of the RCS
attribute rcsDate
in this user guide is
"2000/07/25 11:04:29".
timestamp
<!-- hhmts start -->
and
<!-- hhmts end -->
comments (se the simple
xmlt file above). The actual value is in my case inserted by my
editor when I save the xmlt file.
xmlt_version
xmlt_date
xmlt_msg
def.xmlt
in the example directory defines the global
settings for the two different documents with their contents and local
settings in ex.xmlt
and fx.xmlt
. The simple.xmlt
file (see above) is
an example with only one xmlt file. All settings and the contents are
located in a single file. This user guide is another example of a
document using only one xmlt file. However, xmlt are meant to be used
in the genration of a lot of HTML files with a similar layout that can
be changed in a single layout file. In these cases are the use of
xmlt files with global settings very usefull. Such global settings
often includes the user defined tags, commonly used graphics (logos)
and other settings used in many documents.
simple.dtml
:
The use of this simple layout together with the simple xmlt file above generates the following HTML file:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE><dtml-var title></TITLE> </HEAD> <BODY> <H1><dtml-var title></H1> <dtml-if comment> <P><dtml-var comment> </dtml-if> <dtml-if toc> <H2>Table of contents</H2> <dtml-var toc> </dtml-if> <P><dtml-var body> <dtml-if about> <P><EM><dtml-var about></EM> <dtml-else> <P><EM><dtml-var name="xmlt_msg"></EM> </dtml-if> <P><EM>Last updated: <dtml-var timestamp></EM> </BODY> </HTML>
simple.html
.