Hello community,

here is the log from the commit of package docbook-xsl for openSUSE:Factory 
checked in at 2017-12-05 01:28:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/docbook-xsl (Old)
 and      /work/SRC/openSUSE:Factory/.docbook-xsl.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "docbook-xsl"

Tue Dec  5 01:28:12 2017 rev:1 rq:546168 version:1.79.2

Changes:
--------
New Changes file:

--- /dev/null   2017-10-14 16:26:57.428140955 +0200
+++ /work/SRC/openSUSE:Factory/.docbook-xsl.new/docbook-xsl.changes     
2017-12-05 01:28:26.877200628 +0100
@@ -0,0 +1,808 @@
+-------------------------------------------------------------------
+Wed Nov 22 08:34:21 UTC 2017 - [email protected]
+
+- Abandom the docbook-xsl-stylesheets-script package.
+  The dbtoepub script is available from the rubygem-dbtoepub
+  package.
+  The script pdf2index is available in docbook-xsl-pdf2index
+
+-------------------------------------------------------------------
+Sun Nov 19 17:03:25 UTC 2017 - [email protected]
+
+- First attempt to build the two DocBook stylesheet packages
+  from a single source:
+  - Added xslnons-build script from upstream.
+  - Improved dbxslt-install.sh script a lot
+
+
+-------------------------------------------------------------------
+Tue Nov 14 12:44:15 UTC 2017 - [email protected]
+
+- Fix bsc#1063066:
+  From 1.79.1 and later, upstream decided to release namespace
+  aware stylesheets only. The non-NS stylesheets have to be built
+  with the "xslnons-build" script (taken from upstream).
+  This is integrated now.
+  The switch from NS-aware to non-NS stylesheets help to fix this
+  problem.  
+
+-------------------------------------------------------------------
+Fri Oct 27 07:35:44 UTC 2017 - [email protected]
+
+- Restore working patch (bsc#1063066):
+  * Rebase docbook-xsl-stylesheets-non-recursive_string_subst.patch
+
+-------------------------------------------------------------------
+Sun Oct  1 14:45:19 UTC 2017 - [email protected]
+
+- Update to version 1.79.2
+- Rebase docbook-xsl-stylesheets-non-recursive_string_subst.patch
+- callout-gen is removed
+
+-------------------------------------------------------------------
+Sat Aug 26 12:07:41 UTC 2017 - [email protected]
+
+- Add docbook-xsl-stylesheets-non-recursive_string_subst.patch
+  Use str:replace from exslt.org to implement string.subst
+
+  string.subst implementation causes recursion issues when building
+  systemd documentation. This issue has been reported in
+  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765567 and
+  https://bugs.archlinux.org/task/54694 .
+
+  Taken from 
https://github.com/fishilico/xslt10-stylesheets/commit/a7df4fbbef3ab0f97d50aa47f2ccfa0630a2686e
+
+-------------------------------------------------------------------
+Tue Feb  7 16:40:58 UTC 2017 - [email protected]
+
+- Explicitly package %{_docdir}/%{name} to fix build with RPM 4.13.
+
+-------------------------------------------------------------------
+Tue Jul 19 11:44:56 UTC 2016 - [email protected]
+
+- Use update-xml-catalog
+
+-------------------------------------------------------------------
+Mon Dec 21 09:44:33 UTC 2015 - [email protected]
+
+- Update download urls
+
+-------------------------------------------------------------------
+Sat Dec 12 18:35:36 UTC 2015 - [email protected]
+
+- Update to version 1.79.0, see 
+  http://snapshots.docbook.org/xsl/RELEASE-NOTES.html#V1.79.0
+  for details (Mostly bugfix release)
+- Remove obsolete patches
+  * docbook-xsl-stylesheets-epub3-base.dir.patch
+  * docbook-xsl-stylesheets-manpages-other-r9847.patch
+- Perform a spec-cleaner on the spec file
+
+-------------------------------------------------------------------
+Wed Apr 29 09:38:13 UTC 2015 - [email protected]
+
+- Fixed bsc#928753 (added missing template directory)
+- Slightly corrected file list
+
+-------------------------------------------------------------------
+Thu Feb 19 12:25:28 UTC 2015 - [email protected]
+
+- Slightly adapted %post and %postun section to fix bsc#918565
+
+-------------------------------------------------------------------
+Mon Jan 12 09:53:49 UTC 2015 - [email protected]
+
+- Added missing images directory to install-script dbxslt-install.sh 
+
+-------------------------------------------------------------------
+Thu Feb  6 13:30:10 UTC 2014 - [email protected]
+
+- Fixed bnc#842844 and added upstream patch from r9847 of docbook#1313
+  (File docbook-xsl-stylesheets-manpages-other-r9847.patch)
+
+-------------------------------------------------------------------
+Thu Feb  6 12:03:53 UTC 2014 - [email protected]
+
+- .spec: syntax fix.
+
+-------------------------------------------------------------------
+Mon Dec  9 13:49:49 UTC 2013 - [email protected]
+
+- Added missing patch description to follow Patch Guidlines 
+  (see http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines)
+- Added upstream patch (r9732-r9743 for base.dir parameter in EPUB3)
+
+-------------------------------------------------------------------
+Mon Sep 23 13:51:41 UTC 2013 - [email protected]
+
+- Moved installation procedure into dbxslt-install.sh Shell script
+
+-------------------------------------------------------------------
+Fri Jun 28 09:12:59 UTC 2013 - [email protected]
+
+- Corrected conflict with docbook5-xsl-stylesheets:
+  Created subpackage with pdf2index (which raised this conflict)
+  and moved other scripts too (db2epub, callout-gen).
+  This makes it easier to install both variantes of the
+  stylesheets
+
+-------------------------------------------------------------------
+Fri May 31 16:03:17 UTC 2013 - [email protected]
+
+- Fix spec to avoid conflict with docbook5-xsl-stylesheets
+
+-------------------------------------------------------------------
+Mon Mar 18 09:42:59 UTC 2013 - [email protected]
+
+- Update to 1.78.1, see 
http://snapshots.docbook.org/xsl/RELEASE-NOTES.html#V1.78.1
+  for details
+- Added %exclude in SPEC file for .htaccess files
+
+-------------------------------------------------------------------
+Thu Jan 17 19:41:11 UTC 2013 - [email protected]
+
+- Updated to 1.78.0, see 
http://snapshots.docbook.org/xsl/RELEASE-NOTES.html#V1.78.0
+  for details (Mostly bugfix release) 
+
+-------------------------------------------------------------------
+Mon Jun 11 13:13:30 UTC 2012 - [email protected]
+
+- Fixed SPEC file:
+  * added missing db2epub in /epub/bin/
+  * create symbolic links (-s) with fdupes
+
+-------------------------------------------------------------------
+Tue Jun  5 09:57:35 UTC 2012 - [email protected]
+
+- Updated to 1.77.1, see 
http://snapshots.docbook.org/xsl/RELEASE-NOTES.html#V1.77.1
+  for details (Mostly bugfix release) 
+- Fixed spec file to copy VERSION.xsl instead of VERSION
+
+-------------------------------------------------------------------
+Fri May 25 08:53:52 UTC 2012 - [email protected]
+
+- Updated to 1.77.0, see 
http://snapshots.docbook.org/xsl/RELEASE-NOTES.html#V1.77.0
+  for details
+  (Merged from Factory)
+
+-------------------------------------------------------------------
+Thu Jan 12 11:30:33 UTC 2012 - [email protected]
+
+- change license to be in spdx.org format
+
+-------------------------------------------------------------------
+Wed Sep 21 10:32:26 UTC 2011 - [email protected]
+
+- remove ruby requires, there is nothing in here using ruby and
+  ruby needs this package indirectly - creating a build cycle
+
+-------------------------------------------------------------------
+Sun Sep 18 17:17:12 UTC 2011 - [email protected]
+
+- Remove redundant tags/sections from specfile
+  (cf. packaging guidelines)
+
+-------------------------------------------------------------------
+Tue Apr 12 06:30:39 UTC 2011 - [email protected]
+
+- Update to 1.76.1; for news, see
+  http://lists.oasis-open.org/archives/docbook-apps/201011/msg00007.html
+- Moved pdf2index and dbtoepub to /usr/bin
+- Cleaned up Spec file to avoid rpmlint warnings
+- Removed now obsolete chunktoc-fix.patch
+
+-------------------------------------------------------------------
+Wed Apr 14 12:28:37 CEST 2010 - [email protected]
+
+- chunktoc.xsl: Added missing namespace declarations. Closes
++++ 611 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:Factory/.docbook-xsl.new/docbook-xsl.changes

New:
----
  dbxslt-install.sh
  docbook-xsl-1.79.2.tar.bz2
  docbook-xsl-dbtoepub.patch
  docbook-xsl-doc-1.79.2.tar.bz2
  docbook-xsl-non-recursive_string_subst.patch
  docbook-xsl-stylesheets.xml
  docbook-xsl.changes
  docbook-xsl.spec
  docbook5-xsl-stylesheets.xml
  xslnons-build

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ docbook-xsl.spec ++++++
#
# spec file for package docbook-xsl
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define realversion            %{version}
#
%define db4rootdir             %{_datadir}/xml/docbook/stylesheet/nwalsh
%define db4package             docbook-xsl-stylesheets
%define db4style_catalog       %{db4package}.xml
#
%define db5rootdir             %{_datadir}/xml/docbook/stylesheet/nwalsh5
%define db5package             docbook5-xsl-stylesheets
%define db5style_catalog       %{db5package}.xml
#
%define etcxmlcatalogd         %{_sysconfdir}/xml/catalog.d
#
Name:           docbook-xsl
Version:        1.79.2
Release:        0
Summary:        XSL Stylesheets for DocBook
License:        MPL-1.1 AND MIT
Group:          Productivity/Publishing/DocBook
URL:            https://github.com/docbook/xslt10-stylesheets
Source0:        
https://github.com/docbook/xslt10-stylesheets/releases/download/release%%2F%{version}/docbook-xsl-%{version}.tar.bz2
Source1:        
https://github.com/docbook/xslt10-stylesheets/releases/download/release%%2F%{version}/docbook-xsl-doc-%{version}.tar.bz2
Source2:        %{db4style_catalog}
Source3:        %{db5style_catalog}
# Build scripts
Source10:       dbxslt-install.sh
Source11:       xslnons-build
## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-dbtoepub.patch Fixed dirname
Patch0:         %{name}-dbtoepub.patch
## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-non-recursive_string_subst.patch 
Use EXSLT replace function to avoid recursive implementation of string.subst
Patch1:         %{name}-non-recursive_string_subst.patch
BuildRequires:  fdupes
BuildRequires:  sgml-skel >= 0.7
BuildRequires:  unzip
Requires:       docbook_4
Requires:       sgml-skel >= 0.7
Requires:       xmlcharent
Requires(post): sgml-skel >= 0.7
Requires(postun): sgml-skel >= 0.7
Requires(pre):  %{_bindir}/xmlcatalog
BuildArch:      noarch
#--------------------------------------------------------------------------

%description
%{summary}.

Wrapper package for DocBook 4 and 5 stylesheets.

%package        -n %{db4package}
Summary:        XSL Stylesheets for DocBook 4
Group:          Productivity/Publishing/XML
Requires:       docbook_4
Requires:       sgml-skel >= 0.7
Requires:       xmlcharent
Requires(post): sgml-skel >= 0.7
Requires(postun): sgml-skel >= 0.7
Suggests:       rubygem(dbtoepub)

%description   -n %{db4package}
These are the XSL stylesheets for DocBook XML and "Simplified" DocBook
DTDs. Use these stylesheets for documents based on DocBook 4 and
earlier; they are not aware of the namespace feature.

The stylesheets transform DocBook 4 documents into HTML, XHTML, Manpages,
XSL-FO (for PDF), and a few other formats.

XSL is a standard W3C stylesheet language for both print and online
rendering. For more information about XSL, see the XSL page at the W3C:
http://www.w3.org/Style/XSL/

%package        -n docbook5-xsl-stylesheets
Summary:        XSL Stylesheets for DocBook 5
Group:          Productivity/Publishing/XML
Requires:       docbook_5
Requires:       sgml-skel >= 0.7
Requires:       xmlcharent
Requires(post): sgml-skel >= 0.7
Requires(postun): sgml-skel >= 0.7
Suggests:       rubygem(dbtoepub)

%description   -n docbook5-xsl-stylesheets
These are the XSL stylesheets for DocBook 5 XML and "Simplified" DocBook 5.
Use these stylesheets for documents based on DocBook 5; they are aware
of the namespace feature.

The stylesheets transform DocBook 5 documents into HTML, XHTML, Manpages,
XSL-FO (for PDF), and a few other formats.

XSL is a standard W3C stylesheet language for both print and online
rendering. For more information about XSL, see the XSL page at the W3C:
http://www.w3.org/Style/XSL/

%package        pdf2index
# License:       MPL-1.1 and MIT
Summary:        Script to create Indices for FOP
Group:          Productivity/Publishing/XML
Requires:       ImageMagick
Requires:       perl


%description   pdf2index

Contains the script pdf2index which creates indices for FOP.


%prep
# %%setup -q -n docbook-xsl-%%{realversion} -b1
%setup -q -c -T -n docbook-xsl

# Prepare directories:
mkdir docbook-xsl-%{realversion}-ns docbook-xsl-%{realversion}-nons

# Copy all source files and make scripts executable:
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} .
chmod +x $(basename %{SOURCE10}) $(basename %{SOURCE11})

