Created
June 16, 2011 21:25
-
-
Save tiffyzsmile/1030322 to your computer and use it in GitHub Desktop.
XSLT for reading an Atom feed
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
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:transform version="1.0" | |
xmlns:a="http://www.w3.org/2005/Atom" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
> | |
<xsl:strip-space elements="*"/> | |
<xsl:output method="text"/> | |
<xsl:template match="*"/> | |
<xsl:template match="a:feed"> | |
<xsl:text>Atom Feed: </xsl:text><xsl:value-of select="a:id"/> | |
<xsl:text> </xsl:text> | |
<xsl:apply-templates/> | |
</xsl:template> | |
<xsl:template match="a:entry"> | |
<xsl:text> ---------------------------------------- </xsl:text> | |
<xsl:text> Feed entry: </xsl:text><xsl:value-of select="a:id"/> | |
<xsl:text> </xsl:text> | |
<xsl:apply-templates/> | |
</xsl:template> | |
<xsl:template match="a:title|a:updated"> | |
<xsl:if test="parent::a:entry"> | |
<xsl:value-of select="' '"/> | |
</xsl:if> | |
<xsl:value-of select="local-name()"/>:<xsl:apply-templates/> | |
<xsl:text> </xsl:text> | |
</xsl:template> | |
</xsl:transform> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment