Skip to content

Instantly share code, notes, and snippets.

@EmmaB
Last active December 12, 2016 18:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmmaB/f55a61f4cc502f562a61 to your computer and use it in GitHub Desktop.
Save EmmaB/f55a61f4cc502f562a61 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="ISO-8859-1"?>
<BK xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
<xsl:for-each select="ONIXMessage/Product">
<Book>
<xsl:variable name="form" select="ProductFormDetail"/>
<xsl:variable name="date" select="PublicationDate"/>
<xsl:variable name="isbn" select="ProductIdentifier[ProductIDType = '15']/IDValue"/>
<image href="file:///{$isbn}.jpg" />
<year><xsl:value-of select="concat(substring($date,7,2), '/',substring($date,5,2), '/',substring($date,1,4))"/></year>
<productid><xsl:value-of select="$isbn"/></productid>
<format>
<xsl:choose>
<xsl:when test="$form = 'B104'">A Format Paperback</xsl:when>
<xsl:when test="$form = 'B105'">B Format Paperback</xsl:when>
<xsl:when test="$form = 'B106'">Trade paperback</xsl:when>
<xsl:when test="$form = 'B304'">Full colour paperback</xsl:when>
<xsl:when test="$form = 'B501'">Jacketed hardback</xsl:when>
<xsl:when test="$form = 'B307'">Slipcase hardback limited edition with minted coin</xsl:when>
<xsl:when test="$form = 'B221'">Full colour paperback</xsl:when>
<xsl:when test="$form = 'B306'">Hardback Library edition</xsl:when>
<xsl:otherwise>Unknown</xsl:otherwise>
</xsl:choose>
</format>
</Book>
</xsl:for-each>
</BK>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment