3 # pdf generation from xml and xsl
9 echo "usage: ${0##*/} <file.xsl> <file.xml>"
16 JAVA
="$JAVA_HOME/bin/java"
19 echo 'error: java not found in your $PATH or in $JAVA_HOME/bin'
27 test -z "$SAXONJAR" && \
28 SAXONJAR
='/usr/share/java/saxon.jar'
29 if [ ! -f "$SAXONJAR" ]
31 SAXONJAR
='/usr/local/share/java/saxon.jar'
32 if [ ! -f "$SAXONJAR" ]
34 echo "error: neither saxon nor saxon.jar were found"
38 SAXON
="$JAVA -jar $SAXONJAR"
42 if [ -n "$XML_CATALOG_FILES" ]
44 CATALOG_FILES
=$XML_CATALOG_FILES
46 echo "warning: XML_CATALOG_FILES is not set or empty"
47 CATALOG_FILES
="/usr/local/etc/xml/catalog /etc/xml/catalog $HOME/xml/catalog"
49 KEY
="http://docbook.sourceforge.net/release/xsl/current"
54 for CATALOG
in $CATALOG_FILES
58 DOCBOOKXSLPATH
=$
(xmlcatalog
"$CATALOG" "$KEY/")
60 if [ $?
-ne 0 -o -z "$DOCBOOKXSLPATH" ]
62 DOCBOOKXSLPATH
=$
(xmlcatalog
"$CATALOG" "$KEY")
64 test $?
-ne 0 -o -z "$DOCBOOKXSLPATH" && \
68 test "${DOCBOOKXSLPATH:0:7}" == "file://" && \
69 DOCBOOKXSLPATH
=${DOCBOOKXSLPATH:7}
70 if [ -n "$DOCBOOKXSLPATH" ]
72 echo "docbook-xsl path found: $DOCBOOKXSLPATH"
73 sed "s|@DOCBOOK_XSL_PATH@|$DOCBOOKXSLPATH|g" "$1" \
75 $SAXON -o ${SCM}.fo
"$2" ${SCM}.xsl
&& \
76 fop
-fo ${SCM}.fo
-pdf ${SCM}.pdf
81 echo "couldn't find docbook-xsl path from any of the following catalog files:"