Skip to content

Instantly share code, notes, and snippets.

@tts
Created June 3, 2012 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tts/2862888 to your computer and use it in GitHub Desktop.
Save tts/2862888 to your computer and use it in GitHub Desktop.
XML2CSV transformation of a selection of MARC fields from Vaski library consortia open bibliographic data
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output encoding="UTF-8" method="text" indent="no"/>
<!--
Selection of MARC fields from Vaski library consortia open bibliographic data
Transformation from XML to CSV. Field separator ";"
http://data.kirjastot.fi/data.html
CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Tuija Sonkkila 31.5.2012
-->
<xsl:template match="//book">
<xsl:value-of select="if (string-length(isbn) > 0) then isbn else 'NA'"/>;<xsl:value-of select="if (string-length(lang)>0) then lang else 'NA'"/>;<xsl:value-of select="if (string-length(year)>0) then year else 'NA'"/>;<xsl:value-of select="if (string-length(pages)>0) then pages else 'NA'"/>;<xsl:value-of select="if (string-length(size)>0) then size else 'NA'"/>;<xsl:value-of select="if (string-length(cat)>0) then cat else 'NA'"/>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment