Using parameter with xsl:for-each

Subject: Using parameter with xsl:for-each
From: "Max Rubinstein" <mrubinst@xxxxxxxxxxx>
Date: Tue, 27 Jun 2000 08:27:26 CDT
Hi,

I am trying to use a parameter in the select attribute of xsl:for-each. Here is my stylesheet:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:param name="selectpath" />


 	<xsl:template match="/">
		<p><xsl:value-of select="$selectpath"/></p>
 		<xsl:for-each select="$selectpath">
			<xsl:value-of select="."/>
 		</xsl:for-each>
 	</xsl:template>

</xsl:stylesheet>

Here is my xml source:
<Resources>
	<Resource URL="http://www.aspindustry.org/";>
		<Keywords>
			<ASP/> <SB/>
		</Keywords>
	</Resource>
	<Resource URL="http://www.aspnews.com/"; >
		<Keywords>
			<ASP/>
		</Keywords>
	</Resource>
</Resources>

When I try to invoke the stylesheet passing "Resources/Resource" as a parameter (using MSXML May 2000), I get the following error:

"Reference to a variable or parameter "selectpath" must evaluate to a node list."

But, if I remove "xsl:for-each" clause, I do see the output of "xsl:value-of" that shows that my parameter was passed successfully to the stylesheet.

Any help would be appreciated.

-Max


________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread