7train METS Generation Tool - Documentation




Overview & Files

7train.xsl is the base stylesheet in the transformation and defines the basic elements and structure of a METS file. Local installations can customize this process by creating a stylesheet that imports 7train.xsl and overrides certain templates. The "cdm.xsl" stylesheet (in the default implementation) is an example of a local installation designed to transform a specific XML file (CONTENTdm export) into a specific kind of METS.

The files included in this distribution are as follows:

  • 7train.xsl - this is the stylesheet that constructs the basic METS sections; it does not attempt to define values for elements or attributes
  • cdm.xsl - this primary stylesheet defines how the values in the original XML document will be transformed; in addition, it determines the structure and values for the METS sections defined in 7train.xsl
  • xwalker.xsl - this stylesheet contains the logic that processes the mappings defined in *.xwalk to populate metadata sections in the METS (mainly the <dmdSec>)
  • cdmmd2dc.xwalk - this document defines the mappings between the original XML elements to the desired metadata schema
  • About7train.txt - this document
  • InstallAndRun.txt - instructions on 7train requirements, installation procedures and how execute the transformation process
  • Customization.txt - instructions on how to customize various elements of the 7train process
  • input/ - the directory to hold input documents, including the original XML export, as well as "driver" files
  • idmap.xml - an identifier map file
  • institutions.xml - a CDL-specific map file
  • examples/ - the directory where example files are contained; currently holds only oai.xsl
  • oai.xsl - found in the examples/ directory; this file provides a basic OAI record to METS conversion
  • output/ - the directory output METS files are written to


7train requires the use of Saxon 8, as it is composed using XSL version 2.0. It also requires that 2 working directories be created. These directories are used for holding the data that a.) will be transformed and b.) saved as the result of the transformation. These need to be named: "input" and "output" and need to be created at the same level as this stylesheet. The "input" directory contains both exports to be transformed as well as map files used to associate data not include in the export. The resulting METS output from the transformation will be saved in "output".

Both of these requirements are delivered in the ZIP file that packages 7train.

7train also requires that Java be installed on your computer. If Java is not installed, see the Troubleshooting section below.




  • Download and unzip 7train.zip. This will create a directory called 7train that contains the files described above.
  • Export your collection from CONTENTdm using the CONTENTdm Standard XML export.
  • Save CONTENTdm export in the input directory.
  • OPTIONAL: Create your idmap and/or institutionmap files and place them in the input directory.  See "InstallAndRun.txt" - included with 7train.zip - for more information.  Remove "idmap.xml" and "institutionmap.xml" from the input directory if you do not wish to use this option.



Running 7train:


Drag & Drop:

  • Drag the CONTENTdm Standard XML export file onto the file "cdm.bat."
  • The METS records will be saved in the directory "output."

Command Line:

  • Open a Command Prompt (Start/Program Files/Accessories/Command Prompt).
  • Go the the 7train directory (i.e. cd C:\Documents and Settings\username\Desktop\7train).
  • Type the following command and hit enter:
    .\cdm.bat input\CONTENTdmExportFileName.xml
  • The METS records will be saved in the directory "output."  (Known bug: the METS may be saved to C:\output\. This will be fixed in the next release.)


  • Open a terminal window (in Applications/Utilities)
  • Go to the 7train directory (cd /path/to/7train/)
  • Enter the following command:
  • sh cdm.sh input/CONTENTdmExportFileName.xml


  • In a shell window, go to the 7train directory and enter the following command:
  • sh cdm.sh input/CONTENTdmExportFileName.xml




SaxonFor information on the Saxon parser, please go to the Saxon website
Installing JavaPlease go to the Sun website for details on how to install Java on Microsoft Windows: Installation Notes for Microsoft Windows
Setting JAVA_HOMEFor Mac and Linux users, if you are encountering errors that look like this:
  cdm.sh: /path/to/java/bin/java: not found
 please be certain that you JAVA_HOME variable is set. In bash (Linux or Mac OS X), type the following:
  export JAVA_HOME=/path/to/java/dir
 or in (t)csh:
  setenv JAVA_HOME /path/to/java/dir
 The JAVA_HOME variable should be set to such a value that, if /bin/java is appended (e.g., /path/to/java/dir/bin/java), it resolves to the java binary.
Bug Reports & FeedbackSubmit a New Bug
 Submit a New Support Request