[ 
http://issues.apache.org/jira/browse/XALANJ-2108?page=comments#action_12373193 
] 

Brian Minchau commented on XALANJ-2108:
---------------------------------------

Comments from the Xalan-J triage April 4, 2006:
> In the XSLT 1.0 recommendation, in section 12.2 on xsl:key it says:
> "It is an error for the value of the use attribute or the match attribute
>  to contain a VariableReference."
> That is the case for this issue. So the stylesheet is in error,
> and Xalan should have detected this error at parse time.
> Later at runtime it throws a null pointer exception.
>
> Previously Xalan gave the "expected" result, although the
> correct behavior is to have a parse time error.
>
> However, in the given testcase one can execute it correctly,
> it is possible to find the right order to initialize the variables
> and the keys.
>
> The problem in XSLTC is that that code to resolve circular dependancies
> within variables, does not include keys as part of the same logic.
> In the translet there is a different handling of varibles for keys.
>
> The consensus of the committers at the meeting was that we should
> relax the restriction in 12.2 and not report the error.  More users
> would be upset if we strictly follow 12.2.
> stricter would probably upset more users, even if we are following
> 12.2.  One needs to resolve dependencies between global variables is
> not really different than resolving varibles within keys.
>
> Santiago P.-G. has a patch. Henry Z. agreed to review.

> Santiago's patch does not cover more general casses.
> If you have global variables, one should ensure that they are 
> evaluated in the right order so that any variable is defined before
> it is used. Sometimes determining the order can't be done statically
> because two variables might depend on each other and that might
> be only known at runtime.
> 
> This bug is actually a bug that is not detected at compile time.
<xsl:variable name='x'>
 <xsl:if select='{$foo}'>
 <copy-of select='{$y}'>
 </xsl:if>
</xsl:variable>
<xsl:variable name='y'>
 <xsl:if select='{$goo}'>
  <copy-of select='{$x}'>
</xsl:if>
</xsl:variable>

> If both '{$foo}' and '{$goo}' evaluate to true then we have a circular
reference between global variables, but only detectable at runtime.
> Santiago's patch will not cover this runtime case that is not detectable


> incorrect use of xsl:key cause NullPointerException
> ---------------------------------------------------
>
>          Key: XALANJ-2108
>          URL: http://issues.apache.org/jira/browse/XALANJ-2108
>      Project: XalanJ2
>         Type: Bug

>   Components: XSLTC
>     Versions: 2.6
>  Environment: windows jdk 1.42.06
>     Reporter: arnaud
>     Assignee: Santiago Pericas-Geertsen
>     Priority: Minor

>
> my stylesheet 
> -------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>       <xsl:output method = "html" encoding="iso-8859-1" />
>       
>       <xsl:variable name = "x" select = "'1'" />
>       <xsl:variable name = "y" select = "'4'" />
>       <xsl:key name = "key_test"  match ="test" use = "substring(date, $x, 
> $y)" />
>       
>       <xsl:template match="/">        
>       </xsl:template>
> </xsl:stylesheet>
> xml file
> <test><date>2004-01-01</date></test>
> java.lang.NullPointerException
>       at 
> java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:980)
>       at java.lang.Double.valueOf(Double.java:202)
>       at 
> org.apache.xalan.xsltc.runtime.BasisLibrary.stringToReal(BasisLibrary.java:838)
>       at ent_recherche_simple.buildKeys()
>       at ent_recherche_simple.transform()
>       at 
> org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:580)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to