xpath query on RSS feed, lt and text output

Fetch ‘Hot Google searches’ using the RSS feed (https://www.google.com/trends/hottrends/atom/feed) using an XPath query and display only the first 10 items as a list.

[wpws url='https://www.google.com/trends/hottrends/atom/feed' query='//channel/item/title' glue='<br />' query_type='xpath' output='text' lt=10]
<?php echo wpws_get_content(‘https://www.google.com/trends/hottrends/atom/feed’, ‘//channel/item/title’, array(‘query_type’ => ‘xpath’, ‘glue’ => ‘<br />’, ‘output’ => ‘text’, ‘lt’ => 10)); ?>
Total Eclipse of the Heart
Trump Eclipse
Ciencia Eclipse Solar
Diy Solar Eclipse Glasses
Eclipse Tracker
Taylor Swift
Canvas
2024 Eclipse Usa
Where To Get Eclipse Glasses
Abc News

5 thoughts on “xpath query on RSS feed, lt and text output

  1. M says:

    Hi, I can’t get xpath to work because I use the ‘[‘ character in my query. Can you show an example of a query where this value is used (or the workaround to run a query that has this value)?

    Thanks.

    1. Akshay Raje says:

      You can urlencode the square brackets like this: [ = %5b and ] = %5d. Make sure you set querydecode=”1″ in the shortcode for this to function. For more information on this, check querydecode in documentation.

  2. catchpen says:

    Found a good Firefox tool to use with your plugin… The Firepath addon will easily generate the xpath. Then you just have to urlencode the quotes and brackets and copy/paste for your shortcode query.

Leave a Reply