Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page describes a powerful crosswalk plugin which is part of
the of the Crosswalk Plugins family. The code was added in DSpace 1.4.

The XSLT Crosswalk classes let you can create many different crosswalks between
DSpace between DSpace internal data and any XML format. Just add another XSLT (XSL
transformationXSL transformation) stylesheet to the configuration to create a new crosswalk.
Each  Each stylesheet appears as a new plugin name, although they all
share all share the same plugin implementation class.

The XML transformation must produce (for submission) or expect (for
disseminationfor dissemination) a document in DIM - DSpace Intermediate Metadata format.
See  See DSpace Intermediate Metadata for details.

...

A submission crosswalk is described by a DSpace configuration key like:

Panel
Code Block
crosswalk.submission.
'''pluginName'''
<pluginName>.stylesheet = 
'''path'''
<path>

The

...

pluginName

...

is the plugin name given to the Plugin Manager,
and the

Code Block
'''path'''

 and the path value is the pathname (relative to

Code Block
$\{dspace.dir\}/config

)
of to [dspace]/config/) of the crosswalk stylesheet, e.g.

...

For example, this configures a crosswalk named "LOM" using a stylesheetstylesheet in in

Code Block
[dspace]/config/crosswalks/s-lom.xsl

(under the DSpace "home" directory):

Panel
Code Block
crosswalk.submission.LOM.stylesheet = crosswalks/s-lom.xsl

Configuring a Dissemination Crosswalk

A dissemination crosswalk is described by a DSpace configuration key like

...

Code Block
crosswalk.dissemination.
'''pluginName'''
<pluginName>.stylesheet = 
'''path'''
<path>

The pluginName is the plugin name given to the Plugin Manager,
and  and the pathvalue is the pathname (relative to

Code Block
$\{dspace.dir\}/config

)
of to [dspace]/config/) of the crosswalk stylesheet, e.g. "

...

mycrosswalk.xslt

...

"

The disseminator also needs to be configured with all of the XML Namespaces
that Namespaces that might appear in its output, including the prefix and URI for each one.
It also needs a value to include in the

...

the schemaLocation

...

attribute.
These  These are configured on additional properties in the DSpace Configuration, i.e.:

code
Code Block
 crosswalk.dissemination.'''pluginName'''<pluginName>.namespace.'''prefix'''<prefix> = '''namespace-URI'''
 <namespace-URI>
crosswalk.dissemination.'''pluginName'''<pluginName>.schemaLocation = '''Schema<Schema Location string'''string>
 crosswalk.dissemination.'''pluginName'''<pluginName>.preferList = '''boolean'''
<boolean>

preferList

...

indicates  indicates whether the output should be a list of elements
elements (like the Dublin Core XML formats) or a single element. All it does is
change is change the value returned by the plugin's

...

preferList()

...

method.
The  The default, which is correct in most cases, is

...

is false

...

.

For example, a plugin named

...

named MODS

...

:

Code Block
 crosswalk.dissemination.MODS.stylesheet = crosswalks/mods_out.xsl
 crosswalk.dissemination.MODS.namespace.mods = <nowiki>http://www.loc.gov/mods/v3</nowiki>
 crosswalk.dissemination.MODS.schemaLocation = <nowiki>http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd</nowiki>

You can configure two (or more) names to point to the same crosswalk,
just  just add two configuration entries with the same path, e.g.

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

...

Info

This first tip applies to OAI in DSpace up to version 1.8.2. It no longer applies to the new OAI in DSpace 3.0, because stylesheets in there (metadataFormats) take the "xoai" format as input, not the "DIM" format as the old OAI.

...

To invoke the crosswalk tester, run the class as follows:

Code Block
 [dspace]/bin/dspace dsrun org.dspace.content.crosswalk.XSLTIngestionCrosswalk <plugin name> <input-file>

For example, you can test the LOM plugin on the file test.xml with:

Code Block
 [dspace]/bin/dspace dsrun org.dspace.content.crosswalk.XSLTIngestionCrosswalk LOM test.xml

Add the -l option to pass the submission stylesheet a list of elements instead of a whole document, as if the List form of the ingest() method had been called, e.g.:

Code Block
 [dspace]/bin/dspace dsrun org.dspace.content.crosswalk.XSLTIngestionCrosswalk -l LOM test.xml

In any case, the output will be prettyprinted XML of the DIM document returned by the stylesheet.

Usage

You must use the

...

PluginManager

...

to instantiate an XSLT crosswalk plugin, e.g.

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

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

Code Block
PluginManager

The PluginManager does this automatically.

Auto-reloading

Code Block
PluginManager
Panel

 

 

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