Last active
October 25, 2017 08:46
-
-
Save halfwit/d5251e2b0e58c1f5199c49dfbf836e5d to your computer and use it in GitHub Desktop.
xslt examples for https://github.com/halfwit/scripts/blob/master/updatefeeds, full credit to @Earnestly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>	</xsl:text> | |
<xsl:value-of select="atom:title"/> | |
<xsl:text> </xsl:text> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>	</xsl:text> | |
<xsl:value-of select="rss:title"/> | |
<xsl:text> </xsl:text> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>	</xsl:text> | |
<xsl:value-of select="title"/> | |
<xsl:text> </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