You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/05/08 22:53:11 UTC

DO NOT REPLY [Bug 6284] - variable defined outside template gets wrong position() data

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=6284>.
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=6284

variable defined outside template gets wrong position() data

David_Marston@lotus.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |TestID
           Priority|Other                       |High
            Summary|variable defined outside of |variable defined outside
                   |template                    |template gets wrong
                   |                            |position() data



------- Additional Comments From David_Marston@lotus.com  2002-05-08 20:53 -------
Evidently a problem of lazy evaluation of RTF variables, or of position()
calculations in a global-variable context. Without the dummy, which
would also be useless if it were lazily evaluated, we don't use $myStopAt until
<xsl:for-each select="/Go/GoGame/Nodes/Black
 [(generate-id(.)!=generate-id(key('ids',@at))) and @number&lt;=$myStopAt]">
and if it comes through as null, the whole predicate fails.

There is a WORKAROUND for the case at hand, which is to replace the whole
xsl:variable statement for $lastMove with simply
<xsl:variable name="lastMove" select="count(/Go/GoGame/Nodes/Black)"/>
but that may not apply to the larger problem. In any event, this needs deeper
investigation. Here's what we know so far:
1. If the first action that forces a variable to be evaluated is a simple
select (e.g., value-of), the variable is correctly set. So the bug requires
that the first evaluation be in a predicate, not necessarily in a for-each.
(<xsl:value-of select=".../Black[@number &lt; $lastMove]"/> as the first thing
in the first template shows the bug, just as a for-each does.)
2. The indirection through $myStopAt isn't the problem.
3. The principle of using for-each to populate an RTF is not the problem,
because Xalan passes variable15 and 16.
4. The fact that the variable is global IS part of the problem. If you move the
xsl:variable element inside the top template, everything works.

A trimmed test is available in CVS as tests\bugzilla\bugzilla6284