xsl-list
[Top] [All Lists]

[xsl] how to limit number of items shown

2009-05-30 21:01:43
Hello!
Sorry to bother you with a simple question.

This is what I a need to acheive:
Suppose I have an RSS feed from a website that may have anywhere from
1 to 25 items inside the <channel> element

So the XML would be like this:
<channel>
  <item>
    <title>some title</title>
    <description>some descrption</description>
  </item>
  <item>
    <title>some title</title>
    <description>some descrption</description>
  </item>
  <item>
    <title>some title</title>
    <description>some descrption</description>
  </item>
</channel>

What I need is a way to make sure I show no more than 10 items, even
if XML has 25 items.

I need this to be done with XSL 1.0 without any extra extensions. This
is for a browser based transformation.
I know XSL 1 does not have a real "for loop", only foreach, which is
why I don't know how to exit from the loop after 'n' items
have been processed.

Please just tell me the way to do this.

Thank you.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>