I'm not sure why this is happening, but here it goes.
I have a source XML doc, like this:
[code]<?xml version="1.0" encoding="UTF-8"?>
<mostrequested>
<request>
<mr_title>...</mr_title>
<mr_url>...</mr_url>
<mr_target>...</mr_target>
<mr_display>yes</mr_display>
</request>
</mostrequested>[code]
...and an XSLT stylesheet like this:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:param name="par_mr" select="document('mostrequested.xml')" />
<xsl:template match="/">[list]
<xsl:for-each select="$par_mr">
<xsl:if test="mostrequested/request/mr_display = 'yes'">
<li><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="mostrequested/request/mr_url" /></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute><xsl:value-of select="mostrequested/request/mr_title" /></xsl:element></li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
...which should result a list of elements where the node's <mr_display> value = "yes".
But instead, it's resulting in only the first element displaying. I've also tried this setup:
Code:
<xsl:for-each select="$par_mr[mr_display = 'yes'">
...to replace the <xsl:if> statement, but it worked exactly the same.
And finally, if I change it to be:
Code:
<xsl:for-each select="$par_mr">
Most Requested: <xsl:value-of select="*" />
</xsl:for-each>
..all of the node data DOES display properly. So I know that it's pulling in the data correctly. It's just not displaying that node for all of the elements for some reason.
I've reviewed several online sources concerning what should be a simple setup, but I'm stumped as to why this is not working. If anyone can tell me what I'm doing wrong, that would be great. Thanks.
KWilliams