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
48 /usr/local/share/xml/catalog $HOME/xml/catalog"
50 KEY
="http://docbook.sourceforge.net/release/xsl/current"
55 for CATALOG
in $CATALOG_FILES
59 DOCBOOKXSLPATH
=$
(xmlcatalog
"$CATALOG" "$KEY/")
61 if [ $?
-ne 0 -o -z "$DOCBOOKXSLPATH" ]
63 DOCBOOKXSLPATH
=$
(xmlcatalog
"$CATALOG" "$KEY")
65 test $?
-ne 0 -o -z "$DOCBOOKXSLPATH" && \
69 test "`echo ${DOCBOOKXSLPATH} | cut -c 1-7`" = "file://" && \
70 DOCBOOKXSLPATH
=`echo ${DOCBOOKXSLPATH} | cut -c 8-`
71 if [ -n "$DOCBOOKXSLPATH" ]
73 echo "docbook-xsl path found: $DOCBOOKXSLPATH"
74 sed "s|@DOCBOOK_XSL_PATH@|$DOCBOOKXSLPATH|g" "$1" \
76 $SAXON -o ${SCM}.fo
"$2" ${SCM}.xsl
&& \
77 fop
-fo ${SCM}.fo
-pdf ${SCM}.pdf
82 echo "couldn't find docbook-xsl path from any of the following catalog files:"