[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using parameter with xsl:for-each

Subject: Re: Using parameter with xsl:for-each
From: "Max Rubinstein" <mrubinst@xxxxxxxxxxx>
Date: Tue, 27 Jun 2000 10:28:57 CDT
max rubinstein
I did check the archives, the closest thing I was able to find was:

passing a parameter to select attribute of <xsl:sort>
(http://www.mulberrytech.com/xsl/xsl-list/archive/msg14124.html)

but this does not seem to apply to my situation.
Maybe somebody can point me a little bit more precisely?

-Max


----Original Message Follows---- From: David Carlisle <davidc@xxxxxxxxx> To: xsl-list@xxxxxxxxxxxxxxxx CC: mrubinst@xxxxxxxxxxx Subject: Re: Using parameter with xsl:for-each Date: Tue, 27 Jun 2000 14:47:57 +0100 (BST)

This is a faq, you can't in standard xsl evaluate a string as an xpath
expresion. Check the archives of this list.

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


you have <xsl:value-of select="$selectpath"/>

but you passed it a string: "Resources/Resource"

so it is equivalent to

<xsl:value-of select="'Resources/Resource'"/>

David

-------------------------------------------------------------------
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.