Project

Profile

Help

Bug #5564

open

SaxonCS Query command line -o:test.xml fails "The path is empty"

Added by Michael Kay 19 days ago. Updated 8 days ago.

Status:
New
Priority:
Low
Assignee:
Category:
Command Line
Sprint/Milestone:
-
Start date:
2022-06-14
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET

Description

If SaxonCS XQuery is called from the command line with the -o option and the filename includes no path component (e.g. -o:test.xml) it fails with the error

System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at Saxon.Ejava.io.File..ctor(String name)
   at Saxon.Ejava.io.File.getParentFile()

Workaround: use -o:./test.xml.

Actions #1

Updated by Michael Kay 19 days ago

For some reason, the XQuery code does

createFileIfNecessary(outputFile);
serializer = processor.newSerializer(new System.IO.FileStream(outputFile.getPath(), System.IO.FileMode.Create));
                      

while the Transform code simply does

serializer = processor.newSerializer(outputFile);

The same difference is present in the Java code.

Actions #2

Updated by Martin Honnen 17 days ago

I have also run into a similar error with -export:foo.sef.json, the same workaround -export:./foo.sef.json works, but I hope mentioning it here helps ironing out some quirks in the command line option handling of SaxonCS.

saxonxslt -t -xsl:sheet3.xsl -nogo -target:JS -relocate:on -export:sheet3.xsl.saxoncs-export.sef.json
SaxonCS-EE 11.3 from Saxonica
.NET 6.0.6 on Windows 10.0.22000.0
Using license serial number ..
System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at Saxon.Ejava.io.File..ctor(String name)
   at Saxon.Ejava.io.File.getParentFile()
   at Saxon.Hej.Query.createFileIfNecessary(File file)
   at Saxon.Hej.s9api.XsltPackage.save(File file, String target)
   at Saxon.Hej.s9api.XsltPackage.save(File file)
   at Saxon.Hej.Transform.doTransform(String[] args)
Fatal error during transformation: ArgumentException: The path is empty. (Parameter 'path')
Exiting with code 2
Actions #3

Updated by Michael Kay 8 days ago

I haven't actually reproduced the problem yet. It seems to work fine on Mac. I'll have to try it on Windows when I'm back in the office.

Please register to edit this issue

Also available in: Atom PDF