# Replace version in XML catalog files
db4=$(basename %{SOURCE2})
db5=$(basename %{SOURCE3})
sed --in-place 's/@VERSION@/%{realversion}/' $db4
sed --in-place 's/@VERSION@/%{realversion}/' $db5

# Unpack stylesheet and doc sources into the correct directory:
tar xf %{SOURCE0} -C docbook-xsl-%{realversion}-ns --strip-components 1
tar xf %{SOURCE1} -C docbook-xsl-%{realversion}-ns --strip-components 1

# Patch the orginal source and remove unnecessary files:
(cd docbook-xsl-%{realversion}-ns
%patch0 -p1
%patch1 -p1

# Remove some Python and Java extensions
# Remove dbtoepub Ruby script. This has been moved to 
devel:languages:ruby:extensions
# see rubygem-dbtoepub
rm -rf extensions/*.py extensions/saxon65.jar extensions/xalan27.jar \
       extensions/build.xml epub/bin
)


%build
pushd docbook-xsl-%{realversion}-ns

find slides -regex 
".*\.\(xml\|htc\|\|hu\|js\|svg\|css\|html\.*\|txt\|rnc\|xhtml\)" \
   -exec sed -i 's/\r//' {} \;

# Fix wrong end-of-line encoding:
sed -i 's/\r//' params/*
# Correct file and directory properties:
find -type f -exec chmod 644 {} \;
find -type d -exec chmod 755 {} \;

# Remove any .htaccess files:
find -type f -name "\.htaccess" -exec rm {} \;

popd

# Create the non-NS variant from the NS original source:
./xslnons-build docbook-xsl-%{realversion}-ns docbook-xsl-%{realversion}-nons


%install
mkdir -p %{buildroot}%{_sysconfdir}/xml/catalog.d \
         %{buildroot}%rb_libdir/

./dbxslt-install.sh --debug --buildroot=%{buildroot} \
            --package-version=%{realversion} \
            --package-name=%{db4package} \
            --sourcedir=docbook-xsl-%{realversion}-nons

./dbxslt-install.sh --debug --buildroot=%{buildroot} \
            --package-version=%{realversion} \
            --package-name=%{db5package} \
            --db-xsl-suffix=nwalsh5 \
            --sourcedir=docbook-xsl-%{realversion}-ns

# The directory is already available at this point:
install -m644 %{db4style_catalog} %{db5style_catalog} 
%{buildroot}%{etcxmlcatalogd}

%fdupes -s %{buildroot}


%post   -n %{db4package}
update-xml-catalog

%postun -n %{db4package}
update-xml-catalog

%post   -n %{db5package}
update-xml-catalog

%postun -n %{db5package}
update-xml-catalog

%files -n %{db4package}
%config %{_sysconfdir}/xml/catalog.d/%{db4style_catalog}
%doc docbook-xsl-%{realversion}-nons/BUGS docbook-xsl-%{realversion}-nons/NEWS
%doc docbook-xsl-%{realversion}-nons/README 
docbook-xsl-%{realversion}-nons/RELEASE-NOTES.*
%doc docbook-xsl-%{realversion}-nons/TODO
%dir %{_datadir}/xml/docbook/stylesheet
%dir %{db4rootdir}
%dir %{db4rootdir}/%{realversion}
%exclude %{db4rootdir}/%{realversion}/fo/pdf2index

%{db4rootdir}/current
%{db4rootdir}/%{realversion}/*

%files -n %{db5package}
%config %{_sysconfdir}/xml/catalog.d/%{db5style_catalog}
%doc docbook-xsl-%{realversion}-ns/BUGS docbook-xsl-%{realversion}-ns/NEWS
%doc docbook-xsl-%{realversion}-ns/README 
docbook-xsl-%{realversion}-ns/RELEASE-NOTES.*
%doc docbook-xsl-%{realversion}-ns/TODO
%dir %{_datadir}/xml/docbook/stylesheet
%dir %{db5rootdir}
%dir %{db5rootdir}/%{realversion}
%exclude %{db5rootdir}/%{realversion}/fo/pdf2index

%{db5rootdir}/current
%{db5rootdir}/%{realversion}/*

%files pdf2index
%attr(0755,root,root) %{_bindir}/pdf2index

%changelog
++++++ dbxslt-install.sh ++++++
#!/bin/bash
#
# Installs the DocBook XSL Stylesheets on openSUSE systems
#
# Author: Thomas Schraitle
# Copyright 2016-2017 [email protected]
#

# set -x

ME=${0##*/}
#
PACKAGE=docbook-xsl-stylesheets
PACKAGE_VERSION=
SOURCEDIR=

