Class XSLTCrosswalk
- All Implemented Interfaces:
NameAwarePlugin
- Direct Known Subclasses:
XSLTDisseminationCrosswalk,XSLTIngestionCrosswalk
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 = pathThe 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 = pathThe 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 PluginService to 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 PluginService
does this automatically.
- Author:
- Larry Stone
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringPrefix for all lines in the configuration file for XSLT plugins.static final org.jdom2.NamespaceDSpace XML Namespace in JDOM form. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 Details
-
DIM_NS
public static final org.jdom2.Namespace DIM_NSDSpace XML Namespace in JDOM form. -
CONFIG_PREFIX
Prefix for all lines in the configuration file for XSLT plugins.- See Also:
-
-
Constructor Details
-
XSLTCrosswalk
public XSLTCrosswalk()
-
-
Method Details
-
makeAliases
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
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.
-