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

Re: problem with Passing Parameters to Templates

Subject: Re: problem with Passing Parameters to Templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 19 Jan 2001 15:47:12 GMT
asp passing para
<xsl:template name="opt_template">
       <xsl:param name="node"></xsl:param>
          <xsl:text>$node</xsl:text>          ------ Is this the right way to
output parameter value?

No. That would output th etext string $node.
probably you wanted <xsl:value-of select="$node"/>

        <xsl:if test="//*[$node]">

That is legal but not what you wanted. (It's hard to guess what you did
want) but anyway what that does is, if $node is the empty string
(which is the default value of your parameter) then it counts as the
boolean false value, so you "//*[$node] will search the entire document
(//*) testing whether false is true , and then return nothing
that will count as false and so the if test clause will be skipped.

If $node is any other value it will count as true, in which case the
select is //* and so it will return a non empty node set if there are
any input elements at all, and so the test will count as true.


       <xsl:value-of select=".//$node"/>          --------------expected
node test???

  <xsl:value-of select="$node"/>  
would be legal but I suspect that you want
  <xsl:value-of select=".//*[name()=$node]"/>
Note that you can _not_ create Xpath expressions on the fly and evaluate
them. (This is a FAQ).


David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 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.