Project

Profile

Help

direct PI constructor and fn:data

Added by Anonymous over 19 years ago

Legacy ID: #2820724 Legacy Poster: marcvc (marcvc)

Michael, there seems to be an issue with fn:data used in the name expression of a direct PI constructor. Consider the following query: processing-instruction {data('a')} {'b'} In Saxon 8.0: java.lang.IllegalStateException: Function data should have been resolved at compile-time In Saxon 8.1: java.lang.NullPointerException at net.sf.saxon.expr.TypeChecker.staticTypeCheck(TypeChecker.java:76) Thanks, Marc


Replies (1)

RE: direct PI constructor and fn:data - Added by Anonymous over 19 years ago

Legacy ID: #2820823 Legacy Poster: Michael Kay (mhkay)

Thanks for reporting this. There are two separate errors at play here. Firstly, net.sf.saxon.instruct.ProcessingInstruction lacks a simplify() method. This should read: public Expression simplify(StaticContext env) throws XPathException { name = name.simplify(env); return super.simplify(env); } This accounts for the symptoms observed in 8.0. Secondly, the type signature for the data() function is not set up correctly. In line 158 of StandardFunction.java, the line register("data", Data.class, 0, 1, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); should be changed to: e = register("data", Data.class, 0, 1, 1, Type.ANY_ATOMIC_TYPE, StaticProperty.ALLOWS_ZERO_OR_MORE); I don't think this error would ever show up in the absence of the other error: calls on data() should be simplified out (replaced by an internal atomization expression) before type checking takes place, which means the type signature of the function should never be accessed. Michael Kay http://www.saxonica.com/

    (1-1/1)

    Please register to reply