Skip to content

Instantly share code, notes, and snippets.

@rornor
Created March 20, 2013 13:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rornor/b91dee6eeac15d8bdfb3 to your computer and use it in GitHub Desktop.
Dump allmusic XML data to text files
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:variable name="offenders">&lt;&gt;&amp;!-+:/\</xsl:variable>
<xsl:for-each select="//Item">
<xsl:if test="bio">
<xsl:variable name="filename" select="concat(translate(comment(), $offenders, '_'), '_bio', '.txt')" />
<xsl:result-document href="{$filename}">
<xsl:value-of select="bio/text()" />
</xsl:result-document>
</xsl:if>
<xsl:if test="review">
<xsl:variable name="filename" select="concat(translate(comment(), $offenders, '_'), '_review', '.txt')" />
<xsl:result-document href="{$filename}">
<xsl:value-of select="review/text()" />
</xsl:result-document>
</xsl:if>
</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