Skip to content

Instantly share code, notes, and snippets.

@kschlottmann
Created June 14, 2018 01:04
Show Gist options
  • Select an option

  • Save kschlottmann/c7bf31b95309d9c077cddbff777163c3 to your computer and use it in GitHub Desktop.

Select an option

Save kschlottmann/c7bf31b95309d9c077cddbff777163c3 to your computer and use it in GitHub Desktop.
XSLT to grab every 80th record from an OAI output file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<!-- this stylesheet will take the output of an oai feed and select every 80th record -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="repository/record[not(position() mod 80 = 1)]">
<!-- do nothing -->
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment