Hi,
I've been successfully working with the News Feeds for quite a while now.
This week however, I ran into a problem: one of the nodes in my rss feed, has a custom namespace.
The node with the custom namespace is not returned, no matter what I try.
Example feed:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:mailplus="http://api.mailplus.nl/rss/mailplus/">
<channel>
<item>
<title>test</title>
<link>www.google.com</link>
<description>This is a test</description>
<mailplus:image>
<![CDATA[http://www.eredivisielivenieuwsbrief.nl/Portals/0/Images/Nieuws/ADO FC Groningen vierkant 2.jpg]]>
</mailplus:image>
</item>
</channel>
</rss>
Example of my XSL file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mailplus="http://api.mailplus.nl/rss/mailplus/">
<xsl:output method="html" indent="yes"/>
<xsl:param name="ItemsToShow"/>
<xsl:param name="ShowItemDetails"/>
<xsl:param name="ShowItemDate"/>
<xsl:param name="Locale"/>
<xsl:param name="Target"/>
<xsl:template match="rss">
<ul class="RSS">
<xsl:for-each select="channel/item">
<xsl:sort select="position()" data-type="number" order="descending" />
<xsl:if test="position()<=$ItemsToShow or $ItemsToShow<1">
<li>
<h3>
<xsl:attribute name="target"><xsl:value-of select="$Target"/></xsl:attribute>
<xsl:value-of select="title"/>
</h3>
<xsl:value-of select="./*[namespace-uri()='http://api.mailplus.nl/rss/mailplus/']" disable-output-escaping="yes"/>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Expected result:
Test
<![CDATA[http://www.eredivisielivenieuwsbrief.nl/Portals/0/Images/Nieuws/ADO FC Groningen vierkant 2.jpg]]>
Actual result:
Test
I tested with multiple different select statements, for instance:
select="mailplus:image"
select="./mailplus:*"
select="./*[local-name()='image']"
select="./*[namespace-uri()='http://api.mailplus.nl/rss/mailplus/']"
select="./*[local-name()='image' and namespace-uri()='http://api.mailplus.nl/rss/mailplus/']"
However, none of these return anything.
I've been able to test these select statements successfully in the online parser at http://www.xpathtester.com/test. I do have to change the "./" in the select query to "//" when using the online parser, because I'm not using a for-each loop in that case.
Can anyone confirm that I'm on the right track, or point me to what I'm doing wrong?
I'm also starting to wonder if there could be a difference in the XSL parser used in the NewsFeeds module and in the online tool I'm using to test my select statements.
Thanks in advance for your suggestions.
Hanneke