fn:transform and relative source-location versus relative stylesheet-location
Added by Martin Honnen over 4 years ago
Is there an intended difference between resolving a relative URI given in the source-location
map parameter of fn:transform
compared to stylesheet-location
?
Inside oXygen I am struggling to use
transform(
map {
'source-location' : 'input1.xml',
'stylesheet-location' : 'sheet1.xsl',
'delivery-format' : 'raw'
}
)?output
in an XQuery, while the stylesheet-location
is loaded relatively to the XQuery code's directory the source-location
is attempted to be loaded from the oXygen directory which then fails.
The oXygen support suggested I can fix the XQuery code to use
transform(
map {
'source-location' : resolve-uri('input1.xml'),
'stylesheet-location' : resolve-uri('sheet1.xsl'),
'delivery-format' : 'raw'
}
)?output
which indeed fixes the problem, but interestingly enough I only need the resolve-uri
on the source-location
transform(
map {
'source-location' : resolve-uri('input1.xml'),
'stylesheet-location' : 'sheet1.xsl',
'delivery-format' : 'raw'
}
)?output
then the code works inside oXygen.
This makes me wonder whether source-location
with a relative URI is intentionally resolved differently to stylesheet-location
.
I never run into this when running XQuery with Saxon from the command line because I tend to call it in a working directory with e.g. java -cp 'C:\Program Files\Saxonica\SaxonVersionDirectory\saxon9he.jar' net.sf.saxon.Query query.xq
and then I neither need resolve-uri
on the source-location
nor the stylesheet-location
but the oXygen support pointed out that calling Saxon from the Saxon installation dir with e.g. java -cp saxon9he.jar net.sf.saxon.Query C:\Users\foo\Documents.query.xq
exhibits the same difference between source-location
and stylesheet-location
that I encounter from inside oXygen.
Please register to reply