secret
Created

Dump allmusic XML data to text files

  • Download Gist
foo_allmusic.xsl
XSLT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.