Lx example files

Files here:

addtoc.lx
XSLT written in Lx syntax, to add a TOC to an XML file. See comments within the file for use, or the example invocation below.
namespacing.lx
Examples of different ways that the Lx syntax can support elaborate namespacing requirements.
split-csv.lx
Split Record element's contents at commas. Patterned after entry Comma Separated Data in the XSLT FAQ
common.lx
An Lx version of common.xsl, which is one of the files in Norm Walsh's Docbook XSL stylesheet set.
identity.java
A converter, in pure Java, which performs the identity transformation between syntaxes, so that it can take XML or Lx input, and produce the same in XML or Lx syntax.
transformer.java
A transformer which takes XML syntax as input, and applies an XSLT stylesheet written in Lx syntax. See below for examples.
lx-mode.el
An Emacs minor mode for Lx
doc-with-toc.xml
A short sample XML file, for playing with.

Usage

If you have James Clark's XT installed, you can apply the addtoc.lx transformation like this (assuming that the XT jars are currently in the path):

% CLASSPATH=.../lx.jar:$CLASSPATH
% java -Dcom.jclark.xsl.sax.parser=uk.me.nxg.lx.helpers.MultiParser \
        com.jclark.xsl.sax.Driver doc-with-toc.xml addtoc.lx output.html

That replaces the default XML parser with the Lx MultiParser, which can parse both XML and Lx syntax.

Or you can use it with Saxon, by using Saxon's -y option:

% CLASSPATH=.../lx.jar:$CLASSPATH
% java net.sf.saxon.Transform \
    -y uk.me.nxg.lx.reader.LxReader \
    input.xml script.lx

Or use the transformer program built in to the jar:

% java -jar lx.jar doc-with-toc.xml addtoc.lx >output.html
Norman
2012 August 5