ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lenz, Evan" <le...@seattleu.edu>
Subject xslt param "expression" attribute a misnomer?
Date Wed, 30 Apr 2003 19:36:53 GMT
The documentation for the "expression" attribute of the "param" sub-element
of the xslt task reads:

"XSL expression to be placed into the param. To pass a text value into the
style sheet it needs to be escaped using single quotes."
http://ant.apache.org/manual/CoreTasks/style.html

But that is not how it behaves. In each of the Ant versions I've tried, the
attribute value is treated as a string, rather than an expression. This
caused unexpected behavior in my stylesheet that used a boolean-valued
parameter.

<xslt ...>
  <param name="bool" expression="0"/>
</xslt>

In the stylesheet, <xsl:if test="$bool"> evaluates to true, because the
value of the parameter is not the number zero, but rather the string "0",
which is non-empty and thus evaluates to true.

Was this change by design? Was the documentation ever correct?

The workaround I am using is expression="" (i.e. an empty string) so that
the parameter will be evaluated as false.

Evan

Mime
View raw message