The XQuery recommendation contains a section on end-of-line handling, and as I
understand it, it should make no difference whether a query contains Unix-style
or DOS-style line endings, because they are normalized to a single line feed before
For Saxon, this normalization appears to be done for the main query only, not for
modules. This may lead to different results, depending on whether a function or
variable is placed in the primary input vs. an XQuery module.
Here is a sample:
import module namespace x="X" at "x.xq";
declare variable $x := <x>
module namespace x="X";
declare variable $x:x := <x>
result, when using CR/LF line-endings in the above:
<?xml version="1.0" encoding="UTF-8"?><y><x>
The result has just LF line endings, with just one CR shown as an entity. I think that
module line endings should be normalized, too, which would make the CR disappear.
Tested with Saxon-HE 220.127.116.11J from command line.