--- /dev/null
+#!/usr/bin/perl -- # --*-Perl-*--
+
+my $VPATH = shift;
+
+chdir($VPATH) if $VPATH;
+
+@files = glob("*.java");
+
+print "CLASSFILES=";
+
+while (@files) {
+ $file = shift @files;
+ $file =~ s/\.java$/\.class/;
+ print "$file ";
+ print "\\" if @files;
+ print "\n";
+}
+
+print "\n";
print "<!-- *********************************************************************
*** THIS IS THE FLATTENED DTD. DO NOT EDIT THIS DTD BY HAND, EDIT ***
- *** THE CUSTOMIZATION LAYER AND REGNERATE THE FLATTENED DTD! ********
+ *** THE CUSTOMIZATION LAYER AND REGENERATE THE FLATTENED DTD! ********
********************************************************************* -->\n\n";
open (F, $dtd);
local(*F, $_);
# HACK HACK HACK
- if ($dtd =~ /http:\/\/www.oasis-open.org\/docbook\/xml\/simple\/.*\/([^\/]+)$/) {
- print STDERR "match: $1\n";
+ if ($dtd =~ /http:\/\/www.oasis-open.org\/docbook\/xml\/simple\/.*\/([^\/]+)$/
+ || $dtd =~ /http:\/\/docbook.org\/xml\/simple\/.*\/([^\/]+)$/) {
+ print STDERR "$dtd ==>\n";
$dtd = "/sourceforge/docbook/docbook/simple/$1";
+ print STDERR "\t$dtd\n";
}
# HACK HACK HACK
- if ($dtd =~ /http:\/\/www.oasis-open.org\/docbook\/xml\/.*?\//
- || $dtd =~ /http:\/\/docbook.org\/xml\/.*?\//) {
- $dtd = "/sourceforge/docbook/docbook/xml/$'";
+ if ($dtd =~ /http:\/\/www.oasis-open.org\/docbook\/xml\/(.*)$/
+ || $dtd =~ /http:\/\/docbook.org\/xml\/(.*)$/) {
+ print STDERR "$dtd ==>\n";
+ $dtd = "/share/websites/docbook/xml/$1";
+ print STDERR "\t$dtd\n";
+ }
+
+ # HACK HACK HACK
+ if ($dtd =~ /http:\/\/www.w3.org\/2003\/entities\/(.*)$/) {
+ print STDERR "$dtd ==>\n";
+ $dtd = "/projects/w3c/WWW/2003/entities/$1";
+ print STDERR "\t$dtd\n";
}
if (! -f $dtd) {
#
DONE=0
-VERSION=652
+VERSION=653
EXTVERSION=643
DEBUG=0
XARG=""
YARG=""
RARG=""
MEMORY=""
+VALIDATE=""
# which parser to use
PARSER=auto
-
MYDIR=`dirname $0`
. $MYDIR/common-functions.sh
-6*) VERSION=$1;
shift;
;;
+ -7*) VERSION=$1;
+ shift;
+ ;;
+ -8*) VERSION=$1;
+ EXTVERSION=8
+ shift;
+ ;;
-x) shift;
XARG="-x $1";
shift;
-q) shift
VERBOSE=false
;;
+ -val) shift
+ VALIDATE=-val
+ ;;
-v) shift
VERBOSE=true
;;
exit 1
fi
+# Toss the leading hyphen
+VERSION=`echo $VERSION | sed -e 's/^-//'`
+
case $VERSION in
- 652|651|65|644|643)
+ 8a)
+ VERSION="sa-8.0";
+ ;;
+ 8b)
+ VERSION="b8.0";
+ ;;
+ 77|751|653|652|651|65|644|643)
: # handled normally below
;;
*) echo "unexpected Saxon version $VERSION" 1>&2
##
## locate saxon.jar
##
+SAXON=
for jar in "/usr/local/java/saxon-$DOTTEDVERSION/saxon.jar" \
+ "/usr/local/java/saxon-$DOTTEDVERSION/saxon7.jar" \
+ "/usr/local/java/saxon-$DOTTEDVERSION/saxon8sa.jar" \
+ "/usr/local/java/saxon$DOTTEDVERSION/saxon8sa.jar" \
"/usr/local/share/java/saxon-$DOTTEDVERSION/saxon.jar" \
+ "/usr/local/share/java/saxon-$DOTTEDVERSION/saxon7.jar" \
+ "/usr/local/share/java/saxon$DOTTEDVERSION/saxon8sa.jar" \
"/usr/share/java/saxon-$DOTTEDVERSION.jar" \
"/usr/local/java/saxon/saxon.jar" \
"/usr/local/share/java/saxon/saxon.jar" \
"/usr/share/java/saxon.jar"; do
- if [ -f "$jar" ]; then
+ if [ -f "$jar" -a "$SAXON" = "" ]; then
SAXON="$jar"
break
fi
## These are the settings which control the parser:
## javax.xml.parsers.DocumentBuilderFactory
## javax.xml.parsers.SAXParserFactory
-##
+##
# first choice is xerces2
if [ "$PARSER" = "xerces2" -o "$PARSER" = "auto" ]; then
TFLAG="-T"
fi
+HTTP_PROXY=
+HTTPS_PROXY=
+
+if [ "$http_proxy_host" != "" ]; then
+ HTTP_PROXY="-Dhttp.proxyHost=$http_proxy_host -Dhttp.proxyPort=$http_proxy_port"
+ HTTPS_PROXY="-Dhttps.proxyHost=$http_proxy_host -Dhttps.proxyPort=$http_proxy_port"
+fi
+
if [ ${VERBOSE} ] && ${VERBOSE}; then
- echo java $MEMORY $FOO -cp $CLASSPATH $DBFACTORY $SPFACTORY \
+ echo java $MEMORY -cp $CLASSPATH $DBFACTORY $SPFACTORY \
-Djavax.xml.transform.TransformerFactory=$TRANSFACTORY \
- com.icl.saxon.StyleSheet $TFLAG \
+ com.icl.saxon.StyleSheet $TFLAG $VALIDATE \
$XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY "$@"
fi
-exec java $MEMORY $FOO -cp $CLASSPATH $DBFACTORY $SPFACTORY \
- -Djavax.xml.transform.TransformerFactory=$TRANSFACTORY \
- com.icl.saxon.StyleSheet $TFLAG \
- $XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY "$@"
+#echo VERSION=$VERSION
+
+if [ "$VERSION" = "sa-8.0" ]; then
+ JAVA_HOME=/usr/local/jdk1.4.2
+ JAVA=$JAVA_HOME/bin/java
+# exec $JAVA $HTTP_PROXY $HTTPS_PROXY $MEMORY -cp $CLASSPATH $DBFACTORY $SPFACTORY \
+# -Djavax.xml.transform.TransformerFactory=$TRANSFACTORY \
+# com.saxonica.Transform $TFLAG $VALIDATE $SAXONOPT \
+# $XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY "$@"
+ CLASSPATH=/usr/local/java/saxonsa-8.0/saxon8sa.jar:/home/ndw/java
+ exec $JAVA $HTTP_PROXY $HTTPS_PROXY $MEMORY -cp $CLASSPATH \
+ com.saxonica.Transform $TFLAG $VALIDATE $SAXONOPT \
+ $OUTPUT $XMLSRC $XMLSTY "$@"
+else if [ "$VERSION" = "b8.0" ]; then
+ JAVA_HOME=/usr/local/jdk1.4.2
+ JAVA=$JAVA_HOME/bin/java
+ CLASSPATH=/usr/local/java/saxonb-8.0/saxon8.jar:/home/ndw/java
+ echo $JAVA $HTTP_PROXY $HTTPS_PROXY $MEMORY -cp $CLASSPATH \
+ net.sf.saxon.Transform $TFLAG $VALIDATE $SAXONOPT \
+ $OUTPUT $XMLSRC $XMLSTY "$@"
+ exec $JAVA $HTTP_PROXY $HTTPS_PROXY $MEMORY -cp $CLASSPATH \
+ net.sf.saxon.Transform $TFLAG $VALIDATE $SAXONOPT \
+ $OUTPUT $XMLSRC $XMLSTY "$@"
+else if [ "$VERSION" = "77" ]; then
+ JAVA_HOME=/usr/local/jdk1.4.2
+ JAVA=$JAVA_HOME/bin/java
+ exec $JAVA $HTTP_PROXY $HTTPS_PROXY $MEMORY -cp $CLASSPATH $DBFACTORY $SPFACTORY \
+ -Djavax.xml.transform.TransformerFactory=$TRANSFACTORY \
+ net.sf.saxon.Transform $TFLAG \
+ $XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY "$@"
+else
+ exec java $HTTP_PROXY $HTTPS_PROXY $MEMORY -cp $CLASSPATH $DBFACTORY $SPFACTORY \
+ -Djavax.xml.transform.TransformerFactory=$TRANSFACTORY \
+ com.icl.saxon.StyleSheet $TFLAG \
+ $XARG $YARG $RARG $OUTPUT $XMLSRC $XMLSTY "$@"
+fi
+fi
+fi
\ No newline at end of file
} else {
$opts .= " " if $opts ne "";
$opts .= $_;
+
+ if ($_ eq '--doctype') {
+ $_ = shift @ARGV;
+ $opts .= " $_";
+ }
}
}
-if ($#filenames == 0) {
- my $filename = shift @filenames;
+foreach my $file (@filenames) {
my $content = "";
- open (F, "/usr/bin/tidy $opts $filename |");
+ print STDERR "Tidy $file...\n";
+ open (F, "/usr/bin/tidy -wrap 512 $opts $file |");
while (<F>) {
$content .= $_;
}
if ($content eq '') {
# we must have done an "in-place" tidy
- if (open (F, $filename)) {
- read (F, $content, -s $filename);
+ if (open (F, $file)) {
+ read (F, $content, -s $file);
close (F);
}
}
- $content =~ s/(<a\s[^>]+>)\s+/$1/sg;
- $content =~ s/\s+(<\/a>)/$1/sg;
+ $content = cleanupContent($content);
- open (F, ">$filename");
+ open (F, ">$file");
print F $content;
close (F);
-} else {
- system ("/usr/bin/tidy $opts " . join(" ", @filenames));
- foreach my $filename (@filenames) {
- if (open (F, $filename)) {
- read (F, $content, -s $filename);
- close (F);
- }
+}
+
+# the old way...
+# if ($#filenames == 0) {
+# my $filename = shift @filenames;
+# my $content = "";
+#
+# open (F, "/usr/bin/tidy -wrap 512 $opts $filename |");
+# while (<F>) {
+# $content .= $_;
+# }
+# close (F);
+#
+# if ($content eq '') {
+# # we must have done an "in-place" tidy
+# if (open (F, $filename)) {
+# read (F, $content, -s $filename);
+# close (F);
+# }
+# }
+#
+# $content = cleanupContent($content);
+#
+# open (F, ">$filename");
+# print F $content;
+# close (F);
+# } else {
+# system ("/usr/bin/tidy -wrap 512 $opts " . join(" ", @filenames));
+# foreach my $filename (@filenames) {
+# if (open (F, $filename)) {
+# read (F, $content, -s $filename);
+# close (F);
+# }
+#
+# $content = cleanupContent($content);
+#
+# open (F, ">$filename");
+# print F $content;
+# close (F);
+# }
+# }
+
+sub cleanupContent {
+ my $content = shift;
+
+ $content =~ s/(<a\s[^>]+>)\s+/$1/sg;
+ $content =~ s/\s+(<\/a>)/$1/sg;
+
+ my $newContent = "";
- $content =~ s/(<a\s[^>]+>)\s+/$1/sg;
- $content =~ s/\s+(<\/a>)/$1/sg;
+ # workaround a bug in tidy...it removes sometimes!
+ while ($content
+ =~ /^(.*?)(<div class=([\'\"])literallayout\3.*?>)(.*?)(<\/div>.*)$/is) {
+ my $pre = $1;
+ my $starttag = $2;
+ my $litlayout = $4;
+ my $post = $5;
- open (F, ">$filename");
- print F $content;
- close (F);
+ #print "====$litlayout====\n";
+ #print "------------------\n";
+ #print "====", addnbsp($litlayout), "====\n";
+
+ $newContent .= $pre . $starttag . addnbsp($litlayout);
+ $content = $post;
}
+
+ return $newContent . $content;
}
+sub addnbsp {
+ my $content = shift;
+ my $esc = "";
+
+ while ($content ne "") {
+ if ($content =~ /^(.*?)(<.*?>)(.*)$/s) {
+ my $text = $1;
+ my $tag = $2;
+ $content = $3;
+ $text =~ s/ /&\#160;/g;
+ $esc .= $text . $tag;
+ } else {
+ my $text = $content;
+ $content = "";
+ $text =~ s/ /&\#160;/g;
+ $esc .= $text;
+ }
+ }
+
+ return $esc;
+}
"${XALANROOT}" \
"${XALANROOT}/xalan2.jar" \
"${XALANROOT}/bin/xalan2.jar" \
- "/projects/apache/xml-xalan/java" \
+ "/projects/apache/xml-xalan/java/build/classes" \
"/usr/local/java/xalan-j_${STRIKEVERSION}/bin/xalan.jar" \
"/usr/local/share/java/xalan-j_${STRIKEVERSION}/bin/xalan.jar" \
"/usr/local/share/java/xalan-$STRIKEVERSION.jar" \
fi
fi
+RESOLVERS=""
+echo java $MEMORY $SAXPARSER org.apache.xalan.xslt.Process $RESOLVERS $@
+
CLASSPATH=`fixclasspath "$NDWEXT:$XALAN:$JAXP:$RESOLVER:$XERCES:$CLASSPATH"`
+#echo $CLASSPATH
+
if [ ${VERBOSE} ] && ${VERBOSE}; then
echo java $MEMORY $SAXPARSER org.apache.xalan.xslt.Process $RESOLVERS $@
fi
XREAD=org.apache.xml.resolver.apps.xread
fi
-CLASSPATH=$RESOLVER:$XERCES:$CLASSPATH
+#XREAD=org.apache.xerces.impl.Version
+CLASSPATH=$RESOLVER:$XERCES:$CLASSPATH
#echo $CLASSPATH
exec java $HTTP_PROXY $HTTPS_PROXY -cp $CLASSPATH $XREAD $*
my %option = ('debug' => 0,
'quiet' => 0,
+ 'verbose' => 0,
'time' => 0,
'extensions' => 1,
'version' => undef,
&GetOptions(\%opt,
'debug+',
'quiet+',
+ 'verbose',
'time',
'extensions!',
'version=s',
my $time = $option{'time'};
my $version = $option{'version'};
my $quiet = $option{'quiet'};
+my $verbose = $option{'verbose'};
my $memory = $option{'memory'};
my $debug = $option{'debug'};
$cmd = "$exedir/saxon";
$cmd .= " $procopt" if $procopt;
$cmd .= " -q" if $quiet;
+ $cmd .= " -v" if $verbose;
$cmd .= " -d" if $debug;
$cmd .= " -$version" if $version;
$cmd .= " -m $memory" if $memory;
$cmd = "$exedir/xalan";
$cmd .= " $procopt" if $procopt;
$cmd .= " -q" if $quiet;
+ $cmd .= " -v" if $verbose;
$cmd .= " -d" if $debug;
$cmd .= " -$version" if $version;
$cmd .= " -m $memory" if $memory;
$cmd = "$exedir/xsltproc";
$cmd .= " $procopt" if $procopt;
$cmd .= " -q" if $quiet;
+ $cmd .= " -v" if $verbose;
foreach my $key (keys %param) {
$cmd .= " -param $key \"'" . $param{$key} . "'\"";
}
$cmd = "$exedir/4xslt";
$cmd .= " $procopt" if $procopt;
$cmd .= " -q" if $quiet;
+ $cmd .= " -v" if $verbose;
foreach my $key (keys %param) {
$cmd .= " --define=$key=\"" . $param{$key} . "\"";
}
$cmd = "$exedir/xt";
$cmd .= " $procopt" if $procopt;
$cmd .= " -q" if $quiet;
+ $cmd .= " -v" if $verbose;
$cmd .= " $xmlFile $xslFile";
$outFile = "-" if $outFile eq '';
$cmd .= " $outFile" if $outFile;
echo xsltproc $OPTS "$@"
fi
-/usr/local/bin/xsltproc --catalogs $OPTS "$@"
+/usr/bin/xsltproc --catalogs $OPTS "$@"
if [ $? != 0 ]; then
echo ""