Skip to content

Instantly share code, notes, and snippets.

@craibuc
Last active December 19, 2015 14:39
Show Gist options
  • Select an option

  • Save craibuc/5970414 to your computer and use it in GitHub Desktop.

Select an option

Save craibuc/5970414 to your computer and use it in GitHub Desktop.
Convert HTML table at http://epic.usergroup.healthitsocial.com/page/epic-hospitals to XML using a YQL query with this XSLT.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="//table[@width='623']">
<locations>
<xsl:apply-templates select="descendant::tr" />
</locations>
</xsl:template>
<xsl:template match="//tr">
<location>
<xsl:attribute name='name'>
<xsl:value-of select="td[1]/p" />
</xsl:attribute>
<xsl:attribute name='city'>
<xsl:value-of select="td[2]/p" />
</xsl:attribute>
<xsl:attribute name='region'>
<xsl:value-of select="td[3]/p" />
</xsl:attribute>
</location>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment