Sometimes it is desirable to only keep and return the first N entries from a feed. For illustration purposes, we will use the Yahoo Music Top Songs
RSS feed which returns the top 10 most played songs on Yahoo! Music. In what follows, we will show how to use the new "Specify Filter condition" feature of the data mashup editor to retrieve the top 3 entries.
Assuming you are familiar with the Data Mashup Editor, we will bring the Yahoo Music feed into the editor by using the Source operator. For our purpose, we want to disable the default RSS handling logic and treat the whole feed as a sinlge "entry". To do that, we have to change the feed type to XML and select "channel" as the repeating element.
Next we will use a Transform operator to modify the input feed. We first copy all the elements under the "channel" element on the input tree onto the"entry" element under the output tree. As illustrated in the attached image below, we did the copying by first selecting the "entry" element from the output tree, then right button click successively on each child element of "channel" and select the "Copy to output tree" menu.
After finish copying all the child elements of "channel" onto the output tree, we right button click on the "item" element on the output tree to bring up the context menu and select "Specify Filter condition"
Once the dialog comes up, we will change the value to 4 and the comparison operator to '<'.
That's it. We just need to connect the Transform operator to the Publish operator and change the root and repeating element name to "rss" and "channel" respectively. You will find the completed sample data mashup