XSL converter configuration

Introduction

The standard EGE API implementation includes two extensions by default:

  • TEI format converter;
  • XSL converter.

The XSL converter is able to transform an XML file using a given XSL transformation file. By default there are 2 XSL transformation files defined in the XSL converter plugin descriptor (see below) :

<?xml version="1.0" ?>
<!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 0.4" "http://jpf.sourceforge.net/plugin_0_7.dtd">
<plugin id="pl.psnc.dl.ege.xsl.converter" version="1.0">
	<requires>
		<import plugin-id="pl.psnc.dl.ege.root"/>
	</requires>
	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="MasterToEnrichConverter">
		<parameter id="class" value="pl.psnc.dl.ege.MultiXslConverter"/>
		<parameter id="name" value="MASTER to Enrich Converter"/>
		<parameter id="xsluri" value="http://tei.oucs.ox.ac.uk/ENRICH/XSLT/xsl/master2enrich.xsl"/>
		<parameter id="iMimeType" value="text/xml" />
		<parameter id="iFormat" value="MASTER" />
		<parameter id="oMimeType" value="text/xml" />
		<parameter id="oFormat" value="ENRICH TEI P5" />
	</extension>
	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="EadToEnrichConverter">
		<parameter id="class" value="pl.psnc.dl.ege.MultiXslConverter"/>
		<parameter id="name" value="EAD to Enrich Converter"/>
		<parameter id="xsluri" value="http://tei.oucs.ox.ac.uk/ENRICH/XSLT/xsl/ead2enrich.xsl" />
		<parameter id="iMimeType" value="text/xml" />
		<parameter id="iFormat" value="EAD" />
		<parameter id="oMimeType" value="application/zip" />
		<parameter id="oFormat" value="ENRICH TEI P5" />
	</extension>
</plugin>
	

In order to add additional XSL transformations you have to modify the XSL converter plugin descriptor - 'plugin.xml' file located in the META-INF directory of the ege-xsl-converter.jar.

To add a new XSL transformation, please follow these 3 steps:

  1. Unzip the ege-xsl-converter.jar.
  2. Modify the 'plugin.xml' file located in the META-INF directory.
  3. Repack the files back to ege-xsl-converter.jar.

Modifying the 'plugin.xml' descriptor file (adding a new XSL transformation).

In order to add a new XSL transformation, you have to add a new extension to the 'plugin.xml' descriptor file.

There are 5 required properties of the extension that have to be provided for an XSL transformation :

  • xsluri where the converter developer can specify URI address of xsl transformation scheme;
  • iMimeType - defines the mime type of input data;
  • iFormat - defines the format of input data;
  • oMimeType - defines the mime type of output data;
  • oFormat - defines the format of output data.

For instance, in order to add an XSL transformation that transforms data from FOO(text/xml) format to BAR(text/xml) format using foobar.xsl transformation scheme, available under http://pl.psnc.ege.pl/foobar.xsl, the following definition of an additional extension have to be included into the 'plugin.xml' descriptor file:

<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="FooToBarConverter">
		<parameter id="class" value="pl.psnc.dl.ege.FooToBarConverter"/>
		<parameter id="name" value="FOO to BAR converter"/>
		<parameter id="xsluri" value="http://pl.psnc.ege.pl/foobar.xsl" />
		<parameter id="iMimeType" value="text/xml" />
		<parameter id="iFormat" value="FOO" />
		<parameter id="oMimeType" value="text/xml" />
		<parameter id="oFormat" value="BAR" />
</extension>

Finally, the 'plugin.xml' file would look like this:

<?xml version="1.0" ?>
<!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 0.4" "http://jpf.sourceforge.net/plugin_0_7.dtd">
<plugin id="pl.psnc.dl.ege.xsl.converter" version="1.0">
	<requires>
		<import plugin-id="pl.psnc.dl.ege.root"/>
	</requires>
	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="MasterToEnrichConverter">
		<parameter id="class" value="pl.psnc.dl.ege.MultiXslConverter"/>
		<parameter id="name" value="MASTER to Enrich Converter"/>
		<parameter id="xsluri" value="http://tei.oucs.ox.ac.uk/ENRICH/XSLT/xsl/master2enrich.xsl"/>
		<parameter id="iMimeType" value="text/xml" />
		<parameter id="iFormat" value="MASTER" />
		<parameter id="oMimeType" value="text/xml" />
		<parameter id="oFormat" value="ENRICH TEI P5" />
	</extension>
	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="EadToEnrichConverter">
		<parameter id="class" value="pl.psnc.dl.ege.MultiXslConverter"/>
		<parameter id="name" value="EAD to Enrich Converter"/>
		<parameter id="xsluri" value="http://tei.oucs.ox.ac.uk/ENRICH/XSLT/xsl/ead2enrich.xsl" />
		<parameter id="iMimeType" value="text/xml" />
		<parameter id="iFormat" value="EAD" />
		<parameter id="oMimeType" value="application/zip" />
		<parameter id="oFormat" value="ENRICH TEI P5" />
	</extension>
	<!-- new FOO to BAR converter plugin declaration -->
	<extension plugin-id="pl.psnc.dl.ege.root" point-id="XslConverter" id="FooToBarConverter">
		<parameter id="class" value="pl.psnc.dl.ege.FooToBarConverter"/>
		<parameter id="name" value="FOO to BAR converter"/>
		<parameter id="xsluri" value="http://pl.psnc.ege.pl/foobar.xsl" />
		<parameter id="iMimeType" value="text/xml" />
		<parameter id="iFormat" value="FOO" />
		<parameter id="oMimeType" value="text/xml" />
		<parameter id="oFormat" value="BAR" />
	</extension>
</plugin>