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

RE: Having trouble, please help...

Subject: RE: Having trouble, please help...
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 10 Apr 2001 14:22:59 +0100
RE:  Having trouble
> I've got the following XSL template. I want to pass it four
> parameters. One
> for the ParentNode it should select, one for the CurrentNode
> to select, and
> two other text based values.
>
> I use the following code to implement the template:
>
> 	  <xsl:call-template name="PrintRows">
> 	    <xsl:with-param
> name="ParentNode">RetrieveNameAndAddressRSResponse</xsl:with-param>
> 	    <xsl:with-param
> name="CurrentNode">NameAddress1</xsl:with-param>
> 	    <xsl:with-param name="RowColor">#FFEBBF</xsl:with-param>
> 	    <xsl:with-param name="DisplayText">Holder
> Name:</xsl:with-param>
> 	  </xsl:call-template>

Let's be clear: you are not passing the node as a parameter, you are passing
its name, represented as a string.

>
> and the template looks like this:
>
> 		<xsl:apply-templates
> select="RetrieveNameAndAddressRSResponse/NameAddress1">
> 		</xsl:apply-templates>
> 		    </font></td>
> 	    <td bgcolor="#000066" width="5%"><br/></td>
> 	    <td bgcolor="#FF9933" width="5%"><br/></td>
> 	  </tr>
> </xsl:template>
>
> Now in the above example, everything is fine, but I need to
> replace the
> apply-templates line with something using the two parameters passed.
> Whenever I do
>
> 	<xsl:apply-templates select="$ParentNode">
>
> I get a "Reference to variable or parameter 'ParentNode' must
> evaluate to a node list"
>

Yes: because the value of the variable is a string, not a node[-set].

So long as you use simple names, you can use the construct
select=*[name()=$ParentNode]".

If you want to construct more complex expressions than simple names, you
need the xx:evaluate() extension function available in several products.

Mike Kay
Software AG


 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.