lcnetdev / bibframe2marc

XSLT application to generate MARCXML from BIBFRAME RDF/XML
Creative Commons Zero v1.0 Universal
15 stars 5 forks source link

CircleCI

bibframe2marc

XSLT 1.0 conversion from RDF/XML BIBFRAME 2.0 to MARCXML.

Introduction

bibframe2marc consists of an XSLT 1.0 stylesheet that takes a set of XML rules and compiles them into another stylesheet (bibframe2marc.xsl). The conversion stylesheet takes an RDF/XML document representing a single BIBFRAME 2.0 description and converts it to a MARCXML document. The bibframe2marc.xsl stylesheet can be used as part of a conversion pipeline, as for example with the Biblio::BF2MARC perl library.

Dependencies

Run-time dependencies

Build dependencies

Usage

Conversion rules

The included set of conversion rules represent an implementation of the BIBFRAME to MARC conversion specifications, maintained by the Library of Congress. The rules are implemented using an XML-based domain specific language -- the RDF2MARC Conversion Language. For details on the conversion language, see the RDF2MARC rules documentation. For convenience, the conversion specifications are included in the specs directory of this repository as Excel spreadsheets.

Building

make in the root level of the working directory will create the bibframe2marc.xsl conversion stylesheet from the rules in the rules subdirectory. The destination stylesheet filename and path can be configured with the TARGET_XSL variable.

Using the generated conversion stylesheet

The bibframe2marc.xsl conversion stylesheet is an XSLT 1.0 application that converts a striped RDF/XML document containing a single BIBFRAME 2.0 "description" (defined as an RDF graph composed of exactly one top-level bf:Instance subject and one or zero top-level bf:Work subjects, linked using the bf:hasInstance or bf:instanceOf properties). It can be invoked as a standalone application using an XSLT 1.0 processor such as xsltproc, or it can be embedded in another application using a library such as libxslt for processing, as with the Biblio::BF2MARC perl library.

For more information about what consitutes a BIBFRAME description, see the design notes.

The converion stylesheet can take the following parameters:

Using the compiler stylesheet

The conversion stylesheet is generated from the rules in the rules subdirectory by the compiler stylesheet src/compile.xsl. You can adapt the sample conversion provided to your own needs, or create your own conversion rules. For more information, see the RDF2MARC rules documentation.

To build a conversion stylesheet from a rules file, you can just run the compiler stylesheet with an XSLT 1.0 processor. For example, using xsltproc:

xsltproc src/compile.xsl rules.xml > bibframe2marc.xsl

Tests

The compiler stylesheet has XSpec tests written for it that can be run with make test_compile (assuming that XSpec is installed and configured). The tests are in the tests subdirectory.

Named templates for data conversion that are generated by the compiler stylesheet can be tested with make test_named_templates.

The rules in the rules subdirectory can be tested using XSpec with make test_rules. Rules tests are in the rules/tests subdirectory.

The test target of the Makefile runs test_compile, test_named_templates, and test_rules.

TODO

Known issues

See also

License

As a work of the United States government, this project is in the public domain within the United States.

Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication.

Legal Code (read the full text).

You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. ...