|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: problem with Passing Parameters to Templates
<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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








