Contribution:
xslt
Headline
XML processing with Language:XSLT
Motivation
XSLT is easily applied to the basic query/transformation features. Structurally recursive, type-preserving transformations are taken care of by XSLT transformations that leverage the "copy-recurse" idiom for all elements that do not require any "local" change; see below. Structurally recursive queries are handled similarly; output mode "text" is used, though. The data model for companies is provided as an XML schema. Validity is not checked or otherwise implied.
Illustration
The transformation relies on the "copy-recurse" idiom.
<xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
Architecture
Each of the implemented query/transformation features is modeled by a designated XML transformation.
Usage
In principle, any XSLT implementation should do.
Two XSLT implementations are discussed below.
See the Makefile for running some tests.
An xsltproc implementation is readily available on OS X, Linux et al.
A version of Saxon is included in the code repository for this implementation.
Tested with this version of xsltproc:
$ xsltproc -V Using libxml 20703, libxslt 10124 and libexslt 813 xsltproc was compiled against libxml 20703, libxslt 10124 and libexslt 813 libxslt 10124 was compiled against libxml 20703 libexslt 813 was compiled against libxml 20703 Also possible to work with Saxon from: http://saxon.sourceforge.net/ or http://www.saxonica.com/
Tested with this version of Saxon:
$ java -jar saxon/saxon9he.jar No source file name Saxon-HE 9.2.1.2J from Saxonica Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html Options: ...
Tested on the following machines:
Darwin ... 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE I386 i386 (both test-xsltproc and test-saxon) Darwin ... 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE I386 i386 (both test-xsltproc and test-saxon) Linux ... 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC 2010 x86 64 GNU/Linux (both test-xsltproc and test-saxon with Java 6) Linux ... 2.6.16.60-0.69.1-ppc64 #1 SMP Fri Sep 17 17:07:54 UTC 2010 ppc64 ppc64 ppc64 GNU/Linux (only test-xsltproc due to the lack of Java 5+) Linux ... 2.6.13-15.18-bigsmp #1 SMP Tue Oct 2 17:36:20 UTC 2007 i686 i686 i386 GNU/Linux (only test-xsltproc due to the lack of any Java) Microsoft Windows XP [Version 5.1.2600] (only saxon due to the lack of xsltproc)
The project can be opened with Eclipse for convenience.
Concept:
Type-preserving transformation
Headline
A transformation with the type of the input and output being the same
Details
In the context of model-driven engineering, type-preserving transformations also go by the name of endogenous model transformations.
Illustration
Diverse examples of type-preserving transformations:
- A program transformation for optimization.
- An XML transformation that only affects primitive values of selected elements.
- A traversal over an object graph (by a visitor or otherwise) that mutates objects.
- A model transformation where the metamodels of the input and output models are the same.