#----------------------------------------------------------------------
# System variables
BUILDROOT=
PREFIX=/usr
BINDIR=$PREFIX/bin
DATADIR=share
DOCDIR=$DATADIR/doc/packages
SYSCONFDIR=/etc
XMLCONFDIR=$SYSCONFDIR/xml
XMLDIR=$DATADIR/xml
XMLCATALOGDIR=$XMLCONFDIR/catalog.d
DBSTYLE_CATALOG=$XMLCATALOGDIR/$PACKAGE.xml
DB_XSL_ROOTDIR=$XMLDIR/docbook/stylesheet
DB_XSL_SUFFIX=nwalsh
DBSTYLE_DIR=$DB_XSL_ROOTDIR/$DB_XSL_SUFFIX
SYS_DBSTYLE_DIR=$PREFIX/$DBSTYLE_DIR

INSTALL_SCRIPTS=0


function exit_on_error() {
   local result
   result=${2:-1}
   echo "ERROR: ${1}" >&2
   exit $result;
}


function my_debug() {
# Syntax: my_debug "MESSAGE" [MORE ARGUMENTS...]
# Prints debug messages, if DEBUG_SCRIPT is non-empty
    if [[ "$DEBUG_SCRIPT" ]]; then
        echo -n -e "[debug] ${ME}: $@\n" >&2;
    fi
}

