I'm fairly new to xsl and am trying to find a way to hide, or mute, all but two nodes in an wordpress rss feed's xml, structured like so:
?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
<title>Title</title>
<atom:link href="http://www.alink.com" rel="self" type="application/rss+xml" />
<link>http://www.alink.com</link>
<description>Just another WordPress site</description>
<lastBuildDate>Sun, 21 Apr 2013 22:13:55 +0000</lastBuildDate>
<language>en-US</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>http://wordpress.org/?v=3.5.1</generator>
<item>
<title>A Title</title>
<link>http://www.alink.com</link>
<comments>comments</comments>
<pubDate>Sun, 21 Apr 2013 22:13:55 +0000</pubDate>
<dc:creator>aUser</dc:creator>
<category><![CDATA[Uncategorized]]></category>
<guid isPermaLink="false">http://www5.uifoundation.org/news/?p=112</guid>
<description><![CDATA[Post[...]]]></description>
<content:encoded> Posted October 10, 2013 </content:encoded>
<wfw:commentRss>http://www.alink.com</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
But I want to display only the channel/title and channel/link in my transformation. I was thinking something along the lines of using an empty template on all the nodes, like this
<xsl:template match="channel/* EXCEPTION channel/item/title | channel/item/link" />
I'm unsure of how to declare the exception though. If there's a better way of doing this, I'd be open to that too
I really just want the output to be an unordered list of item/title
, with the value of item/link
, with everything else hidden. An example of the output would be:
<ul>
<li>
<a href= "www.aLink.com">A Title</a>
</li>
</ul>