2 # see the README in this directory for usage etc.
6 echo 'Usage: xmlproc.sh -[option] <filename.xml>';
7 echo 'Specify a target from:';
8 echo '-v verify xml file conforms to dtd';
9 echo '-html output in html format (single file)';
10 echo '-ps output in postscript format';
11 echo '-pdf output in pdf format';
15 if test $# -ne 2; then
18 # assign the variable for the output type
20 # assign the output filename
22 # and check user input it correct
23 if !(test -f $xmlfile); then
24 echo "No such file: $xmlfile";
27 # some other stuff we will use
33 basename=${basename//'.xml'/''}
35 fofile="${basename}.fo"
36 htmlfile="${basename}.html"
37 pdffile="${basename}.pdf"
38 psfile="${basename}.ps"
39 xmlfmtfile="${basename}.fmt"
41 # first process the xmlfile with CDATA tags
42 ./format.pl $xmlfile $xmlfmtfile
43 # so the shell knows where the catalogs live
44 export XML_CATALOG_FILES=/etc/xml/catalog
46 # post-processing tidy up
48 echo "Cleaning up: # $@"
52 echo " deleting $arg";
59 flags='--noout --xinclude --noblanks --postvalid'
60 dtd='--dtdvalid http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'
61 xmllint $flags $dtd $xmlfmtfile 2> $OUT
67 echo "Creating $htmlfile ..."
68 xsltproc --nonet --xinclude -o $htmlfile $xsl_html $xmlfmtfile
73 echo "Creating $pdffile ..."
74 xsltproc --nonet --xinclude -o $fofile $xsl_fo $xmlfmtfile
75 pdfxmltex $fofile >$OUT </dev/null
76 pdfxmltex $fofile >$OUT </dev/null
77 pdfxmltex $fofile >$OUT </dev/null
78 cleanup $OUT $xmlfmtfile *.aux *.fo *.log *.out
82 echo "Creating $psfile ..."
83 xsltproc --nonet --xinclude -o $fofile $xsl_fo $xmlfmtfile
84 pdfxmltex $fofile >$OUT </dev/null
85 pdfxmltex $fofile >$OUT </dev/null
86 pdfxmltex $fofile >$OUT </dev/null
87 pdftops $pdffile $psfile
88 cleanup $OUT $xmlfmtfile $pdffile *.aux *.fo *.log *.out
89 # passivetex is broken, so we can't go this route yet.
90 # xmltex $fofile >$OUT </dev/null
91 # xmltex $fofile >$OUT </dev/null
92 # xmltex $fofile >$OUT </dev/null
93 # dvips -R -q -o bzip-manual.ps *.dvi