Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


XPath problem with Saxon 8-1b

  • David Ufton
    David Ufton

    I am getting an ArrayIndexOutOfBoundsException when trying to evaluate XPath expressions which contain further XPath expressions inside conditionals. The exception is:

    java.lang.ArrayIndexOutOfBoundsException: 1
    at net.sf.saxon.expr.XPathContextMajor.setLocalVariable(
    at net.sf.saxon.expr.LetExpression.iterate(
    at net.sf.saxon.xpath.XPathEvaluator.evaluate(

    My example XML is:

    <?xml version="1.0" encoding="UTF-8"?>
    <Book id="1">
    <Title>The Two Towers</Title>
    <AuthorRef id="3"/>
    <Book id="2">
    <Title>The Hitchikers Guide to the Galaxy</Title>
    <AuthorRef id="4"/>
    <Author id="3">
    <Name>J.R.R. Tolkien</Name>
    <Author id="4">
    <Name>Douglas Adams</Name>

    examples of XPaths which fail:


    /Test/Author[@id=/Test/Book[Title=\&quot;The Two Towers\&quot;]/AuthorRef/@id]/Name

    Apologies for the formatting!