Hi,

It seems that the saxon:evaluate function cannot interpret the current() function.

I give a small example, to reproduce what happend.


bug01.bat
set JAVA_HOME=C:\Java\jre1.5.0_02\bin
set XSLT_INTERP=D:\DATA\xml_xslt\saxon\saxonb9-1-0-1j\saxon9.jar
%JAVA_HOME%\java -jar %XSLT_INTERP% source2.xml style.xsl

source1.xml
<?xml version="1.0" encoding="UTF-8"?>
<list> 
 <author id="a1">Alice</author> 
 <author id="p1">Paul</author> 
 <author id="p2">Peter</author>
</list>

source2.xml
<?xml version="1.0" encoding="UTF-8"?>
<list> 
  <author id="a1"/> 
  <author id="a2"/> 
  <author id="p1"/> 
  <author id="p2"/>
</list>

style.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
                xmlns:saxon="http://saxon.sf.net/" > 
  <xsl:template match="author"> 
     <xsl:variable name="branch" select="'author[@id=current()/@id]'"/>
     <xsl:value-of select="$branch"/>
     <xsl:choose> 
       <xsl:when test="document('source1.xml')//saxon:evaluate($branch)"/> 
       <xsl:otherwise>The author <xsl:value-of select="current()/@id"/> is not in the database</xsl:otherwise> 
     </xsl:choose> 
  </xsl:template>
</xsl:stylesheet>

D:\DATA\xml_xslt_prog\pmtool\pm_from_spe\v1.0>C:\Java\jre1.5.0_02\bin\java -jar D:\DATA\xml_xslt\saxon\saxonb9-1-0-1j\saxon9.jar D:\DATA\xml_xslt_prog\pmtool\pm

_from_spe\v1.0\config_01.xml D:\DATA\xml_xslt_prog\pmtool\pm_from_spe\v1.0\pm_from_spe.xslt
Exception in thread "main" java.lang.AssertionError: current() function should have been rewritten at compile time Variable zz:zz26083064 at 107 of file:/D:/DAT

A/xml_xslt_prog/pmtool/pm_from_spe/v1.0/pm_from_spe.xslt
        at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:441)
        at net.sf.saxon.instruct.SimpleContentConstructor.evaluateItem(SimpleContentConstructor.java:270)
        at net.sf.saxon.instruct.ValueOf.processLeavingTail(ValueOf.java:243)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ForEach.processLeavingTail(ForEach.java:321)
        at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:549)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
        at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:549)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Template.expand(Template.java:220)
        at net.sf.saxon.instruct.CallTemplate.process(CallTemplate.java:257)
        at net.sf.saxon.instruct.ForEach.processLeavingTail(ForEach.java:321)
        at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:549)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.expr.LetExpression.process(LetExpression.java:378)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.expr.LetExpression.process(LetExpression.java:378)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Template.expand(Template.java:220)
        at net.sf.saxon.instruct.CallTemplate.process(CallTemplate.java:257)
        at net.sf.saxon.instruct.ResultDocument.processLeavingTail(ResultDocument.java:529)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ForEach.processLeavingTail(ForEach.java:321)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
        at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345)
        at net.sf.saxon.Controller.transformDocument(Controller.java:1807)
        at net.sf.saxon.Controller.transform(Controller.java:1621)
        at net.sf.saxon.Transform.processFile(Transform.java:1112)
        at net.sf.saxon.Transform.doTransform(Transform.java:719)
        at net.sf.saxon.Transform.main(Transform.java:66)
D:\DATA\xml_xslt_prog\pmtool\pm_from_spe\v1.0>


Best regards
Paul