|
Subject: Re: [xsl] problem with Passing Parameters to Templates From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 19 Jan 2001 15:47:12 GMT |
<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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] problem with Passing Paramete, Helen_Li | Thread | Re: [xsl] problem with Passing Para, helen li |
| Re: [xsl] xsl:script, David Carlisle | Date | Re: [xsl] RE: How to transform <BR>, Jeni Tennison |
| Month |