DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21525>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21525 XSLT/[EMAIL PROTECTED] used as string instead of as expression as documented Summary: XSLT/[EMAIL PROTECTED] used as string instead of as expression as documented Product: Ant Version: 1.5.3 Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: Core tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] For the XSLT task, in a nested param element, it seems that the value of the expression attribute is passed as a string value instead of being passed as an expression, as the documentation specifies. The documentation (.../docs/manual/CoreTasks/style.html) says: 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. Although the wording "XSL expression to be placed into the param" is ambiguous (or wrong?), the second sentence clearly implies that the value of the Ant attribute is to be evaluated as an XSLT expression and the resulting value is to be assigned to the XSLT parameter. However, the XSLT parameter is _not_ assigned the result of evaluating the Ant attribute value as an XSLT expression. Instead, it is assigned a string value equal to the Ant attribute value. In the test case below, notice in the output how the parameter's value acts as the string value resulting from the string literal: '1 = 0' instead of as the boolean value resulting from the expression: 1 - 0 Therefore, the Ant attribute value is not being evaluated as an expression. If the Ant attribute value is supposed to be evaluated as an expression, then: 1. There is a bug in the code. 2. The first sentence of the attribute documentation is a bit wrong and confusing. (The expression is not placed into the parameter.) It should say something like: XSL expression whose value to assign to the parameter. or XML expression to evaluate and whose value to assign to the parameter. If the Ant attribute value was never supposed to be evaluated as an expression, then: 1. The second sentence of the documentation is wrong or is misleading and must be fixed. 2. The first sentence should say something like: string value to assign to the parameter ================================================================================ Test case: build.xml: <project default="default" > <target name="default" > <xslt in="input.xml" style="transform.xsl" out="output.xml" > <param name="param" expression="1 = 0" /> </xslt> </target> </project> input.xml: <doc> </doc> transform.xml: <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:param name="param" /> <xsl:template match="/" > $param : <xsl:value-of select="$param" />; $param = '1 = 0' : <xsl:value-of select="$param = '1 = 0'" />; $param = (1 = 0) : <xsl:value-of select="$param = (1 = 0)" />; 1 = 0 : <xsl:value-of select="1 = 0" />; 1 = 0 = 1 = 0 : <xsl:value-of select="1 = 0 = 1 = 0" />; 1 = 0 = (1 = 0) : <xsl:value-of select="1 = 0 = (1 = 0)" />; '1 = 0' : <xsl:value-of select="'1 = 0'" />; '1 = 0' = '1 = 0' : <xsl:value-of select="'1 = 0' = '1 = 0'" />; '1 = 0' = (1 = 0) : <xsl:value-of select="'1 = 0' = (1 = 0)" />; <xsl:apply-templates /> </xsl:template> </xsl:transform> Resulting output.xml: <?xml version="1.0" encoding="UTF-8"?> $param : 1 = 0; $param = '1 = 0' : true; $param = (1 = 0) : false; 1 = 0 : false; 1 = 0 = 1 = 0 : true; 1 = 0 = (1 = 0) : true; '1 = 0' : 1 = 0; '1 = 0' = '1 = 0' : true; '1 = 0' = (1 = 0) : false; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]