Reputation: 8836
In a feedburner RSS I use
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
to get all the content of a feed with structure like below :
<feed>
<entry><published></published><title></title><content></content>....</entry>
</feed>
My question is, if it is possible to get only the 10 first <entry></entry>
instead of all the 25 ? How to do it ?
Note : The entry tag has this form <entry gd:etag="W/"AkcHRH8yfSp7ImA9WhdUFkg."">
I do not know if this matters
Upvotes: 0
Views: 136
Reputation: 97631
Your template was recursive. You then changed the behaviour of the outer template, breaking the recursion.
The simplest way to do what you want would be:
<xsl:template match="/feed/entry[position() < 10]">
<xsl:copy-of select="." />
</xsl:template>
Upvotes: 0
Reputation: 7112
smth like
/feed/entry[position()<10]
I mean, you need add this template:
<xsl:template match="entry[position() > 10]"/>
That drop all the entries after 10's, or something equal. The main suggestion is to take a look at position()
function.
Upvotes: 2