pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / bzip2-1.0.3 / xmlproc.sh
blob6fe4d5748bb0bcb5ac7ac5fcd0c56ce5ba212683
1 #!/bin/bash
2 # see the README in this directory for usage etc.
4 usage() {
5 echo '';
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';
12 exit;
15 if test $# -ne 2; then
16 usage
18 # assign the variable for the output type
19 action=$1; shift
20 # assign the output filename
21 xmlfile=$1; shift
22 # and check user input it correct
23 if !(test -f $xmlfile); then
24 echo "No such file: $xmlfile";
25 exit;
27 # some other stuff we will use
28 OUT=output
29 xsl_fo=bz-fo.xsl
30 xsl_html=bz-html.xsl
32 basename=$xmlfile
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
47 cleanup() {
48 echo "Cleaning up: # $@"
49 while [ $# != 0 ]
51 arg=$1; shift;
52 echo " deleting $arg";
53 rm $arg
54 done
57 case $action in
58 -v)
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
62 egrep 'error' $OUT
63 rm $OUT
66 -html)
67 echo "Creating $htmlfile ..."
68 xsltproc --nonet --xinclude -o $htmlfile $xsl_html $xmlfmtfile
69 cleanup $xmlfmtfile
72 -pdf)
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
81 -ps)
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
97 usage
99 esac