MLHTML: Multi Lingual XHTML
MLHTML adds just one new tag:
to XHTML. The tag includes the mandatory indication of a language identifier,
and is matched by the associated closing tag:
The text between opening and
closing tags is assumed to be in language
L. For example,
a multi lingual page providing information in English (en) and Italian (it) may
include the following lines, mixed with normal XHTML code:
<ml lang="en"> Publication List </ml>
<ml lang="it"> Lista delle pubblicazioni </ml>
For the specification of multi-lingual
references to objects (other HTML pages, images, etc.),
the following patterns can be used:
<ml lang="en"> <img align="top" src="books-en.gif"/> </ml>
<ml lang="it"> <img align="top" src="books-it.gif"/> </ml>
<ml lang="en"> <a href = "ref-page.ml?lang=en"> English description </a> </ml>
<ml lang="it"> <a href = "ref-page.ml?lang=it"> Descrizione in Italiano </a> </ml>
where in the latter case another MLHTML page (with extension
referenced and the language is selected through the parameter
The tool PageMerger is distributed both
as Java source code (PageMerger.java) and as compiled byte code
An example of its execution is the following:
java PageMerger page.en.html en page.it.html it > page.ml
Since the input HTML files are required to be compliant with XHTML,
so that legal XML code can be generated from them, it may be necessary to
preliminarly convert HTML files which are not already in XHTML.
A tool that can be used for such a conversion is
tidy -asxml file.it.html > file.it.xhtml
Tidy can also be used to pretty-print the output of page merging:
tidy -xml file.ml > newFile.ml
For the offline generation of static HTML in all supported languages,
it is possible to use any of the available
processors (for example,
XT), providing them with the XSL stylesheet
ml.xsl for language selection.
With Saxon, the command to issue is:
java com.icl.saxon.StyleSheet p.ml ml.xsl lang=it > p.it.html
java com.icl.saxon.StyleSheet p.ml ml.xsl lang=en > p.en.html
For the dynamic generation of the HTML pages by the Web server,
the PHP script ml.php can be run on p.ml.
With the Apache Web server, it is possible to declare that every
file with extension ml has to be preprocessed by ml.php,
by inserting the following two lines into the file .htaccess:
AddType application/x-httpd-parse .ml
Action application/x-httpd-parse "/ml.php?file="
Finally, XML enabled browsers can directly process p.ml (possibly renamed p.xml), accompanied by the stylesheet ml.xsl.
To see the source code of this page, follow this link.
To submit any bug or change, send an e-mail to: email@example.com
Thanks very much!
Maintainer: Paolo Tonella Mail: firstname.lastname@example.org