1 |
2824
|
tyburczy
|
#!/bin/bash
|
2 |
|
|
# Matt Jones
|
3 |
|
|
#Command-line XSLT
|
4 |
|
|
#
|
5 |
|
|
# Takes 3 command-line arguments:
|
6 |
|
|
# 1) an existing XML document,
|
7 |
|
|
# 2) an existing XSL document, and
|
8 |
|
|
# 3) an HTML document (existing or not)
|
9 |
|
|
# It then uses the XSL document to transform
|
10 |
|
|
# the XML into HTML.
|
11 |
|
|
# (Note that HTML is the common usage - however,
|
12 |
|
|
# many other types of output documents are supported,
|
13 |
|
|
# limited only buy the XSL stylesheet itself)
|
14 |
|
|
# 26 August 2005
|
15 |
|
|
# '$Id$'
|
16 |
|
|
|
17 |
|
|
LIB=../../lib
|
18 |
|
|
PARSER=$LIB/xalan/xalan.jar:$LIB/xercesImpl.jar:$LIB/xalan/xml-apis.jar
|
19 |
|
|
TPARAMS="-PARAM qformat knb -PARAM action read"
|
20 |
|
|
if [[ -e $1 && -e $2 && -n $3 ]]
|
21 |
|
|
then
|
22 |
|
|
java -cp $PARSER org.apache.xalan.xslt.Process $TPARAMS -IN $1 -XSL $2 -OUT $3
|
23 |
|
|
echo "Done. Results are in file \"$OUT\"."
|
24 |
|
|
else
|
25 |
|
|
echo "USAGE:"
|
26 |
|
|
echo "transform.bat INPUTXMLFILE.xml XSLFILE.xsl OUTPUTHTMLFILE.html"
|
27 |
|
|
fi
|