Last active
August 29, 2015 14:07
-
-
Save petermacdonald/9747ecb4f76df2fe472a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet xmlns:default="http://www.loc.gov/mods/v3" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" | |
xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon"> | |
<!-- | |
This stylesheet was originally designed to split an XML file containing multiple MODS records into separate MODS files. | |
It names each file by targeting the identifier element in the record being exported to use as the file name. | |
Requires the SAXON Extensions be loaded: | |
http://users.breathe.com/mhkay/saxon/saxon5-5-1/extensions.html | |
--> | |
<!-- INSTRUCTIONS | |
1. Load your XML file into oXygen: | |
2. load splitXMLFile.xsl into oXygen and select Saxon6.5.5 as the processor. | |
5. Run splitXMLFile.xsl on the MODS XML file (if necessary, delete the name "mods.xml" from oXygen's Output: box). | |
--> | |
<xsl:output method="xml" indent="yes" encoding="UTF-8"/> | |
<!-- Remove all CRs, line feeds, etc. --> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:for-each select="/*/*/*[not(. > 3)]"> | |
<saxon:output href="Y:\xslt\scripts-output\{./default:identifier}.xml"> | |
<xsl:copy-of select="."/> | |
</saxon:output> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This stylesheet was originally designed to split an XML file containing multiple MODS records into separate MODS files.
It names each file by using the mods:identifier element in the specific record being exported a that time.
You'll need to edit the line where the output is written so it points to a valid path on your system.
The script requires the SAXON Extensions be loaded:
http://users.breathe.com/mhkay/saxon/saxon5-5-1/extensions.html
If you use oXygen for the transformation be sure to select the Saxon6.5.5 as the processor.