function usage() {
   cat << EOF
Installs the DocBook XSL Stylesheets

Usage:
$ME [OPTIONS]

Fine tuning of the installation directories:
  --buildroot=DIR         build root directory []
  --prefix=DIR            [${PREFIX}]
  --bindir=DIR            user executables [${BINDIR}]
  --sysconfdir=DIR        read-only single-machine data [${SYSCONFDIR}]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/DATADIR]
  --datadir=DIR           read-only architecture-independent data [${DATADIR}]
  --docdir=DIR            documentation root [PREFIX/${DOCDIR}]
  --catalog-dir=DIR       XML catalog directory to store all catalog files 
[${XMLCATALOGDIR}]
  --db-xsl-suffix=SUFFIX  the suffix that is appended to the DocBook stylesheet 
dir [${DB_XSL_SUFFIX}]
  --db-xslt-dir=DIR       root directory for DocBook stylesheets (without 
version)
                          [DATADIR/xml/docbook/stylesheet/DB_XSL_SUFFIX]

Behaviour
  --skip-install-scripts  Do not install any scripts [False]


Source package options:
  --sourcedir=NAME            directory of source directory
  --package-name=NAME         name of the package [$PACKAGE]
  --package-version=VERSION   version of the package [$PACKAGE_VERSION]

EOF
}

function printvariables() {
my_debug "Currently set variables:"
cat << EOF
package=$PACKAGE
package-version=$PACKAGE_VERSION
sourcedir=$SOURCEDIR
buildroot=$BUILDROOT
prefix=$PREFIX
bindir=$BINDIR
datadir=$DATADIR
docdir=$DOCDIR
xmldir=$XMLDIR
xsltrootdir=$XSLTROOTDIR
dbstyle_dir=$DBSTYLE_DIR
db_xsl_suffix=$DB_XSL_SUFFIX
#
sysconfdir=$SYSCONFDIR
xmlconfdir=$XMLCONFDIR
xmlcatalogdir=$XMLCATALOGDIR
dbstyle_catalog=$DBSTYLE_CATALOG
EOF
}

#----------------------------------------------------------------------
#
DEBUG_SCRIPT=

# Source Installation directories:
DBXSLT_DIRS="assembly common eclipse epub epub3 extensions fo \
             images highlighting html htmlhelp lib javahelp manpages params \
             profiling roundtrip slides template webhelp website xhtml 
xhtml-1_1 xhtml5"
# Without catalog.xml
DBXSLT_FILES="VERSION VERSION.xsl"
# Without INSTALL
DBXSLT_DOCFILES="AUTHORS BUGS COPYING NEWS.html NEWS.xml README TODO \
RELEASE-NOTES.html RELEASE-NOTES.pdf RELEASE-NOTES.txt RELEASE-NOTES.xml"


#----------------------------------------------------------------------
# printing help / catching errors
#

if [[ -z "$1" ]]; then
  usage
  printvariables
  exit
fi

# datarootdir:,
longopt="help,debug,buildroot:,sourcedir:,\
package-name:,package-version:,\
bindir:,prefix:,datadir:,docdir:,sysconfdir:,\
skip-install-scripts,\
db-xslt-dir:,db-xsl-suffix:,catalog-dir:"

export POSIXLY_CORRECT=1
ARGS=$(getopt -o h,d -l $longopt -n $ME -- "$@")
eval set -- "$ARGS"
while true ; do
   case "$1" in
      -h|--help)
         usage
         # printvariables
         exit
         ;;
      -d|--debug)
         DEBUG_SCRIPT=1
         shift
         ;;
      #
      --sourcedir)
         SOURCEDIR=$2
         shift 2
         ;;
      #
      --package-name)
         PACKAGE=$2
         shift 2
         ;;
      #
      --package-version)
         PACKAGE_VERSION="$2"
         shift 2
         ;;
      #
      --buildroot)
         BUILDROOT=$2
         shift 2
         ;;
      --bindir)
         BINDIR=$2
         shift 2
         ;;
      --prefix)
         PREFIX=$2
         shift 2
         ;;
      #--datarootdir)
      #   DATAROOTDIR=$2
      #   shift 2
      #   ;;
      --datadir)
         DATADIR=$2
         shift 2
         ;;
      --docdir)
         DOCDIR=$2
         shift 2
         ;;
      --sysconfdir)
         SYSCONFDIR=$2
         shift 2
         ;;
      #
      --catalog-dir)
        XMLCATALOGDIR=$2
        shift 2
        ;;
      #
      --db-xslt-dir)
        DBSTYLE_DIR=$2
        shift 2
        ;;
      #
      --db-xsl-suffix)
        DB_XSL_SUFFIX=$2
        echo ">>>> $2"
        shift 2
        ;;
      --printvariables)
         printvariables
         exit 1
         ;;
      #
      --skip-install-scripts)
         INSTALL_SCRIPTS=1
         shift
         ;;
      --)
         break
         ;;
   esac
done
unset POSIXLY_CORRECT

PREFIX=$BUILDROOT$PREFIX
BINDIR=$BUILDROOT$BINDIR
DATADIR=$PREFIX/$DATADIR
DOCDIR=$PREFIX/$DOCDIR
XMLDIR=$PREFIX/$XMLDIR
XSLTROOTDIR=$PREFIX$XSLTROOTDIR
DBSTYLE_DIR=$PREFIX/$DB_XSL_ROOTDIR/$DB_XSL_SUFFIX
#
SYSCONFDIR=$BUILDROOT$SYSCONFDIR
XMLCONFDIR=$BUILDROOT$XMLCONFDIR
XMLCATALOGDIR=$BUILDROOT$XMLCATALOGDIR
# DBSTYLE_CATALOG=$BUILDROOT$DBSTYLE_CATALOG
DBSTYLE_CATALOG=$XMLCATALOGDIR/$PACKAGE.xml

