Skip to content

Instantly share code, notes, and snippets.

@Answeror
Last active August 29, 2015 14:05
Show Gist options
  • Save Answeror/cf720fb98e9f1dd27cad to your computer and use it in GitHub Desktop.
Save Answeror/cf720fb98e9f1dd27cad to your computer and use it in GitHub Desktop.
New York City Department of Transportation Atom feed
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet
version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>
<xsl:output method='xml' encoding='UTF-8'/>
<xsl:template match='/'>
<feed xml:lang='en-US' xmlns='http://www.w3.org/2005/Atom'>
<id>nyc</id>
<link rel='alternate' type='text/html' href='http://www.nyc.gov/html/dot/html/home/home.shtml'/>
<title><xsl:value-of select='//title'/></title>
<xsl:apply-templates select='//div[@class="feature-home-main"]' mode='features'/>
<xsl:apply-templates select='//div[@class="feature-home-secondary"]' mode='features'/>
</feed>
</xsl:template>
<xsl:template match='div' mode='features'>
<xsl:for-each select='.//a'>
<entry>
<id><xsl:value-of select='@href'/></id>
<link rel='alternate' type='text/html'>
<xsl:attribute name='href'>
<xsl:value-of select='@href'/>
</xsl:attribute>
</link>
<title><xsl:value-of select='.//h1'/></title>
<summary><xsl:value-of select='.//p'/></summary>
<content type='html'>
<xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
<xsl:apply-templates select='.//p/node()' mode='content'/>
<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
</content>
</entry>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
{
"@xslt": {
"html": {
"@base64_decode": {
"[]": [
{"@request": "http://www.nyc.gov/html/dot/html/home/home.shtml"},
"body"
]
}
},
"xslt": {
"@jinja2": {
"template": {"text<": "atom.xslt"},
"kargs": {}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment