Bug #4329
closedGetting warning "Source document ignored - query does not access the context item" although XQuery accesses /*/* (in right hand side of let expression)
0%
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
Please register to edit this issue