X hits on this document

371 views

0 shares

1 downloads

0 comments

68 / 142

MODS

<recordIdentifier>6459314</recordIdentifier> </recordInfo> </mods>

Exercise - Transform MARCXML to MODS

In this exercise you will transform a MARCXML file into a MODS file.

  • 1.

    Open xslt/MARC21slim2MODS3.xsl in your text editor or Web browse. This file is available at the Library of Congress's MARCXML website, and probably the longest and most complicated XSLT stylesheet in the workbook.

  • 2.

    Open a command prompt and change directories to the workbook's root.

  • 3.

    Transform a MARCXML file into a MODS file using this command: xsltproc xslt/ MARC21slim2MODS3.xsl xml-data/marcxml/single/catalog.xml . The result should be streams of XML.

  • 4.

    Transform the data again, but this time save it to a file: xsltproc xslt/MARC21slim2MODS3.xsl xml-data/marcxml/single/catalog.xml > xml-data/mods/single/catalog.xml . The advantage of this file, just like the advantage of MARC files and MARCXML files, is all your data is on a single file. As such it is easy to transport from computer to computer.

Exercise - Transform MARCXML to MODS, re- dux

In this exercise you will transform a single MARCXML file containing many MARCXML records into a set of many individual MODS files. You will find these individual files easier to index.

1.

In your text editor, open xslt/marcxml2mods.xsl. This is an altered version of the stylesheet used in the previous exercise. It has been altered in such a way to loop through records in a MARCXML file and save them as individual files. This is done through the xsl:for-each, xsl:param, and xsl:document elements/commands. Notice the hard-coded href attribute of the xsl:document ele- ment:

<xsl:for-each select="marc:collection/marc:record"> <xsl:param name="filename" select='marc:datafield[@tag="099"]/marc:subfield[@ <xsl:document method="html" href='xml-data/mods/many/{$filename}.xml'> <mods version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd"> <xsl:call-template name="marcRecord"/> </mods> </xsl:document> </xsl:for-each>

60

Document info
Document views371
Page views377
Page last viewedSat Dec 03 11:43:27 UTC 2016
Pages142
Paragraphs3126
Words34660

Comments