Quick install with Opam

The easiest way to install is to use OPAM. Install Opam, then, as a regular user, fetch and install an OCaml version and install Xtmpl. The whole can be done with the following opam commands:

$ opam init --comp=4.12.0
$ opam update
$ opam install xtmpl xtmpl_ppx xtmpl_js
From the sources

Get the sources from git repository:

$ git clone https://framagit.org/zoggy/xtmpl.git

Or pick one of the releases:

  • 0.19.0 [November 25, 2021]
    • use dune to build and install;
    • modules renamed, with namespace Xtmpl and submodules Rewrite, Xml, ...;
    • packages renamed: xtmpl.ppx -> xtmpl_ppx, xtmpl.js -> xtmpl_js;
    • add ignore_unclosed to parse_param to authorize more parsing with tags not closed (default is false);
    • names in parse_param.self_closing are now lowercase_ascii'ed before comparison.
  • 0.18.0 [May 10, 2021]
    • upgrade to OCaml 4.12.0;
    • reference entities to unescape when parsing can be specified in the ?param parameter. HTML entities are available with Xtmpl_xml.html_entities;
    • functions reading xml take a set of unqualified tag names considered as selfclosing; this is useful to parse HTML.
  • 0.17.0 [July 4, 2018]
    • use js_of_ocaml.ppx instead of camlp4 extension
    • use -g flag everywhere
    • environments now handle and resolve namespaces (except default namespaces)
    • depend on ocaml-iri.
  • 0.16.0 [November 30, 2016]
    • Use Uutf 1.0.0.
  • 0.15.0 [October 26, 2016]
    • use OCaml-re library rather than Str (in Xtmpl_rewrite) and Jsoo's Regexp (in Xtmpl_js) to simplify code
    • Xtmpl_js.dom_of_html: add optional ?doc parameter to specify the root document (default is Dom_html.document)
    • Fix generated types from templates
  • 0.14.0 [August 17, 2016]
    • fix: remove special attributes when converting Xtmpl_rewrite.tree to Xtmpl_xml.tree,
    • upgrade to ocaml 4.03.0 + replace deprecated stdlib functions.
  • 0.13.0 [November 24, 2015]
    • include its own XML parser, keeping locations (do not depend on Xmlm any more but now require sedlex and uutf packages),
    • big interface change (with modules Xtmpl.Xml, Xtmpl.Rewrite, ...),
    • new package xtmpl.ppx (ppx instruction for ocamlfind not included in xtmpl package any more),
    • no more use of of main_ tag.
  • 0.12 [March 30, 2015]
  • 0.11 [March 5, 2015]
    • add ppx_xtmpl: this preprocessor creates functions from template files or strings, with the parameters described in the template. Usage:
      let doc = [%xtmpl "file.xml"]
      let doc = [%xtmpl.string {| <div>...</div> |} ]
      
    • some functions renamed (deprecating original ones functions),
    • add Xtmpl.node and Xtmpl.cdata,
    • new Xtmpl.Xhtml module, with convenient functions to create Xhtml trees,
    • new Xtmpl_js module in a new package xtmpl.js.
Compilation

Just type

$ ./configure && make && make install

This will install the following packages with ocamlfind: xtmpl, xtmpl.ppx, xtmpl.js.