xsl-list
[Top] [All Lists]

Re: [xsl] command line invocation issue

2019-12-15 04:11:11
Hi Andre,

Maybe you are using Windows line ending characters?

On Debian-/Ubuntu-/Mint-like systems, you can use

fromdos myscript.sh

If you need to install fromdos, use:

sudo apt-get install tofrodos

But some sophisticated text editors may also give you the option to use ascii 
character 10 (LF) as the line terminator when saving a file.

Pieter


Op 15 dec. 2019 10:51, om 10:51, "Andre Cusson akhu01(_at_)gmail(_dot_)com" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> schreef:
Hi Dave,

You are right, the line is a little long.
I just copied it from the script file.

Breaking the line up into multiple lines in the script file by ending
each
one with \ (with nothing after it) does not work as Bash seems to just
see
separate commands that it does know about ... Yet, interactively, it
works
...
In other words, if the different backslash terminated segments are
typed
interactively at the command prompt, not only are all the line segments
concatenated to a single command, but that command works and executes
the
transform ... without the previous error messages.

Within the script file: nada, same as before. We do need the script as
the
line is a little long, but also mostly for the positional arguments
($1,
$2, ...).

We still need to resolve the problem, but clearly Saxon is not at stake
and
it is a command line interpreter issue.

I thank you for the insight that you have provided.

Regards,
ac


Le dim. 15 déc. 2019 à 03:38, Dave Pawson 
dave(_dot_)pawson(_at_)gmail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> a écrit :

Quick guess, you have a newline in your script? Try using bash
continuation lines to make it more readable?

HTH

On Sun, 15 Dec 2019 at 08:21, Andre Cusson akhu01(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Hi,

We are turning to this list because the solution to this is
probably
very simple, but we seem to require an experienced developer eye to
see it.

We have had an xslt2/Saxon application running fine for some years,
under Windows, but now we need to upgrade it to xslt3, with Saxon
still,
but under Linux (Debian/Ubuntu).

As a first step we keep everything the same as before and just copy
the
directory and file structure to try to first handle the Win10 to
Linux
conversion, starting with the command line invocation (Java, Saxon,
libraries, and the transform). We converted the separators (\ -> /, %
-> $,
; -> :), and now the invocation script tests as a valid Bash script.
All
referenced libraries are marked as executable and they now all seem
to
load. Yet, we still get an error message. We did try to
remove/replace all
invocation items, one after the other, as well as search the web, but
to no
avail, so far.

The Bash script reads like this:
#!/bin/bash
java -Xms3840m -Xmx3840m -server -Dfile.encoding=utf8

-Djava.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

-Djava.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
-cp

../lib/xercesImpl.jar:../lib/dnaos.jar:../lib/exist.jar:../lib/log4j-1.2.15.jar:../lib/ws-commons-util-1.0.2.jar:../lib/xmldb.jar:../lib/xmlrpc-client-3.1.2.jar:../lib/xmlrpc-common-3.1.2.jar:../lib/saxon.jar:../lib/saxon-dom.jar:../lib/dom4j.jar:../lib/sxutil.jar
net.galasoft.dnaos.saxon.Transform -warnings:recover -o:cosmos.html
-s:build/$1.xml -xsl:dnaos.xslt
exit 0

The invocation itself reads like this :
bash script.sh foo

The returned error message reads like this:
Saxon 9.1.0.8J from Saxonica
Java version 11.0.4
Bad param=value pair on command line:
Usage: see
http://www.saxonica.com/documentation/using-xsl/commandline.html
Options:
  -a                    Use xml-stylesheet PI, not style-doc
argument
  -c:filename           Use compiled stylesheet from file
  -cr:classname         Use collection URI resolver class
  -dtd:on|off           Validate using DTD
  -expand:on|off        Expand defaults defined in schema/DTD
  -explain[:filename]   Display compiled expression tree
  -ext:on|off           Allow|Disallow external Java functions
  -im:modename          Initial mode
  -it:template          Initial template
  -l:on|off             Line numbering for source document
  -m:classname          Use message receiver class
  -o:filename           Output file or directory
  -or:classname         Use OutputURIResolver class
  -outval:recover|fatal Handling of validation errors on result
document
  -p:on|off             Recognize URI query parameters
  -r:classname          Use URIResolver class
  -repeat:N             Repeat N times for performance measurement
  -s:filename           Initial source document
  -sa                   Schema-aware transformation
  -strip:all|none|ignorable      Strip whitespace text nodes
  -t                    Display version and timing information
  -T[:classname]        Use TraceListener class
  -TJ                   Trace calls to external Java functions
  -tree:tiny|linked     Select tree model
  -traceout:file|#null  Destination for fn:trace() output
  -u                    Names are URLs not filenames
  -val:strict|lax       Validate using schema
  -versionmsg:on|off    Warn when using XSLT 1.0 stylesheet
  -warnings:silent|recover|fatal  Handling of recoverable errors
  -x:classname          Use specified SAX parser for source file
  -xi:on|off            Expand XInclude on all documents
  -xmlversion:1.0|1.1   Version of XML to be handled
  -xsd:file;file..      Additional schema documents to be loaded
  -xsdversion:1.0|1.1   Version of XML Schema to be used
  -xsiloc:on|off        Take note of xsi:schemaLocation
  -xsl:filename         Stylesheet file
  -y:classname          Use specified SAX parser for stylesheet
  -?                    Display this message
  param=value           Set stylesheet string parameter
  +param=filename       Set stylesheet document parameter
  !option=value         Set serialization option
 : argument numérique nécessaire

Please note that the last error message line (in French, meaning ":
numerical argument required") could be coming from the OS (Debian
with
French configuration).

The other message lines could be coming from Saxon, unless the
first
error message line ("Bad param=value pair on command line: ") would
be from
Java (OpenJDK), although it does not look like a typical Java error,
or
from Bash but the script was validated, it seems, or from something
else ...

Saxon seems to report an invocation issue but the invocation is the
same
as before (... Transform -warnings:recover -o:cosmos.html
-s:build/$1.xml
-xsl:dnaos.xslt) and $1.xml is properly interpreted as build/foo.xml,
as
well, there are no param=value pair used for Saxon.

Can anyone help us see more clearly or follow a new track?

Thank you.
Regards,
ac


XSL-List info and archive
EasyUnsubscribe (by email)



--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.



--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>