org.dspace.content.crosswalk
Class XSLTCrosswalk

java.lang.Object
  extended by org.dspace.core.SelfNamedPlugin
      extended by org.dspace.content.crosswalk.XSLTCrosswalk
Direct Known Subclasses:
XSLTDisseminationCrosswalk, XSLTIngestionCrosswalk

public abstract class XSLTCrosswalk
extends SelfNamedPlugin

Configurable XSLT-driven Crosswalk

This is the superclass of the XSLT dissemination and submission crosswalks. These classes let you can create many different crosswalks between DSpace internal data and any XML without changing any code, just XSL transformation (XSLT) stylesheets. Each configured stylesheet appears as a new plugin name, although they all share the same plugin implementation class.

The XML transformation must produce (for submission) or expect (for dissemination) a document in DIM - DSpace Intermediate Metadata format. See http://wiki.dspace.org/DspaceIntermediateMetadata for details.

Configuration

Prepare your DSpace configuration as follows:

A submission crosswalk is described by a configuration key like

  crosswalk.submission.PluginName.stylesheet = path
The alias names the Plugin name, and the path value is the pathname (relative to dspace.dir/config) of the crosswalk stylesheet, e.g. "mycrosswalk.xslt"

For example, this configures a crosswalk named "LOM" using a stylesheet in config/crosswalks/d-lom.xsl under the DSpace "home" directory:

  crosswalk.submission.stylesheet.LOM = crosswalks/d-lom.xsl

A dissemination crosswalk is described by a configuration key like

  crosswalk.dissemination.PluginName.stylesheet = path
The alias names the Plugin name, and the path value is the pathname (relative to dspace.dir/config) of the crosswalk stylesheet, e.g. "mycrosswalk.xslt"

You can have two names point to the same crosswalk, just add two configuration entries with the same path, e.g.

    crosswalk.submission.MyFormat.stylesheet = crosswalks/myformat.xslt
    crosswalk.submission.almost_DC.stylesheet = crosswalks/myformat.xslt
 

NOTE: This plugin will automatically reload any XSL stylesheet that was modified since it was last loaded. This lets you edit and test stylesheets without restarting DSpace.

You must use the PluginManager to instantiate an XSLT crosswalk plugin, e.g.

 IngestionCrosswalk xwalk = PluginManager.getPlugin(IngestionCrosswalk.class, "LOM");

Since there is significant overhead in reading the properties file to configure the crosswalk, and a crosswalk instance may be used any number of times, we recommend caching one instance of the crosswalk for each alias and simply reusing those instances. The PluginManager does this automatically.

Version:
$Revision: 3761 $
Author:
Larry Stone

Field Summary
protected static String CONFIG_PREFIX
          Prefix for all lines in the config file for XSLT plugins.
static org.jdom.Namespace DIM_NS
          DSpace XML Namespace in JDOM form.
 
Constructor Summary
XSLTCrosswalk()
           
 
Method Summary
protected  org.jdom.transform.XSLTransformer getTransformer(String direction)
          Initialize the Transformation stylesheet from configured stylesheet file.
protected static String[] makeAliases(String direction)
          Derive list of plugin name from DSpace configuration entries for crosswalks.
 
Methods inherited from class org.dspace.core.SelfNamedPlugin
getPluginInstanceName, getPluginNames, setPluginInstanceName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIM_NS

public static final org.jdom.Namespace DIM_NS
DSpace XML Namespace in JDOM form.


CONFIG_PREFIX

protected static final String CONFIG_PREFIX
Prefix for all lines in the config file for XSLT plugins.

See Also:
Constant Field Values
Constructor Detail

XSLTCrosswalk

public XSLTCrosswalk()
Method Detail

makeAliases

protected static String[] makeAliases(String direction)
Derive list of plugin name from DSpace configuration entries for crosswalks. The direction parameter should be either "dissemination" or "submission", so it looks for keys like crosswalk.submission.{NAME}.stylesheet


getTransformer

protected org.jdom.transform.XSLTransformer getTransformer(String direction)
Initialize the Transformation stylesheet from configured stylesheet file.

Parameters:
prefix - the direction of xwalk, either "submission" or "dissemination"
Returns:
transformer or null if there was error initializing.


Copyright © 2010 DuraSpace. All Rights Reserved.