Class XSLTCrosswalk
- java.lang.Object
-
- org.dspace.core.SelfNamedPlugin
-
- org.dspace.content.crosswalk.XSLTCrosswalk
-
- Direct Known Subclasses:
XSLTDisseminationCrosswalk,XSLTIngestionCrosswalk
public abstract class XSLTCrosswalk extends SelfNamedPlugin
Configurable XSLT-driven CrosswalkThis 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 todspace.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.xslunder 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 todspace.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.xsltNOTE: 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
PluginServiceto instantiate an XSLT crosswalk plugin, e.g.IngestionCrosswalk xwalk = CoreServiceFactory.getInstance().getPluginService().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
PluginServicedoes this automatically.- Version:
- $Revision$
- Author:
- Larry Stone
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringCONFIG_PREFIXPrefix for all lines in the config file for XSLT plugins.static org.jdom.NamespaceDIM_NSDSpace XML Namespace in JDOM form.
-
Constructor Summary
Constructors Constructor Description XSLTCrosswalk()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TransformergetTransformer(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
-
-
-
-
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
-
-
Method Detail
-
makeAliases
protected static String[] makeAliases(String direction)
Derive list of plugin name from DSpace configuration entries for crosswalks.- Parameters:
direction- "dissemination" or "submission", so it looks for keys likecrosswalk.submission.{NAME}.stylesheet- Returns:
- names to be given to the plugins of that direction.
-
getTransformer
protected Transformer getTransformer(String direction)
Initialize the Transformation stylesheet from configured stylesheet file.- Parameters:
direction- the direction of xwalk, either "submission" or "dissemination"- Returns:
- transformer or null if there was error initializing.
-
-