0

I installed Saxon in macOS 10.15 via home-brew. Now when I try

net.sf.saxon.Transform

I get

zsh: command not found: net.sf.saxon.Transform

What am I doing wrong?

thanks, geb

gebseng
  • 5
  • 1
  • Don't know about Macs but usually you need Java and the run `java -jar saxon9he.jar -xsl:sheet.xsl -s:input.xml` – Martin Honnen May 24 '20 at 09:30
  • 1
    It might be that the home-brew installation allows you to shorten `java -jar saxon9he.jar` to simply `saxon` so try whether `saxon -xsl:sheet.xsl -s:input.xml` also works and post that as an answer if it does. – Martin Honnen May 24 '20 at 09:52

1 Answers1

1

@MartinHonnen has already answered in a comment, but for the record, the command required is

 java -jar saxon9he.jar -xsl:sheet.xsl -s:input.xml

Note that this form only works when you don't need anything else on the classpath (for example, a library holding extension functions). Also the JAR file name has changed with the release of 10.0. A more general form might be

java -cp saxon-he-10.0.jar:my-other.jar net.sf.saxon.Transform -xsl:sheet.xsl -s:input.xml

In the -cp option, JAR files are separated by ":" on Mac and Linux, or by ";" on Windows.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • 1
    If I understand https://github.com/Homebrew/homebrew-core/blob/master/Formula/saxon.rb and https://github.com/Homebrew/brew/blob/e1f3c8d2b37c5b30e0a934fa8fba99252ecd0e28/Library/Homebrew/extend/pathname.rb#L371 correctly than an installation of Saxon with Homebrew also creates a shell script named "saxon" that then allows calling the installed version with that script e.g `saxon -s:input.xml -xsl:sheet.xsl` should suffice. But I don't have a Mac to test. – Martin Honnen May 24 '20 at 18:49
  • I started out with exactly that (installed saxon via homebrew), but for some reason, the saxon shell script does not work, that's why I got confused in the first place. Only java- jar saxonxxx.jar works. – gebseng May 25 '20 at 14:24