I realize this is an old thread, but there was something I'd looked up
when this thread was new and wasn't certain about.
On Jun 28, 2004, at 4:43 AM, Michael Kay wrote:
<xsl:variable name="num1" select="//test1/somevalue1"/>
(The compiler can't automatically convert one to the other, because
some
expressions treat them differently, for example boolean($num1) is
always
true in the first case, but in the second case it is true only if
//test1/somevalue1 selects at least one node).
What I've never quite understood is how to wrap this into a conditional.
Based on http://www.dpawson.co.uk/xsl/sect2/N8090.html#d9711e895
example, would this be correct for wrapping an assignment in only if a
variable was passed in, otherwise using the default?
<xsl:variable name="n">
<!--Conditionally instantiate a value to be assigned to the variable
-->
<xsl:choose>
<xsl:when test=="//test1/somevalue1">
<xsl:variable name="num1" select="//test1/somevalue1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="20"/><!-- ...or a "20" -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
--
_Deirdre http://deirdre.net
"Cannot run out of time. There is infinite time. You are finite.
Zathras is finite. This....is wrong tool." -- Zathras