printvariables

# exit 1

# Consistency check
[[ -z $SOURCEDIR ]] && exit_on_error "Source directory not set. Use --sourcedir 
DIRECTORY"

# exit 100


#----------------------------------------------------------------------
#
#
function create_directory_structure() {
   local i
   my_debug "\n\n=== Create directory structure ==="
   for i in $PREFIX $BINDIR $DATADIR $XMLCATALOGDIR \
            $DOCDIR/$PACKAGE/html $DBSTYLE_DIR/$PACKAGE_VERSION; do
      mkdir ${DEBUG_SCRIPT:+-v} -p $i
      [[ $? -ne 0 ]] && exit_on_error "Could not create $i directory"
   done
}


#----------------------------------------------------------------------
#
#
function install_dbxsltdirs() {
   my_debug "\n\n=== Install all DocBook XSL stylesheet directories ==="

   for dir in $DBXSLT_DIRS; do
     my_debug "Copy directory $dir..."
     cp -a $SOURCEDIR/$dir $DBSTYLE_DIR/$PACKAGE_VERSION
   done
}

function install_scripts() {
   my_debug "\n\n=== Install scripts ==="

   install ${DEBUG_SCRIPT:+-v} -m755 $SOURCEDIR/fo/pdf2index       $BINDIR
   install ${DEBUG_SCRIPT:+-v} -m755 $SOURCEDIR/epub/bin/dbtoepub  $BINDIR
   # install ${DEBUG_SCRIPT:+-v} -m755 $SOURCEDIR/slides/images/callouts/gen.sh 
$BINDIR/callout-gen
   # rm fo/pdf2index epub/bin/dbtoepub slides/images/callouts/gen.sh
}

function install_dbxsltfiles() {
   my_debug "\n\n=== Install other files ==="

   for file in $DBXSLT_FILES; do
     my_debug "Copy $file..."
     cp -a $SOURCEDIR/$file $DBSTYLE_DIR/$PACKAGE_VERSION
   done
}

function install_dbxsltdocfiles() {
   my_debug "\n\n=== Install documentation ==="
   my_debug "    Current dir: $PWD"

   for file in $DBXSLT_DOCFILES; do
      cp ${DEBUG_SCRIPT:+-v} $SOURCEDIR/$file $DOCDIR/$PACKAGE
      # $DBSTYLE_DIR/$PACKAGE_VERSION
   done
}

function create_link() {
    my_debug "\n\n=== Create link ==="
    pushd $DBSTYLE_DIR
    ln ${DEBUG_SCRIPT:+-v} -s ${PACKAGE_VERSION} current
    popd
}

function create_dbxslt_catalog() {
   my_debug "\n\n=== Create catalog file ==="

   # /etc/xml/catalog.d/docbook-xsl-stylesheets.xml
   xmlcatalog --noout --create $DBSTYLE_CATALOG
}

function create_dbxslt_addentries() {
   my_debug "\n\n=== Create entries in the catalog file ==="

   DBSTYLE_DIR=$DB_XSL_ROOTDIR/$DB_XSL_SUFFIX
   # Don't be confused, see docbook-apps mailinglist
   local CDN4_XSL_URL="http://cdn.docbook.org/release/xsl-nons";
   local CDN5_XSL_URL="http://cdn.docbook.org/release/xsl";
   local DB4_XSL_URL="http://docbook.sourceforge.net/release/xsl/";
   local DB5_XSL_URL="http://docbook.sourceforge.net/release/xsl-ns/";

   local CDN_XSL_URL DB_XSL_URL
     
   CDN_XSL_URL=$CDN4_XSL_URL
   DB_XSL_URL=$DB4_XSL_URL
   
   # This is flaky and not ideal. :-(
   if [[ $DB_XSL_SUFFIX = "nwalsh5" ]]; then
        CDN_XSL_URL=$CDN5_XSL_URL
        DB_XSL_URL=$DB5_XSL_URL
   fi

   my_debug "Using URL=${DB_XSL_URL}"
   my_debug "Using URL=${CDN_XSL_URL}"
   my_debug "Using system path=${DBSTYLE_DIR}"
   
   # Create first the old DocBook SF identifiers:
   xmlcatalog --noout --add "rewriteSystem" \
      "${DB_XSL_URL}${PACKAGE_VERSION}" \
      "file://$SYS_DBSTYLE_DIR/${PACKAGE_VERSION}" $DBSTYLE_CATALOG
   xmlcatalog --noout --add "rewriteURI" \
      "${DB_XSL_URL}${PACKAGE_VERSION}" \
      "file://$SYS_DBSTYLE_DIR/$PACKAGE_VERSION" $DBSTYLE_CATALOG
   xmlcatalog --noout --add "rewriteSystem" \
      "${DB_XSL_URL}current" \
      "file://$SYS_DBSTYLE_DIR/current" $DBSTYLE_CATALOG
   xmlcatalog --noout --add "rewriteURI" \
      "${DB_XSL_URL}current" \
      "file://$SYS_DBSTYLE_DIR/current" $DBSTYLE_CATALOG
   # Create the new DocBook XSL identifier:
   xmlcatalog --noout --add "rewriteURI" \
      "${CDN_XSL_URL}/${PACKAGE_VERSION}" \
      "file://$SYS_DBSTYLE_DIR/${PACKAGE_VERSION}" $DBSTYLE_CATALOG
    xmlcatalog --noout --add "rewriteSystem" \
      "${CDN_XSL_URL}/${PACKAGE_VERSION}" \
      "file://$SYS_DBSTYLE_DIR/${PACKAGE_VERSION}" $DBSTYLE_CATALOG
    xmlcatalog --noout --add "rewriteURI" \
      "${CDN_XSL_URL}/current" \
      "file://$SYS_DBSTYLE_DIR/current" $DBSTYLE_CATALOG
    xmlcatalog --noout --add "rewriteSystem" \
      "${CDN_XSL_URL}/current" \
      "file://$SYS_DBSTYLE_DIR/current" $DBSTYLE_CATALOG
}


