-
-
Save bhattisatish/270518 to your computer and use it in GitHub Desktop.
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:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'> | |
<!-- | |
Author: | |
Pierre Lindenbaum | |
http://plindenbaum.blogspot.com | |
Usage : | |
xsltproc ff.xsl "http://friendfeed-api.com/v2/feed/the-life-scientists?start=0&num=500&format=xml" | gzip > file.xml.gz | |
--> | |
<xsl:output method="xml" indent="yes"/> | |
<xsl:param name="group">the-life-scientists</xsl:param> | |
<xsl:template match="/feed"> | |
<feed> | |
<description><xsl:value-of select="description"/></description> | |
<type><xsl:value-of select="type"/></type> | |
<id><xsl:value-of select="id"/></id> | |
<name><xsl:value-of select="name"/></name> | |
<xsl:call-template name="recurs"><xsl:with-param name="node" select="."/></xsl:call-template> | |
</feed> | |
</xsl:template> | |
<xsl:template name="recurs"> | |
<xsl:param name="node"/> | |
<xsl:param name="start" select="0"/> | |
<xsl:param name="num" select="500"/> | |
<xsl:copy-of select="$node/entry"/> | |
<xsl:if test="$node/entry"> | |
<xsl:variable name="url" select="concat('http://friendfeed-api.com/v2/feed/',$group,'?format=xml&start=',($start+count($node/entry)),'&num=',$num)"/> | |
<xsl:message terminate="no">Download <xsl:value-of select="$url"/></xsl:message> | |
<xsl:variable name="dom" select="document($url,/)"/> | |
<xsl:call-template name="recurs"> | |
<xsl:with-param name="node" select="$dom/feed"/> | |
<xsl:with-param name="start" select="$start+count($node/entry)"/> | |
</xsl:call-template> | |
</xsl:if> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment