I have this XSLT file that I’m using to translate WordPress articles from a category RSS feed (namely this one). Mostly everything is working the way it should, expect for when I’m trying to get the value of the “content:encoded” element using xsl:value-of
. Nothing is returned when I use the following code. Is there something that I’m missing, or is the colon in “content:encoded” messing up the XSLT?
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0"
exclude-result-prefixes="dc">
<xsl:output method = "html" omit-xml-declaration="yes" />
<xsl:param name="limit"></xsl:param>
<xsl:param name="hide">none</xsl:param>
<xsl:template match="/">
<xsl:for-each select="rss/channel/item">
<xsl:variable name="link" select="link"/>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
<xsl:value-of select="title" disable-output-escaping="yes"/>
</xsl:element>
<br />
<xsl:value-of select="content:encoded" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks much.
Ended up finding out that the colon was doing funky namespace stuff. Silly WordPress. So I ended up using
*[name()='content:encoded']
instead of justcontent:encoded
.