function cleanup_buildroot() {
   rm $DBSTYLE_DIR/$PACKAGE_VERSION/fo/pdf2index \
      $DBSTYLE_DIR/$PACKAGE_VERSION/epub/bin/dbtoepub \
      $DBSTYLE_DIR/$PACKAGE_VERSION/slides/images/callouts/gen.sh
}

#----------------------------------------------------------------------
# MAIN
#

[[ -e "$SOURCEDIR" ]] || exit_on_error "Could not find directory $SOURCEDIR"
#
#
create_directory_structure
install_dbxsltdirs
install_dbxsltfiles
[[ 0 -eq $INSTALL_SCRIPTS ]] && install_scripts

# install_dbxsltdocfiles
create_link
#
# create_dbxslt_catalog
# create_dbxslt_addentries
# cleanup_buildroot

my_debug "\n\n=== Finished script."

# EOF
++++++ docbook-xsl-dbtoepub.patch ++++++
diff -ur docbook-xsl-1.76.1.orig/epub/bin/dbtoepub 
docbook-xsl-1.76.1/epub/bin/dbtoepub
--- docbook-xsl-1.76.1.orig/epub/bin/dbtoepub   2010-09-13 23:59:41.000000000 
+0200
+++ docbook-xsl-1.76.1/epub/bin/dbtoepub        2011-04-12 09:43:49.000000000 
+0200
@@ -17,7 +17,7 @@
 #                                        layer (imports epub/docbook.xsl).
 #     -v, --verbose                    Make output verbose.
 
-lib = File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
+lib= '/usr/share/xml/docbook/stylesheet/nwalsh/current/epub/bin/lib'
 $LOAD_PATH.unshift(lib) if File.exist?(lib)
 
 require 'fileutils'
Nur in docbook-xsl-1.76.1/epub/bin: dbtoepub~.
++++++ docbook-xsl-non-recursive_string_subst.patch ++++++
Description: use EXSLT "replace" function when available
 A recursive implementation  of string.subst is problematic,
 long strings with many matches will cause stack overflows.
Author: Peter De Wachter <[email protected]>
Bug-Debian: https://bugs.debian.org/750593

Index: docbook-xsl-1.79.2/lib/lib.xsl
===================================================================
--- docbook-xsl-1.79.2.orig/lib/lib.xsl
+++ docbook-xsl-1.79.2/lib/lib.xsl
@@ -6,7 +6,11 @@
 
      This module implements DTD-independent functions
 
-     ******************************************************************** 
--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
+     ******************************************************************** -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                xmlns:str="http://exslt.org/strings";
+                exclude-result-prefixes="str"
+                version="1.0">
 
 <xsl:template name="dot.count">
   <!-- Returns the number of "." characters in a string -->
@@ -52,6 +56,9 @@
   <xsl:param name="replacement"/>
 
   <xsl:choose>
+    <xsl:when test="function-available('str:replace')">
+      <xsl:value-of select="str:replace($string, string($target), 
string($replacement))"/>
+    </xsl:when>
     <xsl:when test="contains($string, $target)">
       <xsl:variable name="rest">
         <xsl:call-template name="string.subst">
++++++ docbook-xsl-stylesheets.xml ++++++
<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" 
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <group id="docbook-xsl-stylesheets">
  <rewriteSystem 
systemIdStartString="http://docbook.sourceforge.net/release/xsl/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/@VERSION@"/>
  <rewriteURI 
uriStartString="http://docbook.sourceforge.net/release/xsl/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/@VERSION@"/>
  <rewriteSystem 
systemIdStartString="http://docbook.sourceforge.net/release/xsl/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/current"/>
  <rewriteURI 
uriStartString="http://docbook.sourceforge.net/release/xsl/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/current"/>
  <rewriteURI 
uriStartString="http://cdn.docbook.org/release/xsl-nons/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/@VERSION@"/>
  <rewriteSystem 
systemIdStartString="http://cdn.docbook.org/release/xsl-nons/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/@VERSION@"/>
  <rewriteURI uriStartString="http://cdn.docbook.org/release/xsl-nons/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/current"/>
  <rewriteSystem 
systemIdStartString="http://cdn.docbook.org/release/xsl-nons/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh/current"/>
  </group>
</catalog>
++++++ docbook5-xsl-stylesheets.xml ++++++
<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" 
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
 <group id="docbook5-xsl-stylesheets">
  <rewriteSystem 
systemIdStartString="http://docbook.sourceforge.net/release/xsl-ns/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/@VERSION@"/>
  <rewriteURI 
uriStartString="http://docbook.sourceforge.net/release/xsl-ns/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/@VERSION@"/>
  <rewriteSystem 
systemIdStartString="http://docbook.sourceforge.net/release/xsl-ns/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/current"/>
  <rewriteURI 
uriStartString="http://docbook.sourceforge.net/release/xsl-ns/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/current"/>
  <rewriteURI uriStartString="http://cdn.docbook.org/release/xsl/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/@VERSION@"/>
  <rewriteSystem 
systemIdStartString="http://cdn.docbook.org/release/xsl/@VERSION@"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/@VERSION@"/>
  <rewriteURI uriStartString="http://cdn.docbook.org/release/xsl/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/current"/>
  <rewriteSystem 
systemIdStartString="http://cdn.docbook.org/release/xsl/current"; 
rewritePrefix="file:///usr/share/xml/docbook/stylesheet/nwalsh5/current"/>
 </group>
</catalog>
++++++ xslnons-build ++++++
#!/usr/bin/perl -w -- #  -*- Perl -*-
#
#    xslns-build - generate a parallel set of DocBook5 namespaced 
#                  stylesheet directories from a directory of
#                  non-namespaced stylesheets.
#

my $Usage = "
USAGE:
  $0 input-dir output-dir

  where:
    input-dir  is the directory containing namespaced stylesheets
    output-dir is the destination for the non-namespaced stylesheets

  Note: an existing output-dir will be completely removed
        before creating new output.
";

#######################################################
# Modules to use
# 
use strict;
use IO::File;
use File::Basename;
use File::Path;
use File::Find;
use File::Copy;

