Skip to content

Instantly share code, notes, and snippets.

@tts tts/gist:2862888
Created Jun 3, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.