#!/bin/sh
# convert DocBook to XHTML
#   Requirement:
#      libxml2     http://xmlsoft.org/
#      libxslt     http://xmlsoft.org/XSLT/
#      iconv       C library
#                  or GNU libiconv(http://www.gnu.org/software/libiconv/)
#      en2utf8.pl  contrib/
if test $# -le 1; then
  echo "Usage: docbook2xhtml stylesheet file"
  exit 1
fi

XSL=$1
INPUT=$2
OUTPUT=${INPUT%%xml}html

xsltproc --stringparam 'l10n.gentext.language' 'ja' ${XSL} ${INPUT} | \
sed '
  s{ xmlns="http://www.w3.org/1999/xhtml"{{g;
  s{ lang="ja"{{g;
  s{/>{ />{g;
  s{<html xmlns="http://www.w3.org/1999/xhtml">{<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">{;
  s{<head>{<head><meta http-equiv="content-type" content="text/html;charset=euc-jp" />{;
  s{</div><div class="sect1">{</div><hr /><div class="sect1">{g;
' > ${OUTPUT}
exit 0

