I am building an RSS parser that takes in the media namespace's items.
Example 1:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Some channel</title>
<item>
<guid>234wwerwe</guid>
<title>Some title</title>
<media:description>test description 1</media:description>
<pubDate>Tue, 30 Jul 2019 19:24:00 +0000</pubDate>
</item>
</channel>
</rss>
Example 2:
<rss version="2.0" xmlns:media="http://www.rssboard.org/media-rss">
<channel>
<title>Some second channel</title>
<item>
<guid>234wwsdflkjl23we</guid>
<title>Some other title</title>
<media:description>test description 2</media:description>
<pubDate>Tue, 30 Jul 2019 19:24:00 +0000</pubDate>
</item>
</channel>
</rss>
I would like to convert this using the same xsl file but if I do something like the following:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:boardMedia="http://www.rssboard.org/media-rss">
<xsl:template match="/">
<xsl:for-each select="rss/channel/item">
<item>
<xsl:element name="referenceId">
<xsl:value-of select="guid" />
</xsl:element>
<xsl:element name="title">
<xsl:value-of select="title" />
</xsl:element>
<xsl:element name="description">
<xsl:value-of select="media:description" />
<xsl:value-of select="boardMedia:description" />
</xsl:element>
<xsl:element name="itemPublishDate"><xsl:value-of select="pubDate" /></xsl:element>
</item>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
then it only successfully pulls the description for the first rss, not the second.
Any suggestions on how to do this in one xsl file?