Thanks for reporting this, but I suspect you aren't running the latest release - it seems to have been fixed in Saxon 8.3.
Michael Kay

From: [] On Behalf Of
Sent: 20 March 2005 08:20
Subject: [saxon] Bug: NPE in GlobalVariableDefinition.explain()


Passing the '-e' (explain) flag into net.sf.saxon.Query with the following XQuery results in a NPE:
declare variable $aVariable as xs:date external;

Exception stacktrace is
declare variable aVariable := java.lang.NullPointerException
    at net.sf.saxon.query.GlobalVariableDefinition.explain(
    at net.sf.saxon.query.StaticQueryContext.explainGlobalVariables(
    at net.sf.saxon.Query.doMain(
    at net.sf.saxon.Query.main(
Fatal error during transformation: null

I figure that this is because the explain is happening during static compilation and the external variable values have not been bound yet. Perhaps the following change to net.sf.saxon.query.GlobalVariableDefinition would be better?
     * Produce diagnostic output showing the compiled and optimized expression tree for a function
     * @param pool the namepool to be used
    public void explain(NamePool pool) {
        System.err.print("declare variable " + pool.getDisplayName(nameCode) + " := ");
        if(isParameter) System.err.print("<external>");
        else value.display(4, pool, System.err);

Marcus Edwards
Digital Steps Limited
1 Bell Court, Leapale Lane, Guildford, Surrey GU1 4LY
Switchboard: +44 (0)14 8346 9480
Direct: +44 (0)14 8346 9483
Mobile: +44 (0)78 1587 4017
This e-mail and any attachments may be confidential and/or legally privileged.
If you have received this email and you are not a named addressee, please
inform the sender at Digital Steps Ltd by phone on +44 (0)1483 469 480 or by
reply email and then delete the email from your system. If you are not a named
addressee you must not use, disclose, distribute, copy, print or rely on this
email. Although Digital Steps Ltd routinely screens for viruses, addressees
should check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this email
or any attachments.
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. _______________________________________________ saxon-help mailing list