#######################################################
# Global variables
# 
my $srcdir;
my $destdir;

my @dirlist;
my @passthru;
my @xslfiles;

# Regular expressions

# namespace name regexp
my $ns = "[A-Za-z]+";
# other names
my $n = "[A-Za-z][A-Za-z0-9]+";
# xml names
my $w = "[A-Za-z][-A-Za-z0-9._#]+";
# docbook element names (lowercase and numbers)
my $dbname = "[a-z][a-z0-9]+";

# Don't delete namespace to any xsl files in these directories
my @PassthruDirs = (
'extensions',
'profiling',
'images',
'tools',
'build',
'website',
'wordml',
);

# Don't remove namespace to these particular files
my @PassthruFiles = (
'html-rtf.xsl',
'html2xhtml.xsl',
'xsl2profile.xsl',
'olink.xsl',
'addns.xsl',
'stripns.xsl',
);

umask 002;

#######################################################
#   main
# 

# Get the source and output directories

$srcdir = $ARGV[0];
$destdir = $ARGV[1];

unless ( $srcdir ) {
  print "ERROR: must specify input directory of non-namespaced "
        . " stylesheets. Exiting.\n";
  die "$Usage\n";
}

unless ( -d $srcdir ) {
  print "ERROR: specified input directory does not exist. Exiting.\n";
  die "$Usage\n";
}

unless ( $destdir ) {
  print "ERROR: must specify output directory. Exiting.\n";
  die "$Usage\n";
  
}

# Remove any previous output completely

if ( -d $destdir) {
  print "Removing old output directory $destdir.\n";

  unless ( rmtree($destdir) ) {
    die "ERROR: cannot remove previous output directory. Exiting.\n";
  }
}

# Create new output directory.
print "Creating the output directory $destdir.\n";

unless ( mkpath($destdir)  ) {
  die "ERROR: cannot create output directory $destdir.\n";
}

copyDirectories($srcdir);

copyPassthru();

copyXsl();

addFiles();


#######################################################
# copyDirectories - create the output directories
# 
sub copyDirectories {

  my ($src) = @_;
  
  # populate @dirlist
  find(\&dirlist, $src );

  foreach my $d (@dirlist) {
    $d =~ s/$srcdir/$destdir/;
    print "$d\n";
    mkdir $d;
  }


}

#######################################################
# dirlist - list directories (used by find)
# 
sub dirlist {

  if ( -d $_  ) {
    push(@dirlist, $File::Find::name);
  }
}

#######################################################
# copyPassthru - copy non-XSL files to output
# 
sub copyPassthru {

  # populate @passthru
  find(\&passthruFiles, $srcdir );

  foreach my $f (@passthru) {
    my $dest = $f;
    $dest =~ s/$srcdir/$destdir/;
    print STDOUT "$f\n";
    copy ($f, $dest);
  }


}

#######################################################
# passthruFiles - list non-xsl files to copy
# 
sub passthruFiles {

  if ( -f $_ ) {
    unless ( /\.xsl$/ or /\.ent$/ ) {
      push(@passthru, $File::Find::name);
    }
  }
}

#######################################################
# copyXsl - copy XSL files to output, possibly filtering
# 
sub copyXsl {

  # populate @xslfiles
  find(\&xslFiles, $srcdir );

  foreach my $f (@xslfiles) {
    my $dest = $f;
    $dest =~ s/$srcdir/$destdir/;
    print STDOUT "$f\n";

    my $basename = basename $f;
    my $dirname = dirname $f;
    $dest =~ m|^$destdir/(.*?)/|;
    my $dir = $1;
    if ( grep /^$basename$/,@PassthruFiles ) {
      copy($f, $dest);
    }
    elsif ( grep /^$dir$/, @PassthruDirs ) {
      copy($f, $dest);
    }
    else {
      nsfilter($f, $dest);
    }
  }


}

#######################################################
# xslFiles - list xsl files to process
# 
sub xslFiles {

  if ( -f $_ ) {
    if ( /\.xsl$/ or /\.ent$/ ) {
      push(@xslfiles, $File::Find::name);
    }
  }
}

