Looking at this further, I notice that the class names are not "net.sf.saxon.expr.LetExpression but "org.orbeon.saxon.expr.LetExpression". Orbeon, I believe, contains a slightly modified version of Saxon. I don't think the changes are extensive (they include things like making the extra XForms functions available), but it does mean that I think you need to turn first to Orbeon for help with this problem. If they can reproduce it using an unmodified Saxon, they'll no doubt pass it on to me, but in a form where I have some chance of solving it.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: 24 February 2006 00:07
To: rbraman@bramantax.com
Cc: saxon-help@lists.sourceforge.net
Subject: [saxon] RE: XPathContextMajor bug

Is there any chance you can reproduce this in a free-standing environment so I can try and investigate it? It's going to be quite difficult to resolve otherwise. Do you know what interfaces are being used to compile and run the XPath expression?
 
What's happening here, I think, is that the optimizer has detected some expressions that can be moved out of the predicates and prevaluated to save repeated evaluation in the loop; this involves allocating extra variables, and for some reason connected with the environment in which the expression is being executed, the space needed for these variables isn't being allocated.
 
Also the XPath expression is calling a function instance() which I think is an Orbeon special. It's possibly something to do with the way Orbeon has "tailored" the Saxon environment. Please supply as much information as you can about the cicumstances (it may be best for this one to go off-list) and I'll liaise with Erik Bruchez if necessary to see if we can get to the bottom of it.
 
Michael Kay
Saxonica


From: Richard Braman [mailto:rbraman@bramantax.com]
Sent: 23 February 2006 22:51
To: mike@saxonica.com
Cc: saxon-help@lists.sourceforge.net
Subject: XPathContextMajor bug

I am an orbeon and general xforms user, and have found an apparent bug in saxon.
 
when you use the XPath (a|b) or (a,b)
 
it returns
java.lang.ArrayIndexOutOfBoundsException in the saxon part.
 
heres a partial stack trace:
 
org.orbeon.saxon.expr.XPathContextMajor setLocalVariable XPathContextMajor.java 213
org.orbeon.saxon.expr.LetExpression evaluateItem LetExpression.java 85
org.orbeon.saxon.expr.LetExpression evaluateItem LetExpression.java 86
org.orbeon.saxon.expr.LetExpression evaluateItem LetExpression.java 86
org.orbeon.saxon.expr.LetExpression evaluateItem LetExpression.java 86
org.orbeon.saxon.functions.StringFn evaluateItem StringFn.java 47
org.orbeon.saxon.expr.ComputedExpression iterate ComputedExpression.java 408
org.orbeon.saxon.xpath.XPathExpression evaluateSingle XPathExpression.java
 
evidently, when you load the expressions in the | notation tries to add an additional element, the array goes out of bounds.
 
The full XPath, which includes some XForms notation.  Note the same thing happens whether you use | or ,, and the expression work fine by themselves.
 
(instance('taxtable')
   //taxtable/item
   [xs:integer(instance('main-instance')/f1040ez/filing-status) eq 1
   and
   xs:decimal(instance('main-instance')/f1040ez/income) ge xs:decimal(income-equal-or-greater-than)
   and
    xs:decimal(instance('main-instance')/f1040ez/income) lt xs:decimal(income-less-than)
   ]
   /tax-single
   ,      
    instance('taxtable')
    //taxtable/item
    [xs:integer(instance('main-instance')/f1040ez/filing-status) eq 2
   and
    xs:decimal(instance('main-instance')/f1040ez/income) ge xs:decimal(income-equal-or-greater-than)
   and
    xs:decimal(instance('main-instance')/f1040ez/income) lt xs:decimal(income-less-than)
    ]
    /tax-married-filing-jointly)
 
 
Richard Braman
mailto:rbraman@taxcodesoftware.org
561.748.4002 (voice)

http://www.taxcodesoftware.org
Free Open Source Tax Software