Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Complete MODS => OAI DC transformation
<?xml version="1.0"?>
<oai_dc:dc xmlns:oai_dc="" xmlns:dc="">
<dc:title>Do Re Mi</dc:title>
<title>Do Re Mi</title>
#!/usr/bin/env bash
# to actually transform the file you need some kind of program that can interpret an XSLT
# transform & `xsltproc` is available on Mac/Linux for this purpose, this is a shell script
# you could run on the command line to accomplish the transformation
xsltproc transform.xsl mods.xml > dublincore.xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/xml">
<oai_dc:dc xmlns:oai_dc="" xmlns:dc="">
<xsl:for-each select="mods/titleInfo/title">
<xsl:value-of select="mods/titleInfo/title" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment