Skip to content

Instantly share code, notes, and snippets.

@halfwit
Last active October 25, 2017 08:46
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 halfwit/d5251e2b0e58c1f5199c49dfbf836e5d to your computer and use it in GitHub Desktop.
Save halfwit/d5251e2b0e58c1f5199c49dfbf836e5d to your computer and use it in GitHub Desktop.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="text"/>
<xsl:template match="/atom:feed">
<xsl:for-each select="atom:entry">
<xsl:value-of select="atom:link/@href"/>
<xsl:text>&#x9;</xsl:text>
<xsl:value-of select="atom:title"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rss="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<xsl:output method="text"/>
<xsl:template match="/rdf:RDF">
<xsl:for-each select="rss:item">
<xsl:value-of select="rss:link"/>
<xsl:text>&#x9;</xsl:text>
<xsl:value-of select="rss:title"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/rss">
<xsl:for-each select="channel/item">
<xsl:choose>
<xsl:when test="guid/@isPermaLink = 'true'">
<xsl:value-of select="guid"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="link"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#x9;</xsl:text>
<xsl:value-of select="title"/>
<xsl:text>&#10;</xsl:text>
</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