SourceForge Logo

xmLP - A Literate Programming Tool for XML

Anthony B. Coates

| Download xmLP from SourceForge |

xmLP News

xmLP & Literate Programming

xmLP is a literate programming tool written in XSL-T. It is heavily influenced by experience with FunnelWeb, a non-XML literate programming tool. Literate programming is about being able to getting away from having to write computer programs (or any other files for programmatic consumption) in a fashion that makes sense only to the compiler (or other applications) rather than to the humans, who really need to be the ones in charge of the process.

A literate program is a human readable document which is written and ordered so that it can be understood most easily by people. Source code fragments (or any text/XML fragments) can appear in the literate document in any order, and are assembled in the order required for computer use by tangling the document, to introduce the terminology of Donald Knuth, who came up with the idea of literate programming in the first place. The literate document is also woven to convert it into a final documentation format (traditionally TeX or LaTeX, but these days likely to be HTML or PDF).

xmLP differs from traditional literate programming tools when it comes to weaving. Traditionally, weaving involves both generating cross-reference information and producing formatted output. However, tools like XSL-T make it unnecessary for an XML literate programming tool to deal with display rendering. Hence the xmLP weaver is intentionally minimalist, and does nothing except add cross-reference information to the original literate document. This additional cross-reference information makes it much easier to build cross-reference hyperlinks using a simple rendering XSL-T stylesheet (rule of thumb: always try to separate business logic and display rendering into separate XSL-T stylesheets).

xmLP is released under version 2.1 of the Lesser GNU Public License.

Using xmLP

This first release is xmLP is very bare bones, and has almost no documentation. Documentation will come with a future release. There are two main elements that xmLP requires to be embedded in an XML literate program:

  1. lp:macro is used to define a named xmLP macro (code fragment). It can contain either lp:text or lp:xml elements, but best practice is not to mix both within a single macro (or within the macros used to build a single file);
  2. lp:file is similar to a macro definition, but provides binding to a filename for use by the xmLP tangler.

The way that xmLP is used is:

  1. Write your XML literate program containing lp:file, lp:macro, etc.;
  2. Use xmLPtangle.xsl (or xalan-tangle.xsl) to tangle your literate program and produce the raw source files;
  3. Use xmLPweave.xsl to add cross-reference information to your literate program;
  4. Use an XSL-T stylesheet (or other mechanism) to convert your woven literate program into a presentation format (e.g. (X)HTML, XSL-FO, RTF). An example is weave-xhtml.xsl.

How to get xmLP

xmLP is available from SourceForge. As well as the download area, the latest xmLP news is there, as well as forums and the xmLP-announce mailing list. For general discussion about xmLP and literate programming with XML, please use the xml-litprog-l list at Yahoo Groups.


  1. xmLP — a Literate Programming Tool for XML & Text, Extreme Markup Languages 2002.
  2. Two of the presentations at XML DevCon Europe 2001 were generated using XML literate programs. See


  2. Literate programming was first thought of by Donald Knuth, who has written a book about it. He wrote the first literate programming tool, WEB, which is Pascal-specific.
  3. To mention just some of the available literate programming tools :
    FunnelWeb, noweb, SWEB, WEB, CWEB, FWEB.
  4. Literate programming resources (in English) at LORIA.
  5. xml-litprog-l is an independent mailing list for discussion of literate programming using XML.
  6. This latest version of this information is available from

Last updated: 6th August, 2002.

SourceForge Logo