cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: Xalan bug?
Date Thu, 18 May 2000 23:04:11 GMT
Scott Boag/CAM/Lotus wrote:
> 
> Stefano, I expect you guys are passing parameters as strings?
> 
> I suspect Xalan is looking at this as:
> 
>  <xsl:apply-templates select="//section['2']"/>
> 
> (if you pass 2 as a parameter).  Xalan then applies standard string to
> boolean conversion, and you end up with:
> 
>  <xsl:apply-templates select="//section[true()]"/>
> 
> The applicable text in the XPath draft is:  "A PredicateExpr is evaluated
> by evaluating the Expr and converting the result to a boolean. If the
> result is a number, the result will be converted to true if the number is
> equal to the context position and will be converted to false otherwise; if
> the result is not a number, then the result will be converted as if by a
> call to the boolean function." (http://www.w3.org/TR/xpath#predicates).
> 
> I'm pretty sure that the processor should not apply lexical testing to a
> string to see if it might be a number, so I think the results from Xalan
> are correct.
> 
> If you do:
> 
>  <xsl:apply-templates select="//section[number($section)]"/>
> 
> Then I think you will get the results you are looking for.
> 
> In the case of:
> 
>  <xsl:apply-templates select="//section[position() = $section]"/>
> 
> the conversion is done automatically.
> 
> Does this make sense?  It's predicated on the assumption that you are
> passing string objects as parameters, which I think Donald was working on a
> couple of weeks ago.  If I am wrong, I'll go to the next step of performing
> some tests to see if there is a bug (though I think the basics are covered
> in our test suite).

Makes perfect sense, it's not a bug on either side, just something we
should be aware of for future FAQs.

Thanks for the prompt response.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------

Mime
View raw message