Skip to content

Instantly share code, notes, and snippets.

@rmeekers
Last active September 24, 2019 12:39
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 rmeekers/b601fcceaa4e652c05530ff5ad0b053b to your computer and use it in GitHub Desktop.
Save rmeekers/b601fcceaa4e652c05530ff5ad0b053b to your computer and use it in GitHub Desktop.

This describes how you can convert an XML file to a simple HTML table. The table can then be copy/pasted into a Google Sheet for example for further manipulation.

Install Saxon

brew install saxon

Convert XML file to HTML

saxon -s:input.xml -xsl:stylesheet.xsl -o:result.html

Sample XSL

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
  <table>
    <tr>
      <th>url</th>
      <th>event_date</th>
    </tr>
    <xsl:for-each select="rss/channel/item">
    <tr>
      <td><xsl:value-of select="link" /></td>
      <td><xsl:value-of select="event_date" /></td>
    </tr>
    </xsl:for-each>
  </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment