[ 
https://issues.apache.org/jira/browse/XALANJ-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17756363#comment-17756363
 ] 

Joe Kesselman commented on XALANJ-2474:
---------------------------------------

h3. *Detailed analysis:*

*xalan:evaluate* is considered an extension function.

Originally, we had our own implementation of that function, which did report 
errors. However,  xalan:evaluate has been deprecated in favor of the EXSLT 
*dyn:evaluate()* function, and in fact is currently implemented as

{{    return ExsltDynamic.evaluate(myContext, xpathExpr);}}

That refers us to [http://exslt.org/dynamic,] which alas no longer seems to 
exist. The most authoritative reference I can currently find is 
[https://exslt.github.io/dyn/functions/evaluate/dyn.evaluate.html,] and there 
it says:
{quote}If the expression string passed as the second argument is an invalid 
XPath expression (including an empty string), this function returns an empty 
node set. 
{quote}

This is why the behavior changed.  This new implementation of 
*xalan:evaluate()* is unable to resolve document(), but is explicitly defined 
to not consider this an execution error.

That severely limits what we could do in this case. We could generate a 
nonfatal error-log message, but we can *not* throw an error which would stop 
the stylesheet.


*So:* The problem is reported against a deprecated function, and the 
replacement function is behaving correctly according to its own specifications 
since it only promises support for XPath expressions, not the XSLT extensions 
thereunto.

Unfortunately, unless we de-deprecate *xalan:evaluate* as its own 
implementation with separate behavior, I do not see a way to restore the 
behavior the user has requested. All we could do would be flag this in Xalan's 
documentation, report it to EXSLT's docs (though they may say this is strictly 
an implementation issue since it's possible a processor which did make 
document() available would still be considered compliant), and maybe add a 
nonfatal error message emphasizing that when we say it evaluates XPath we mean 
it evaluates pure XPath 1.0, only.

And as noted earlier, there is a workaround available.

I'm not sure I'm ready to close this completely, since those slight 
improvements are possible... but since it is working as (now) designed, I'm 
downgrading it to Improvement/Minor rather than Bug/Blocker.

> document() function returns different values with xalan version 2.7.1. and 
> 2.6.0.
> ---------------------------------------------------------------------------------
>
>                 Key: XALANJ-2474
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2474
>             Project: XalanJ2
>          Issue Type: Improvement
>      Security Level: No security risk; visible to anyone(Ordinary problems in 
> Xalan projects.  Anybody can view the issue.) 
>    Affects Versions: 2.7.1
>         Environment: Windows, using command line transform of xalan.
>            Reporter: pavankumar
>            Priority: Minor
>         Attachments: identitext.xsl, input.xml, jira-xalanj-2474.xml, 
> jira-xalanj-2474.xslt, transform.xslt
>
>
> xslt document() function returns duplicate and improper values with 2.7.1. 
> where as the same code works with 2.6.0.
> Info : document and evaluate functions are used in xslt and there were other 
> slightly inconsistent behaviour also for 2 versions in terms of syntax and 
> all. and xlink:href is getting nil values in 2.7.1
> document result contained by path variable line 93 - transform.xsl is the one 
> causing problem. and and when printed, it outputs different values with 
> different versions.
> Executed using xalan CLI
> C:\>java org.apache.xalan.xslt.Process -IN "C:\input.xml" -XSL 
> "C:\transform.xslt" -OUT new.html -PARAM global.result input.xml
> attaching the files.transform.xslt and input.xml



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to