#######################################################
# nsfilter - delete namespace prefix to element names
# 
sub nsfilter {

  my ($infile, $outfile) = @_;
  
  # Open and read the whole file into $_ variable for parsing
  my $Filehandle = IO::File->new($infile)
      or die "Can't open file $infile $!\n";
  read ($Filehandle, $_, -s $infile);
  $Filehandle->close;
  
  my $Output = IO::File->new("> $outfile") 
     or die "Cannot write to output file $outfile.\n";
  
  # Set to autoflush 
  select($Output); $| = 1;
  
  # delete the docbook5 namespace declaration in root element
  
  s|xmlns:d="http://docbook.org/ns/docbook"\n?||s;
  
  # remove namespace d from exclude-result-prefixes
  # This version if only "d"
  s|\s*exclude-result-prefixes\s*=\s*"d"\s*| |s;
  # This version if d added to others at end
  s|(exclude-result-prefixes\s*=\s*".*?)\s+d"|$1"|s;
  # This version if d added at beginning 
  s|(exclude-result-prefixes\s*=\s*")d\s+(.*?")|$1$2|s;
  # This version if d added in middle
  s|(exclude-result-prefixes\s*=\s*".*?)\s+d\s+(.*?")|$1 $2|s;

  # Convert addNS to stripNS 
  s|href="../common/addns.xsl"|href="../common/stripns.xsl"|sg;
  
  s|addns\.xsl|stripns.xsl|sg;
  s|with\.namespace|no.namespace|sg;
  s|addNS|stripNS|sg;
  s|(namesp\.\s+)add|$1cut|sg;
  s|added namespace before|stripped namespace before|sg;
  s|(Unable to )add( the namespace from )DB4( document)|$1strip$2DB5$3|sg;

  # change namespace test from != to = 
  
s|(namespace-uri\(/\*\)\s*)!=(\s*['"]http://docbook.org/ns/docbook['"])|$1=$2|sg;

  # Set the db.prefix for template/titlepage.xsl
  s|(<xsl:variable name="db.prefix">)d:(</xsl:variable>)|$1$2|sg;
  
  # remove d: prefix to literal tocentry in maketoc.xsl
  if ($infile =~ /maketoc/) {
    s|d:(tocentry)|$1|sg;
  }

  # Process certain XSL attributes to remove d: namespace if needed
  # and output everything using this while loop.
  
  while ( 
/^(.*?)((match|select|test|count|from|use|elements)(\s*=\s*("|'))(.*?)(\5)|(select)(\s*=\s*("|'))(.*?)(\5))/sg
 ) {
  
    my $notname = $1;
    my $attname = $3;
    my $prefix =  $4;
    my $attvalue = $6;
    my $post = $7;
    my $rest = $';
    
    &filter($notname, $Output);

    print $Output $attname . $prefix;
    
    # parse the attribute value
    while ( $attvalue =~ /^(.*?)($ns:)($n)(.*$)/sg ) {
  
      # process the leading content which is not pass through
      &fixnamespace($1, $Output);
  
      if ( $2 eq 'd:' ) {
        print $Output $3;
        
      }
      else {
        print $Output $2;
        print $Output $3;
      }

      $attvalue = $4;    # and recurse
    }
  
    &fixnamespace($attvalue, $Output);
  
    print $Output $post;
  
    $_ = $rest;
  
  }
  
  # print the leftovers
  &filter($_, $Output);

  close $Output;

}


# fix any special case params like certain manpage params
# that put element names inside param string

sub filter {
  my ($string, $Output) = @_;

  # Fix up index ENTITY declarations
  $string = &indexentitydecl($string);
  
  while ( $string =~ m|^(.*?)(<xsl:param([^>]+[^/])>)(.*?)(</xsl:param>)|sg  ) {
    my $before = $1;
    my $starttag = $2;
    my $startstuff = $3;
    my $value =  $4;
    my $endtag = $5;
    my $rest = $';

    $startstuff =~ /name="(.*?)"/;
    my $pname = $1;

    print $Output $before;
    print $Output $starttag;

    # add namespace to elements inside these params
    if ( $pname =~ 
/(^refentry.manual.fallback.profile$|^refentry.source.fallback.profile$|^refentry.version.profile$|^refentry.date.profile$)/
 ) {

      # while ( $value =~ 
/^(.*?)(\$$w|$w\(|$ns:$n|$w:|db:$n|\@$n:$n|'.*?'|&$w;|\@$w|not \(|stringlength 
\(|normalize-space \()(.*$)/sg ) {

      while ( $value =~ /^(.*?)($ns:)($n)(.*$)/sg ) {
  
        # process the leading content which is not pass through
        &fixnamespace($1, $Output);
  
        if ( $2 eq 'd:' ) {
          print $Output $3;
        }
        else {
          print $Output $2;
          print $Output $3;
        }
        $value = $4;    # and recurse
      }
  
      &fixnamespace($value, $Output);
    }
    else {
      print $Output $value;
    }

    print $Output $endtag;

    $string = $rest;
    
  }

  print $Output $string;

}

sub indexentitydecl {
  my ($string) = @_;

  my $newstring = '';

  while ( $string =~ m@^(.*?)(<!ENTITY\s+([\w.]+)\s+('|"))(.*?)(\4\s*>)@sg  ) {
    my $before = $1;
    my $entitystart = $2;
    my $entityname = $3;
    my $value =  $5;
    my $entityend = $6;
    my $rest = $';

    $newstring .= $before;
    $newstring .= $entitystart;

    while ( $value =~ /^(.*?)($ns:)($n)(.*$)/sg ) {

      # process the leading content which is not pass through
      $newstring .= &namespacefilter($1);

      if ( $2 eq 'd:' ) {
        $newstring .= $3;
        
      }
      else {
        $newstring .= $2;
        $newstring .= $3;
      }

      $value = $4;    # and recurse

    }

    $newstring .= &namespacefilter($value);

    $newstring .= $entityend;

    $string = $rest;
    
  }

  $newstring .= $string;

  return $newstring;
}


# prints a filtered string to the designated output
sub fixnamespace {
  my ($string, $Output) = @_;

  my $newstring = &namespacefilter($string);
  print $Output $newstring;
}

# Returns a new string with namespace prefixes added
sub namespacefilter {

  my ($string) = @_;

  my $newstring = '';

  while ( $string =~ /^(.*?)d:($dbname)(.*$)/s ) {

    my $pre = $1;
    my $name = $2;
    my $rest = $3;

    $newstring .= $pre;

    # pass through XSL key words and mixed case names and olink elements
    if ( $name =~ 
/(^mod$|^div$|^and$|^or$|^ttl$|^xreftext$|^dir$|^id$|^sitemap$|^obj$|^document$|^exsl$|^.*[A-Z].*$)/
 ) {

      # pass this name through
      $newstring .= $name;
    }
    # pass through man template temporary elements
    elsif ( $name =~ 
/(^cell$|^notesource$|^bold$|^italic$|^div$|^p$|^substitution$)/ ) {

      # pass this name through
      $newstring .= $name;
    }
    # pass through references to man temporary elements
    elsif ( $name =~ /(^date$|^title$|^manual$|^source$)/ and $pre =~ 
/refentry\.metadata/ ) {

      # pass this name through
      $newstring .= $name;
    }
    # Pass through if preceded or followed by uppercase letters
    elsif ($pre =~ /[-._A-Z]$/ || $rest =~ /^[-._A-Z]/) {
      $newstring .= "d:" . $name;
    }
    else {
      # remove the namespace prefix
      $newstring .= $name;
    }

    $string = $rest;
  }

  # print any leftovers
  $newstring .= $string;

  return $newstring;
}


#######################################################
# addFiles - add some new files to db5xsl
# 
sub addFiles {
  my $miscdir = dirname $0;
  $miscdir .= '/xslnsfiles';
  print STDOUT "miscdir is $miscdir" . "\n";
  # copy("$miscdir/manpages.table.xsl", "$destdir/manpages/table.xsl");
  # copy("$miscdir/titlepage.xsl", "$destdir/template/titlepage.xsl");
  # Copy the ns VERSION file, not the copy from non-ns
  copy("$destdir/VERSION", "$destdir/VERSION.xsl");

  # delete these obsolete files.

  # Replace stripns.xsl with addns.xsl in profiling module
  &nsfilter("$srcdir/profiling/profile.xsl", "$destdir/profiling/profile.xsl");
}

Reply via email to