In your example, where does the name file:/D:/workspace/eXml/test/EXM-33883/res1.xml come from? Is this the name of some existing file? Does the file actually contain the document that is the input to the second stylesheet?
The 'file:/D:/workspace/eXml/test/EXM-33883/res1.xml' path is the URI of the output file.
Next, I will append the output of the transformations with 9.5 and 9.6:
With Saxon 9.5:
C:\Users\radu_pisoi\Desktop\test-saxon-next-chain>java -Xmx60m -cp saxon_9_5/saxon9ee.jar net.sf.saxon.Transform
No source file name
Saxon-EE 9.5.1.7J from Saxonica
Usage: see http://saxonica.com/documentation/html/using-xsl/commandline.html
Format: net.sf.saxon.Transform options params
Options available: -? -a -catalog -config -cr -dtd -expand -explain -ext -im -init -it -l -m -now -o -opt -or -outval -p -quit -r -repeat -s -sa -strip -t -T -t
hreads -TJ -TP -traceout -tree -u -val -versionmsg -warnings -x -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -xsltversion -y
Use -XYZ:? for details of option XYZ
Params:
param=value Set stylesheet string parameter
+param=filename Set stylesheet document parameter
?param=expression Set stylesheet parameter using XPath
!param=value Set serialization parameter
C:\Users\radu_pisoi\Desktop\test-saxon-next-chain>java -Xmx60m -cp saxon_9_5/saxon9ee.jar net.sf.saxon.Transform -s:test_files/instance.xml -xsl:test_files/main
.xsl -o:test_files/res1.xml
Document URI: file:/C:/Users/radu_pisoi/Desktop/test-saxon-next-chain/test_files/res1.xml
With Saxon 9.6:
C:\Users\radu_pisoi\Desktop\test-saxon-next-chain>java -Xmx60m -cp saxon_9_6/saxon9ee.jar net.sf.saxon.Transform
No source file name
Saxon-EE 9.6.0.6J from Saxonica
Usage: see http://www.saxonica.com/html/documentation/using-xsl/commandline.html
Format: net.sf.saxon.Transform options params
Options available: -? -a -catalog -config -cr -dtd -expand -explain -ext -im -init -it -l -m -now -o -opt -or -outval -p -quit -r -repeat -s -sa -strip -t -T -t
hreads -TJ -TP -traceout -tree -u -val -versionmsg -warnings -x -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -xsltversion -y
Use -XYZ:? for details of option XYZ
Params:
param=value Set stylesheet string parameter
+param=filename Set stylesheet document parameter
?param=expression Set stylesheet parameter using XPath
!param=value Set serialization parameter
C:\Users\radu_pisoi\Desktop\test-saxon-next-chain>java -Xmx60m -cp saxon_9_6/saxon9ee.jar net.sf.saxon.Transform -s:test_files/instance.xml -xsl:test_files/main
.xsl -o:test_files/res1.xml
Document URI:
So, I get different results of the document-uri(/) function in Saxon 9.5 and 9.6. In 9.5 I'm getting the URI of the output document while in 9.6 I'm getting the empty string.
Maybe the behavior from Saxon 9.5 is expected by users that compute absolute paths depending the result of this function.
For instance, we have a user that tries to compute an URI relative to the document-uri of the root element:
<xsl:variable name="datei" select="replace(document-uri(/), '.xml$' ,'_META.xml')"/>