RDF/A: an implementation

Jeremy Carroll


This directory gives an XSLT2 implementation for RDF/A.

The goal is to be an initial implementation, that is fairly easy to change as the rules change.

This is not intended as a production implementation, and misses features such as validation, efficiency and error handling that would be required in a production implementation.

The current status is an initial, untested prototype.

Overview of Design

The heart of the system is a set of rules for subject, predicate and object, taken from the specification.

These rules are transformed into an XSLT program, which in turn can transform an XML document with RDF/A attributes into an RDF/XML document. Hence we distinguish between compile-time transformation, which processes the rules, and run-time transformation which processes XHTML2.

The first compile-time transformation combines the rules for S, P and O into a set of rules for SPO matches.

The second compile-time transformation takes the SPO matches and turns them into XSLT.

The run-time transformation uses the output of the compile-time transformation, and an imported module, to transform XHTML2 into RDF/XML.


The files in this directory are as follows:

Source Files

The rules for subject, predicate and object matching.
The first compile time transform. The XSLT that transforms rulesA.xml into rulesSPO.xml, in every combination of S rule, P rule and O rule.
The second compile time transform. The XSLT that transforms rulesSPO.xml into rdfA.xsl, which is the run-time transform.
The imported module for the runtime transform. This file defines functions for URI and CURIE processing; and the top-level match etc.
A file for testing with.
A list of the instructions for building and running the transforms, using saxon8, works as a windows batch file, or as a unix shell script.

The generated files

This XSLT transforms XHTML2 into RDF/XML.
This is the output from testRDFA.xml when transformed with rdfA.xsl.


There are numerous TODOs scattered through the code. The most significant is reification.

$ grep TODO *
base.xsl: TODO use sensible namespace for my:, and change prefix
base.xsl: TODO assumes that the bnode is legal NCNameChars
base.xsl: TODO assumes bare-infix is :
base.xsl: TODO ncname here
base.xsl: TODO this code assumes infix of length 1
rules2xslt.xsl:TODO  Reification
rules2xslt.xsl:TODO  Testing
rulesA.xml:  TODO reification rules of 5.3
testRDFA.xml:  TODO correct URI for dc. Many more tests.

Also a major tidy-up would be in order.

A further limitation is that the code assumes the value of a property rel or rev attribute is actually a qname.

The rel="next" etc functionality has not been implemented.

$Revision: 1.4 $ of $Date: 2005/12/06 15:25:33 $
Valid XHTML 1.0!