[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: passing parameters with spaces to saxon

Subject: Re: passing parameters with spaces to saxon
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Sat, 25 Mar 2000 15:05:55 +1200
saxon passing parameters
This has definitely been my week for posting dumb
questions on XSL-List. 

I hope I didn't waste anybody's time.

Here was the offence:

Warren Hedley wrote:
> 
> Can anyone tell me how to pass parameters with spaces in the value
> to saxon via the command line. I'm using a Unix system, though that
> probably shouldn't matter.
> 
> I've tried things like
> 
> java com.icl.saxon.StyleSheet file.xml file.xsl \
>   "HAS_SPACES=has spaces" \
>   HAS_SPACES='has spaces' \
>   HAS_SPACES=has\ spaces

Actually all of the above work. What I didn't mention was that I use
a shell script to set up the CLASSPATH to the saxon jar and properties
file and print the "java com.icl.saxon.StyleSheet" string. It then
echos the arguments it received. Unfortunately the quotes or escaped
spaces are not received (that's the whole idea) in the script, so the
actual Stylesheet.main() method gets a whole lot of one word arguments.

I've figured out how to wrap each of the arguments in quotes again, but
not quite how to send them on to the java executable.

If there are any "sh" experts around, what am I doing wrong? I should be
able to figure this one out on Monday, when our own "sh" experts get back
to work.

Here was my attempt.

----
#!/bin/sh
#
# This script sets up the environment variables to run the SAXON
# XSL processor on the arguments received. The offical usage is
#
# xslTransform [-u] [-t] [-o output-file] source-document style-sheet [ params...]
#
# The standard usage will look something like
#
# xslTransform file.xml file.xsl [ > output.html]
#
# Note that SAXON conforms to the XSLT 1.0 spec (November 1999), and requires
# the XSL namespace to be "http://www.w3.org/1999/XSL/Transform".

LIB_BASE=/usr/local/xml-utils
SAXON_JARS=$LIB_BASE/saxon:$LIB_BASE/saxon/saxon.jar
XML4J_JARS=$LIB_BASE/xml4j_2_0_15/xml4j.jar

CLASSPATH=$SAXON_JARS:$XML4J_JARS
export CLASSPATH

for arg ; do
  args="$args '$arg'" ;
done

# this doesn't work (same as using $* or $@)
exec java "com.icl.saxon.StyleSheet" $args

# this passes the entire $args string as a single argument
exec java "com.icl.saxon.StyleSheet" "$args"

----

-- 
Warren Hedley


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.