Project

Profile

Help

Bug #4329

closed

Getting warning "Source document ignored - query does not access the context item" although XQuery accesses /*/* (in right hand side of let expression)

Added by Martin Honnen about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XQuery conformance
Sprint/Milestone:
-
Start date:
2019-10-02
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

Trying to write an XQuery based splitting of a large input into several ones using tumbling window I have run into two problems with Saxon 9 (tested with Saxon-HE 9.9.1.5J), this bug is about the first issue:

Although the query accesses the source document with /*/* Saxon emits a warning claiming

Source document ignored - query does not access the context item

Full command line output is:

PS C:\SomeDir> java -cp 'C:\Program Files\Saxonica\
Saxon9.9HE\saxon9he.jar' net.sf.saxon.Query -t -s:.\input-sample-2000-records.xml .\test-xquery-split-result-1.xq
Saxon-HE 9.9.1.5J from Saxonica
Java version 1.8.0_221
Analyzing query from .\test-xquery-split-result-1.xq
Analysis time: 243.5237 milliseconds
Processing file:/C:/SomeDir/./input-sample-2000-rec
ords.xml
Source document ignored - query does not access the context item
<?xml version="1.0" encoding="UTF-8"?>trueExecution time: 12.4667ms
Memory used: 36,983,024

Sample query is:

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method 'xml';
declare option output:indent 'yes';

declare variable $chunk-size as xs:integer external := 500;


let $results := 
    for tumbling window $chunk in /*/*
    start at $sp when $sp mod $chunk-size = 1
    return
        document {
            element { node-name(head($chunk)/..) } {
                $chunk
            }
        }
return $results instance of document-node()*

I have attached the input sample.

I think the warning is wrong and indicates that Saxon somehow rewrites the query in the wrong way.

A variation of the query generates a java.lang.NullPointerException, I will fail that as a separate issue as I am not sure it is the same problem or a different code path.


Files

input-sample-2000-records.xml (182 KB) input-sample-2000-records.xml Martin Honnen, 2019-10-02 14:08

Please register to edit this issue

Also available in: Atom PDF