00000024
  M   ˆl—Ým_JJi?u8 ^¸Ë·qLZ7ÿ�þB gBG Û¢ÏÏƒh¹Ìa–Ým_JJi?u8 ^¸Ð.2Ò˜´oÊ      0
  7   ˆl–Ü4ý( ©|¤P@Êû‚rã!S�ÿ�þZq™VmØåZ~1º@?Ñ„¯¼ÏÎ¿Ë ?÷     #!/bin/bash
#
# xmlto - apply an XSL stylesheet to an XML document
# Copyright (C) 2001, 2002, 2003  Tim Waugh <twaugh@redhat.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.

# Utilities that we need that aren't everywhere
FIND=find      # This must be GNU find (need -maxdepth)
MKTEMP=mktemp # See http://www.mktemp.org if missing on your system
BASH=/bin/bash     # GNU bash, for running the format scripts
GETOPT=getopt # a getopt that supports --longoptions
TAIL=/usr/bin/tail     # a tail that supports -n (posix)
GREP=/bin/grep     # GNU grep, for searching patterns
SED=/bin/sed       # GNU sed, for modification of patterns

version () {
  echo "xmlto version 0.0.28"
}

usage () {
  cat << EOF
usage: xmlto [OPTION]... FORMAT XML
OPTIONs are:
  -v              verbose output (-vv for very verbose)
  -x stylesheet   use the specified stylesheet instead of choosing one
  -m fragment     use the XSL fragment to customize the stylesheet
  -o directory    put output in the specified directory instead of
                  the current working directory
  -p postprocopts pass option to postprocessor
  --extensions    turn on stylesheet extensions for this tool chain
  --noautosize    do not autodetect paper size via locales or paperconf
  --noclean       temp files are not deleted automatically
                  (good for diagnostics)
  --noextensions  do not use passivetex/fop extensions
  --profile       use profiling stylesheet
  --searchpath    colon-separated list of fallback directories
  --skip-validation
                  do not attempt to validate the input before processing
  --stringparam paramname=paramvalue
                  pass a named parameter to the stylesheet from the
                  command line
  --with-fop      use fop for formatting (if fop available)
  --with-dblatex  use dblatex for formatting (if dblatex available)

Available FORMATs depend on the type of the XML file (which is
determined automatically).
EOF
  if [ -d "$FORMAT_DIR" ]
  then
    for source in $(${FIND} "$FORMAT_DIR" -maxdepth 1 -type d)
    do
      if [ "$source" = "$FORMAT_DIR" ]; then continue; fi

      cat << EOF

For documents of type "$(basename "$source")":
EOF
    ls "$source"
    done
  fi
}

# make_temp [-d] filenametag varname [message upon failure]
#
# Wrapper for 'varname=$(mktemp /tmp/xmlto-$filenametag.XXXXXX)'.
#  * Remembers the temporary file's name so it can be deleted on exit
#  * If the failure message is empty or missing, exits on failure
make_temp () {
  local dirflag="" prefix="xmlto"
  [ "$1" = "-d" ] && { dirflag="-d"; shift; }
  [ -n "$1" ] && prefix="xmlto-$1"

  if eval $2='$(${MKTEMP} $dirflag "${TMPDIR:-/tmp}/${prefix}.XXXXXX")'
  then
    CLEANFILES="$CLEANFILES ${!2}"
    return 0
  elif [ -z "$3" ]
  then
    echo >&2 "mktemp failed!"
    exit 2
  else
    echo >&2 "mktemp failed. $3"
    return 2
  fi
}

compute_searchpath () {
  local oldIFS="${IFS}"
  IFS=":"
  for asearchpath in "$1"; do
    # wrangle relative paths into absolute ones so that the user
    # isn't surprised if he does ``--searchpath .''
    case "${asearchpath}" in
     /*) ;;
     *) asearchpath="${PWD}/${asearchpath}" ;;
    esac
    SEARCHPATH="${SEARCHPATH}${XML_SEARCHPATH_SEPARATOR}${asearchpath}"
    # we only need a colon if more than one path is in the searchpath
    # an