Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
Index: docbook-xml/4.x/Makefile
===================================================================
--- docbook-xml/4.x/Makefile	(nonexistent)
+++ docbook-xml/4.x/Makefile	(revision 119)
@@ -0,0 +1,56 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../../../build-system/constants.mk
+
+
+url         = $(DOWNLOAD_SERVER)/sources/packages/a/linuxdoc-tools/docbook-xml/4.x
+
+versions    = 4.5
+pkgname     = docbook-xml
+suffix      = tar.xz
+
+tarballs    = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s       = $(addsuffix .sha1sum, $(tarballs))
+
+patches     = $(CURDIR)/patches/docbook-xml-4.5-isogrk4.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+	@echo -e "\n======= Downloading source tarballs =======" ; \
+	 for tarball in $(tarballs) ; do \
+	   echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+	 done ; wait
+
+$(sha1s): $(tarballs)
+	@for sha in $@ ; do \
+	   echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+	   echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+	   touch $$sha ; \
+	   echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+	   sha1sum --check $$sha ; ret="$$?" ; \
+	   if [ "$$ret" == "1" ]; then \
+	     echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+	     exit 1 ; \
+	   fi ; \
+	 done
+
+$(patches): $(sha1s)
+	@echo -e "\n======= Create Patches =======\n" ; \
+	 ( cd create-4.5-isogrk4-patch ; ./create.patch.sh ) ; \
+	 echo -e "\n"
+
+download_clean:
+	@rm -f $(tarballs) $(sha1s) $(patches)
Index: docbook-xml/4.x/create-4.5-isogrk4-patch/create.patch.sh
===================================================================
--- docbook-xml/4.x/create-4.5-isogrk4-patch/create.patch.sh	(nonexistent)
+++ docbook-xml/4.x/create-4.5-isogrk4-patch/create.patch.sh	(revision 119)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=4.5
+
+tar --files-from=file.list -xJvf ../docbook-xml-$VERSION.tar.xz
+mv docbook-xml-$VERSION docbook-xml-$VERSION-orig
+
+cp -rf ./docbook-xml-$VERSION-new ./docbook-xml-$VERSION
+
+diff --unified -Nr  docbook-xml-$VERSION-orig docbook-xml-$VERSION > docbook-xml-$VERSION-isogrk4.patch
+
+mv docbook-xml-$VERSION-isogrk4.patch ../patches
+
+rm -rf ./docbook-xml-$VERSION
+rm -rf ./docbook-xml-$VERSION-orig

Property changes on: docbook-xml/4.x/create-4.5-isogrk4-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: docbook-xml/4.x/create-4.5-isogrk4-patch/docbook-xml-4.5-new/ent/isogrk4.ent
===================================================================
--- docbook-xml/4.x/create-4.5-isogrk4-patch/docbook-xml-4.5-new/ent/isogrk4.ent	(nonexistent)
+++ docbook-xml/4.x/create-4.5-isogrk4-patch/docbook-xml-4.5-new/ent/isogrk4.ent	(revision 119)
@@ -0,0 +1,84 @@
+
+<!--
+     File isogrk4.ent produced by the XSL script entities.xsl
+     from input data in unicode.xml.
+
+     Please report any errors to David Carlisle
+     via the public W3C list www-math@w3.org.
+
+     The numeric character values assigned to each entity
+     (should) match the Unicode assignments in Unicode 4.0.
+
+     Entity names in this file are derived from files carrying the
+     following notice:
+
+     (C) International Organization for Standardization 1986
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+
+-->
+
+
+<!-- 
+     Version: $Id: isogrk4.ent,v 1.2 2003/12/08 15:14:43 davidc Exp $
+
+       Public identifier: ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML
+       System identifier: http://www.w3.org/2003/entities/iso8879/isogrk4.ent
+
+     The public identifier should always be used verbatim.
+     The system identifier may be changed to suit local requirements.
+
+     Typical invocation:
+
+       <!ENTITY % isogrk4 PUBLIC
+         "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML"
+         "http://www.w3.org/2003/entities/iso8879/isogrk4.ent"
+       >
+       %isogrk4;
+
+-->
+
+<!ENTITY b.alpha	"&#x03B1;"> <!--  -->
+<!ENTITY b.beta	"&#x03B2;"> <!-- GREEK SMALL LETTER BETA -->
+<!ENTITY b.gamma	"&#x03B3;"> <!-- GREEK SMALL LETTER GAMMA -->
+<!ENTITY b.Gamma	"&#x0393;"> <!-- GREEK CAPITAL LETTER GAMMA -->
+<!ENTITY b.gammad	"&#x03DC;"> <!-- GREEK LETTER DIGAMMA -->
+<!ENTITY b.delta	"&#x03B4;"> <!-- GREEK SMALL LETTER DELTA -->
+<!ENTITY b.Delta	"&#x0394;"> <!-- GREEK CAPITAL LETTER DELTA -->
+<!ENTITY b.epsi	"&#x03B5;"> <!--  -->
+<!ENTITY b.epsiv	"&#x03B5;"> <!--  -->
+<!ENTITY b.epsis	"&#x03B5;"> <!--  -->
+<!ENTITY b.zeta	"&#x03B6;"> <!-- GREEK SMALL LETTER ZETA -->
+<!ENTITY b.eta	"&#x03B7;"> <!-- GREEK SMALL LETTER ETA -->
+<!ENTITY b.thetas	"&#x03B8;"> <!--  -->
+<!ENTITY b.Theta	"&#x0398;"> <!-- GREEK CAPITAL LETTER THETA -->
+<!ENTITY b.thetav	"&#x03D1;"> <!--  -->
+<!ENTITY b.iota	"&#x03B9;"> <!-- GREEK SMALL LETTER IOTA -->
+<!ENTITY b.kappa	"&#x03BA;"> <!-- GREEK SMALL LETTER KAPPA -->
+<!ENTITY b.kappav	"&#x03F0;"> <!-- GREEK KAPPA SYMBOL -->
+<!ENTITY b.lambda	"&#x03BB;"> <!-- GREEK SMALL LETTER LAMDA -->
+<!ENTITY b.Lambda	"&#x039B;"> <!-- GREEK CAPITAL LETTER LAMDA -->
+<!ENTITY b.mu	"&#x03BC;"> <!-- GREEK SMALL LETTER MU -->
+<!ENTITY b.nu	"&#x03BD;"> <!-- GREEK SMALL LETTER NU -->
+<!ENTITY b.xi	"&#x03BE;"> <!-- GREEK SMALL LETTER XI -->
+<!ENTITY b.Xi	"&#x039E;"> <!-- GREEK CAPITAL LETTER XI -->
+<!ENTITY b.pi	"&#x03C0;"> <!-- GREEK SMALL LETTER PI -->
+<!ENTITY b.Pi	"&#x03A0;"> <!-- GREEK CAPITAL LETTER PI -->
+<!ENTITY b.piv	"&#x03D6;"> <!-- GREEK PI SYMBOL -->
+<!ENTITY b.rho	"&#x03C1;"> <!-- GREEK SMALL LETTER RHO -->
+<!ENTITY b.rhov	"&#x03F1;"> <!-- GREEK RHO SYMBOL -->
+<!ENTITY b.sigma	"&#x03C3;"> <!-- GREEK SMALL LETTER SIGMA -->
+<!ENTITY b.Sigma	"&#x03A3;"> <!-- GREEK CAPITAL LETTER SIGMA -->
+<!ENTITY b.sigmav	"&#x03C2;"> <!--  -->
+<!ENTITY b.tau	"&#x03C4;"> <!-- GREEK SMALL LETTER TAU -->
+<!ENTITY b.upsi	"&#x03C5;"> <!-- GREEK SMALL LETTER UPSILON -->
+<!ENTITY b.Upsi	"&#x03D2;"> <!--  -->
+<!ENTITY b.phis	"&#x03C6;"> <!-- GREEK SMALL LETTER PHI -->
+<!ENTITY b.Phi	"&#x03A6;"> <!-- GREEK CAPITAL LETTER PHI -->
+<!ENTITY b.phiv	"&#x03D5;"> <!-- GREEK PHI SYMBOL -->
+<!ENTITY b.chi	"&#x03C7;"> <!-- GREEK SMALL LETTER CHI -->
+<!ENTITY b.psi	"&#x03C8;"> <!-- GREEK SMALL LETTER PSI -->
+<!ENTITY b.Psi	"&#x03A8;"> <!-- GREEK CAPITAL LETTER PSI -->
+<!ENTITY b.omega	"&#x03C9;"> <!-- GREEK SMALL LETTER OMEGA -->
+<!ENTITY b.Omega	"&#x03A9;"> <!-- GREEK CAPITAL LETTER OMEGA -->
Index: docbook-xml/4.x/create-4.5-isogrk4-patch/file.list
===================================================================
--- docbook-xml/4.x/create-4.5-isogrk4-patch/file.list	(nonexistent)
+++ docbook-xml/4.x/create-4.5-isogrk4-patch/file.list	(revision 119)
@@ -0,0 +1 @@
+docbook-xml-4.5/ent/isogrk4.ent
Index: docbook-xml/4.x/patches/README
===================================================================
--- docbook-xml/4.x/patches/README	(nonexistent)
+++ docbook-xml/4.x/patches/README	(revision 119)
@@ -0,0 +1,6 @@
+
+/* begin *
+
+   TODO: Leave some comment here.
+
+ * end */
Index: docbook-xml/4.x/patches
===================================================================
--- docbook-xml/4.x/patches	(nonexistent)
+++ docbook-xml/4.x/patches	(revision 119)

Property changes on: docbook-xml/4.x/patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,74 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.rk358x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: docbook-xml/4.x
===================================================================
--- docbook-xml/4.x	(nonexistent)
+++ docbook-xml/4.x	(revision 119)

Property changes on: docbook-xml/4.x
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,74 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.rk358x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: docbook-xml/Makefile
===================================================================
--- docbook-xml/Makefile	(nonexistent)
+++ docbook-xml/Makefile	(revision 119)
@@ -0,0 +1,13 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+SOURCE_REQUIRES += ALL_DIRS
+
+
+include ../../../../../build-system/core.mk
+
+
+download_clean:
+	@true
+
+.PHONY: download_clean
Index: docbook-xml
===================================================================
--- docbook-xml	(nonexistent)
+++ docbook-xml	(revision 119)

Property changes on: docbook-xml
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,74 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.rk358x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: docbook-xsl/Makefile
===================================================================
--- docbook-xsl/Makefile	(nonexistent)
+++ docbook-xsl/Makefile	(revision 119)
@@ -0,0 +1,56 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../../build-system/constants.mk
+
+
+url         = $(DOWNLOAD_SERVER)/sources/packages/a/linuxdoc-tools/docbook-xsl
+
+versions    = 1.79.1
+pkgname     = docbook-xsl
+suffix      = tar.bz2
+
+tarballs    = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s       = $(addsuffix .sha1sum, $(tarballs))
+
+patches     = $(CURDIR)/patches/docbook-xsl-1.79.1-stylesheets.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+	@echo -e "\n======= Downloading source tarballs =======" ; \
+	 for tarball in $(tarballs) ; do \
+	   echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+	 done ; wait
+
+$(sha1s): $(tarballs)
+	@for sha in $@ ; do \
+	   echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+	   echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+	   touch $$sha ; \
+	   echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+	   sha1sum --check $$sha ; ret="$$?" ; \
+	   if [ "$$ret" == "1" ]; then \
+	     echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+	     exit 1 ; \
+	   fi ; \
+	 done
+
+$(patches): $(sha1s)
+	@echo -e "\n======= Create Patches =======\n" ; \
+	 ( cd create-1.79.1-stylesheets-patch ; ./create.patch.sh ) ; \
+	 echo -e "\n"
+
+download_clean:
+	@rm -f $(tarballs) $(sha1s) $(patches)
Index: docbook-xsl/create-1.79.1-stylesheets-patch/create.patch.sh
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/create.patch.sh	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/create.patch.sh	(revision 119)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=1.79.1
+
+tar --files-from=file.list -xjvf ../docbook-xsl-$VERSION.tar.bz2
+mv docbook-xsl-$VERSION docbook-xsl-$VERSION-orig
+
+cp -rf ./docbook-xsl-$VERSION-new ./docbook-xsl-$VERSION
+
+diff --unified -Nr  docbook-xsl-$VERSION-orig docbook-xsl-$VERSION > docbook-xsl-$VERSION-stylesheets.patch
+
+mv docbook-xsl-$VERSION-stylesheets.patch ../patches
+
+rm -rf ./docbook-xsl-$VERSION
+rm -rf ./docbook-xsl-$VERSION-orig

Property changes on: docbook-xsl/create-1.79.1-stylesheets-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/Makefile.install
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/Makefile.install	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/Makefile.install	(revision 119)
@@ -0,0 +1,52 @@
+
+all: install
+
+install: install-xsl install-img install-extensions install-misc install-epub
+
+install-xsl:
+	@mkdir -pm755 $(DESTDIR)/{common,eclipse,fo,html,htmlhelp/doc,javahelp,lib,template,xhtml,xhtml-1_1,manpages,profiling,highlighting,roundtrip,website}
+	@cp common/*.dtd $(DESTDIR)/common/
+	@cp common/*.ent $(DESTDIR)/common/
+	@cp common/*.xml $(DESTDIR)/common/
+	@cp common/*.xsl $(DESTDIR)/common/
+	@cp eclipse/*.xsl $(DESTDIR)/eclipse/
+	@cp fo/*.xml $(DESTDIR)/fo/
+	@cp fo/*.xsl $(DESTDIR)/fo/
+	@cp html/*.xml $(DESTDIR)/html/
+	@cp html/*.xsl $(DESTDIR)/html/
+	@cp htmlhelp/*.xsl $(DESTDIR)/htmlhelp/
+	@cp javahelp/*.xsl $(DESTDIR)/javahelp/
+	@cp lib/*.xsl $(DESTDIR)/lib/
+	@cp template/*.xsl $(DESTDIR)/template/
+	@cp xhtml/*.xsl $(DESTDIR)/xhtml/
+	@cp xhtml-1_1/*.xsl $(DESTDIR)/xhtml-1_1/
+	@cp manpages/*.xsl $(DESTDIR)/manpages/
+	@cp profiling/*.xsl $(DESTDIR)/profiling/
+	@cp highlighting/*.xml $(DESTDIR)/highlighting/
+	@cp highlighting/*.xsl $(DESTDIR)/highlighting/
+	@cp roundtrip/*.xml $(DESTDIR)/roundtrip/
+	@cp roundtrip/*.xsl $(DESTDIR)/roundtrip/
+	@cp roundtrip/*.dtd $(DESTDIR)/roundtrip/
+	@cp website/*.xsl $(DESTDIR)/website/
+
+install-img:
+	@mkdir -pm755 $(DESTDIR)/images/{callouts,colorsvg}
+	@cp images/*.gif $(DESTDIR)/images
+	@cp images/*.png $(DESTDIR)/images
+	@cp images/*.svg $(DESTDIR)/images
+	@cp images/callouts/*.png $(DESTDIR)/images/callouts/
+	@cp images/callouts/*.gif $(DESTDIR)/images/callouts/
+	@cp images/callouts/*.svg $(DESTDIR)/images/callouts/
+	@cp images/colorsvg/*.svg $(DESTDIR)/images/colorsvg/
+
+install-extensions:
+	@mkdir -pm755 $(DESTDIR)/extensions
+	@cp -r extensions/* $(DESTDIR)/extensions/
+
+install-epub:
+	@mkdir -pm755 $(DESTDIR)/epub
+	@cp -r epub/* ${DESTDIR}/epub/
+
+install-misc:
+	@mkdir -pm755 $(DESTDIR)
+	@cp VERSION $(DESTDIR)
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/autoidx.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/autoidx.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/autoidx.xsl	(revision 119)
@@ -0,0 +1,1406 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY % common.entities SYSTEM "../common/entities.ent">
+%common.entities;
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rx="http://www.renderx.com/XSL/Extensions"
+                xmlns:xlink='http://www.w3.org/1999/xlink'
+                xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
+                xmlns:exslt="http://exslt.org/common"
+                extension-element-prefixes="exslt"
+                exclude-result-prefixes="exslt"
+                version="1.0">
+
+<!-- ********************************************************************
+     $Id: autoidx.xsl 9856 2014-01-20 22:42:16Z bobstayton $
+     ********************************************************************
+
+     This file is part of the DocBook XSL Stylesheet distribution.
+     See ../README or http://docbook.sf.net/ for copyright
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+<!-- The "basic" method derived from Jeni Tennison's work. -->
+<!-- The "kosek" method contributed by Jirka Kosek. -->
+<!-- The "kimber" method contributed by Eliot Kimber of Innodata Isogen. -->
+
+<!-- Importing module for kimber or kosek method overrides one of these -->
+<xsl:param name="kimber.imported" select="0"/>
+<xsl:param name="kosek.imported" select="0"/>
+
+<!-- These keys used primary in all methods -->
+<xsl:key name="letter"
+         match="indexterm"
+         use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
+
+<xsl:key name="primary"
+         match="indexterm"
+         use="&primary;"/>
+
+<xsl:key name="primaryonly"
+         match="indexterm"
+         use="normalize-space(primary)"/>
+
+<xsl:key name="secondary"
+         match="indexterm"
+         use="concat(&primary;, &sep;, &secondary;)"/>
+
+<xsl:key name="tertiary"
+         match="indexterm"
+         use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+
+<xsl:key name="endofrange"
+         match="indexterm[@class='endofrange']"
+         use="@startref"/>
+
+<xsl:key name="see-also"
+         match="indexterm[seealso]"
+         use="concat(&primary;, &sep;, 
+                     &secondary;, &sep;, 
+                     &tertiary;, &sep;, seealso)"/>
+
+<xsl:key name="see"
+         match="indexterm[see]"
+         use="concat(&primary;, &sep;, 
+                     &secondary;, &sep;, 
+                     &tertiary;, &sep;, see)"/>
+
+
+<xsl:template name="generate-index">
+  <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+
+  <xsl:choose>
+    <xsl:when test="$index.method = 'kosek'">
+      <xsl:call-template name="generate-kosek-index">
+        <xsl:with-param name="scope" select="$scope"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$index.method = 'kimber'">
+      <xsl:call-template name="generate-kimber-index">
+        <xsl:with-param name="scope" select="$scope"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:call-template name="generate-basic-index">
+        <xsl:with-param name="scope" select="$scope"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+      
+<xsl:template name="generate-basic-index">
+  <xsl:param name="scope" select="NOTANODE"/>
+
+  <xsl:variable name="role">
+    <xsl:if test="$index.on.role != 0">
+      <xsl:value-of select="@role"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="type">
+    <xsl:if test="$index.on.type != 0">
+      <xsl:value-of select="@type"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="terms"
+                select="//indexterm
+                        [count(.|key('letter',
+                          translate(substring(&primary;, 1, 1),
+                             &lowercase;,
+                             &uppercase;))
+                          [&scope;][1]) = 1
+                          and not(@class = 'endofrange')]"/>
+
+  <xsl:variable name="alphabetical"
+                select="$terms[contains(concat(&lowercase;, &uppercase;),
+                                        substring(&primary;, 1, 1))]"/>
+
+  <xsl:variable name="others" select="$terms[not(contains(
+                                        concat(&lowercase;,
+                                        &uppercase;),
+                                        substring(&primary;, 1, 1)))]"/>
+  <fo:block>
+    <xsl:if test="$others">
+      <xsl:call-template name="indexdiv.title">
+        <xsl:with-param name="titlecontent">
+          <xsl:call-template name="gentext">
+            <xsl:with-param name="key" select="'index symbols'"/>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+
+      <fo:block>
+        <xsl:apply-templates select="$others[count(.|key('primary',
+                                     &primary;)[&scope;][1]) = 1]"
+                             mode="index-symbol-div">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(&primary;, &lowercase;, 
+                            &uppercase;)"/>
+        </xsl:apply-templates>
+      </fo:block>
+    </xsl:if>
+
+    <xsl:apply-templates select="$alphabetical[count(.|key('letter',
+                                 translate(substring(&primary;, 1, 1),
+                                           &lowercase;,&uppercase;))
+                                           [&scope;][1]) = 1]"
+                         mode="index-div-basic">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+  </fo:block>
+</xsl:template>
+
+<!-- This template not used if fo/autoidx-kosek.xsl is imported -->
+<xsl:template name="generate-kosek-index">
+  <xsl:param name="scope" select="NOTANODE"/>
+
+  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
+  <xsl:if test="contains($vendor, 'libxslt')">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
+      <xsl:text>work with the xsltproc XSLT processor.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+
+  <xsl:if test="$exsl.node.set.available = 0">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
+      <xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
+      <xsl:text>has it, or use a different index method.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:if test="$kosek.imported = 0">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kosek' index method requires the&#xA;</xsl:text>
+      <xsl:text>kosek index extensions be imported:&#xA;</xsl:text>
+      <xsl:text>  xsl:import href="fo/autoidx-kosek.xsl"</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+</xsl:template>
+
+
+<!-- This template not used if fo/autoidx-kimber.xsl is imported -->
+<xsl:template name="generate-kimber-index">
+  <xsl:param name="scope" select="NOTANODE"/>
+
+  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
+  <xsl:if test="not(contains($vendor, 'SAXON '))">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kimber' index method requires the </xsl:text>
+      <xsl:text>Saxon version 6 or 8 XSLT processor.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:if test="$kimber.imported = 0">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kimber' index method requires the&#xA;</xsl:text>
+      <xsl:text>kimber index extensions be imported:&#xA;</xsl:text>
+      <xsl:text>  xsl:import href="fo/autoidx-kimber.xsl"</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-div-basic">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key"
+                select="translate(substring(&primary;, 1, 1),
+                         &lowercase;,&uppercase;)"/>
+
+  <xsl:if test="key('letter', $key)[&scope;]
+                [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
+    <fo:block>
+      <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
+        <xsl:call-template name="indexdiv.title">
+          <xsl:with-param name="titlecontent">
+            <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:block xsl:use-attribute-sets="index.entry.properties">
+        <xsl:apply-templates select="key('letter', $key)[&scope;]
+                                     [count(.|key('primary', &primary;)
+                                     [&scope;][1])=1]"
+                             mode="index-primary">
+          <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+        </xsl:apply-templates>
+      </fo:block>
+    </fo:block>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-symbol-div">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key"
+                select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
+
+  <fo:block xsl:use-attribute-sets="index.entry.properties">
+    <xsl:apply-templates select="key('letter', $key)[&scope;][count(.|key('primary', &primary;)[&scope;][1]) = 1]"
+                         mode="index-primary">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-primary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="&primary;"/>
+  <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
+
+  <xsl:variable name="term.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.term.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="range.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.range.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="number.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.number.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <fo:block>
+    <xsl:if test="$autolink.index.see != 0">
+      <xsl:attribute name="id">
+        <xsl:text>ientry-</xsl:text>
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="$axf.extensions != 0">
+      <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
+    </xsl:if>
+
+    <xsl:for-each select="$refs/primary">
+      <xsl:if test="@id or @xml:id">
+        <fo:inline id="{(@id|@xml:id)[1]}"/>
+      </xsl:if>
+    </xsl:for-each>
+
+    <xsl:value-of select="primary"/>
+
+    <xsl:choose>
+      <xsl:when test="$xep.extensions != 0">
+        <xsl:if test="$refs[not(see) and not(secondary)]">
+          <xsl:copy-of select="$term.separator"/>
+          <xsl:variable name="primary" select="&primary;"/>
+          <xsl:variable name="primary.significant" select="concat(&primary;, $significant.flag)"/>
+          <rx:page-index list-separator="{$number.separator}"
+                         range-separator="{$range.separator}">
+            <xsl:if test="$refs[@significance='preferred'][not(see) and not(secondary)]">
+              <rx:index-item xsl:use-attribute-sets="index.preferred.page.properties xep.index.item.properties"
+                ref-key="{$primary.significant}"/>
+            </xsl:if>
+            <xsl:if test="$refs[not(@significance) or @significance!='preferred'][not(see) and not(secondary)]">
+              <rx:index-item xsl:use-attribute-sets="xep.index.item.properties"
+                ref-key="{$primary}"/>
+            </xsl:if>
+          </rx:page-index>        
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="page-number-citations">
+          <xsl:for-each select="$refs[not(see) 
+                                and not(secondary)]">
+            <xsl:apply-templates select="." mode="reference">
+              <xsl:with-param name="scope" select="$scope"/>
+              <xsl:with-param name="role" select="$role"/>
+              <xsl:with-param name="type" select="$type"/>
+              <xsl:with-param name="position" select="position()"/>
+            </xsl:apply-templates>
+          </xsl:for-each>
+        </xsl:variable>
+
+        <xsl:copy-of select="$page-number-citations"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs[not(secondary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+         <xsl:with-param name="scope" select="$scope"/>
+         <xsl:with-param name="role" select="$role"/>
+         <xsl:with-param name="type" select="$type"/>
+         <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+
+  </fo:block>
+
+  <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
+    <fo:block start-indent="1pc">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
+                           mode="index-seealso">
+         <xsl:with-param name="scope" select="$scope"/>
+         <xsl:with-param name="role" select="$role"/>
+         <xsl:with-param name="type" select="$type"/>
+         <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+      <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
+                           mode="index-secondary">
+       <xsl:with-param name="scope" select="$scope"/>
+       <xsl:with-param name="role" select="$role"/>
+       <xsl:with-param name="type" select="$type"/>
+       <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </fo:block>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-secondary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
+  <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
+
+  <xsl:variable name="term.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.term.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="range.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.range.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="number.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.number.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <fo:block>
+    <xsl:if test="$axf.extensions != 0">
+      <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
+    </xsl:if>
+
+    <xsl:for-each select="$refs/secondary">
+      <xsl:if test="@id or @xml:id">
+        <fo:inline id="{(@id|@xml:id)[1]}"/>
+      </xsl:if>
+    </xsl:for-each>
+
+    <xsl:value-of select="secondary"/>
+
+    <xsl:choose>
+      <xsl:when test="$xep.extensions != 0">
+        <xsl:if test="$refs[not(see) and not(tertiary)]">
+          <xsl:copy-of select="$term.separator"/>
+          <xsl:variable name="primary" select="&primary;"/>
+          <xsl:variable name="secondary" select="&secondary;"/>
+          <xsl:variable name="primary.significant" select="concat(&primary;, $significant.flag)"/>
+          <rx:page-index list-separator="{$number.separator}"
+                         range-separator="{$range.separator}">
+            <xsl:if test="$refs[@significance='preferred'][not(see) and not(tertiary)]">
+              <rx:index-item xsl:use-attribute-sets="index.preferred.page.properties xep.index.item.properties">
+                <xsl:attribute name="ref-key">
+                  <xsl:value-of select="$primary.significant"/>
+                  <xsl:text>, </xsl:text>
+                  <xsl:value-of select="$secondary"/>
+                </xsl:attribute>
+              </rx:index-item>
+            </xsl:if>
+            <xsl:if test="$refs[not(@significance) or @significance!='preferred'][not(see) and not(tertiary)]">
+              <rx:index-item xsl:use-attribute-sets="xep.index.item.properties">
+                <xsl:attribute name="ref-key">
+                  <xsl:value-of select="$primary"/>
+                  <xsl:text>, </xsl:text>
+                  <xsl:value-of select="$secondary"/>
+                </xsl:attribute>
+              </rx:index-item>
+            </xsl:if>
+          </rx:page-index>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="page-number-citations">
+          <xsl:for-each select="$refs[not(see) 
+                                and not(tertiary)]">
+            <xsl:apply-templates select="." mode="reference">
+              <xsl:with-param name="scope" select="$scope"/>
+              <xsl:with-param name="role" select="$role"/>
+              <xsl:with-param name="type" select="$type"/>
+              <xsl:with-param name="position" select="position()"/>
+            </xsl:apply-templates>
+          </xsl:for-each>
+        </xsl:variable>
+
+        <xsl:copy-of select="$page-number-citations"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs[not(tertiary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+
+  </fo:block>
+
+  <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
+    <fo:block start-indent="2pc">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
+                           mode="index-seealso">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+      <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]" 
+                           mode="index-tertiary">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </fo:block>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-tertiary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+  <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
+
+  <xsl:variable name="term.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.term.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="range.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.range.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="number.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.number.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <fo:block>
+    <xsl:if test="$axf.extensions != 0">
+      <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
+    </xsl:if>
+
+    <xsl:for-each select="$refs/tertiary">
+      <xsl:if test="@id or @xml:id">
+        <fo:inline id="{(@id|@xml:id)[1]}"/>
+      </xsl:if>
+    </xsl:for-each>
+
+    <xsl:value-of select="tertiary"/>
+
+    <xsl:choose>
+      <xsl:when test="$xep.extensions != 0">
+        <xsl:if test="$refs[not(see)]">
+          <xsl:copy-of select="$term.separator"/>
+          <xsl:variable name="primary" select="&primary;"/>
+          <xsl:variable name="secondary" select="&secondary;"/>
+          <xsl:variable name="tertiary" select="&tertiary;"/>
+          <xsl:variable name="primary.significant" select="concat(&primary;, $significant.flag)"/>
+          <rx:page-index list-separator="{$number.separator}"
+                         range-separator="{$range.separator}">
+            <xsl:if test="$refs[@significance='preferred'][not(see)]">
+              <rx:index-item xsl:use-attribute-sets="index.preferred.page.properties xep.index.item.properties">
+                <xsl:attribute name="ref-key">
+                  <xsl:value-of select="$primary.significant"/>
+                  <xsl:text>, </xsl:text>
+                  <xsl:value-of select="$secondary"/>
+                  <xsl:text>, </xsl:text>
+                  <xsl:value-of select="$tertiary"/>
+                </xsl:attribute>
+              </rx:index-item>
+            </xsl:if>
+            <xsl:if test="$refs[not(@significance) or @significance!='preferred'][not(see)]">
+              <rx:index-item xsl:use-attribute-sets="xep.index.item.properties">
+                <xsl:attribute name="ref-key">
+                  <xsl:value-of select="$primary"/>
+                  <xsl:text>, </xsl:text>
+                  <xsl:value-of select="$secondary"/>
+                  <xsl:text>, </xsl:text>
+                  <xsl:value-of select="$tertiary"/>
+                </xsl:attribute>
+              </rx:index-item>
+            </xsl:if>
+          </rx:page-index>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="page-number-citations">
+          <xsl:for-each select="$refs[not(see)]">
+            <xsl:apply-templates select="." mode="reference">
+              <xsl:with-param name="scope" select="$scope"/>
+              <xsl:with-param name="role" select="$role"/>
+              <xsl:with-param name="type" select="$type"/>
+              <xsl:with-param name="position" select="position()"/>
+            </xsl:apply-templates>
+          </xsl:for-each>
+        </xsl:variable>
+
+        <xsl:copy-of select="$page-number-citations"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs/see">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+
+  </fo:block>
+
+  <xsl:if test="$refs/seealso">
+    <fo:block>
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
+                           mode="index-seealso">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </fo:block>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="reference">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="position" select="0"/>
+  <xsl:param name="separator" select="''"/>
+
+  <xsl:variable name="term.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.term.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="range.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.range.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="number.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.number.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$separator != ''">
+      <xsl:value-of select="$separator"/>
+    </xsl:when>
+    <xsl:when test="$position = 1">
+      <xsl:value-of select="$term.separator"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$number.separator"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:choose>
+    <xsl:when test="@zone and string(@zone)">
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="normalize-space(@zone)"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="ancestor::*[contains(local-name(),'info') and not(starts-with(local-name(),'info'))]">
+      <xsl:call-template name="info.reference">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:variable>
+
+      <fo:basic-link internal-destination="{$id}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+        <fo:page-number-citation ref-id="{$id}"/>
+      </fo:basic-link>
+
+      <xsl:if test="key('endofrange', $id)[&scope;]">
+        <xsl:apply-templates select="key('endofrange', $id)[&scope;][last()]"
+                             mode="reference">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:with-param name="separator" select="$range.separator"/>
+        </xsl:apply-templates>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="reference">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="zones"/>
+
+  <xsl:variable name="number.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.number.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="contains($zones, ' ')">
+      <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
+      <xsl:variable name="target" select="key('id', $zone)"/>
+
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id">
+           <xsl:with-param name="object" select="$target[1]"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <fo:basic-link internal-destination="{$id}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+        <fo:page-number-citation ref-id="{$id}"/>
+      </fo:basic-link>
+
+      <xsl:copy-of select="$number.separator"/>
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="zone" select="$zones"/>
+      <xsl:variable name="target" select="key('id', $zone)"/>
+
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="$target[1]"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <fo:basic-link internal-destination="{$id}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+        <fo:page-number-citation ref-id="{$id}"/>
+      </fo:basic-link>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="info.reference">
+  <!-- This is not perfect. It doesn't treat indexterm inside info element as a range covering whole parent of info.
+       It also not work when there is no ID generated for parent element. But it works in the most common cases. -->
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="target" select="(ancestor::appendix|ancestor::article|ancestor::bibliography|ancestor::book|
+                                       ancestor::chapter|ancestor::glossary|ancestor::part|ancestor::preface|
+                                       ancestor::refentry|ancestor::reference|ancestor::refsect1|ancestor::refsect2|
+                                       ancestor::refsect3|ancestor::refsection|ancestor::refsynopsisdiv|
+                                       ancestor::sect1|ancestor::sect2|ancestor::sect3|ancestor::sect4|ancestor::sect5|
+                                       ancestor::section|ancestor::setindex|ancestor::set|ancestor::sidebar|ancestor::mediaobject)[&scope;]"/>
+  
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$target[position() = last()]"/>
+    </xsl:call-template>
+  </xsl:variable>
+  
+  <fo:basic-link internal-destination="{$id}"
+                 xsl:use-attribute-sets="index.page.number.properties">
+    <fo:page-number-citation ref-id="{$id}"/>
+  </fo:basic-link>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-see">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="see" select="normalize-space(see)"/>
+
+  <!-- can only link to primary, which should appear before comma
+  in see "primary, secondary" entry -->
+  <xsl:variable name="seeprimary">
+    <xsl:choose>
+      <xsl:when test="contains($see, ',')">
+        <xsl:value-of select="substring-before($see, ',')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$see"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable> 
+
+  <xsl:variable name="seetarget" select="key('primaryonly', $seeprimary)[1]"/>
+
+  <xsl:variable name="linkend">
+    <xsl:if test="$seetarget">
+      <xsl:text>ientry-</xsl:text>
+      <xsl:call-template name="object.id">
+        <xsl:with-param name="object" select="$seetarget"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+  
+  <fo:inline>
+    <xsl:text> (</xsl:text>
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="'see'"/>
+    </xsl:call-template>
+    <xsl:text> </xsl:text>
+    <xsl:choose>
+      <!-- manual links have precedence -->
+      <xsl:when test="see/@linkend or see/@xlink:href">
+        <xsl:call-template name="simple.xlink">
+          <xsl:with-param name="node" select="see"/>
+          <xsl:with-param name="content" select="$see"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$autolink.index.see = 0">
+         <xsl:value-of select="$see"/>
+      </xsl:when>
+      <xsl:when test="$seetarget">
+        <fo:basic-link internal-destination="{$linkend}"
+                       xsl:use-attribute-sets="xref.properties">
+          <xsl:value-of select="$see"/>
+        </fo:basic-link>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$see"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>)</xsl:text>
+  </fo:inline>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-seealso">
+   <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:for-each select="seealso">
+    <xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
+
+    <xsl:variable name="seealso" select="normalize-space(.)"/>
+
+    <!-- can only link to primary, which should appear before comma
+    in seealso "primary, secondary" entry -->
+    <xsl:variable name="seealsoprimary">
+      <xsl:choose>
+        <xsl:when test="contains($seealso, ',')">
+          <xsl:value-of select="substring-before($seealso, ',')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$seealso"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable> 
+
+    <xsl:variable name="seealsotarget" select="key('primaryonly', $seealsoprimary)[1]"/>
+
+    <xsl:variable name="linkend">
+      <xsl:if test="$seealsotarget">
+        <xsl:text>ientry-</xsl:text>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="$seealsotarget"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+
+    <fo:block>
+      <xsl:text>(</xsl:text>
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'seealso'"/>
+      </xsl:call-template>
+      <xsl:text> </xsl:text>
+      <xsl:choose>
+        <!-- manual links have precedence -->
+        <xsl:when test="@linkend or @xlink:href">
+          <xsl:call-template name="simple.xlink">
+            <xsl:with-param name="node" select="."/>
+            <xsl:with-param name="content" select="$seealso"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$autolink.index.see = 0">
+          <xsl:value-of select="$seealso"/>
+        </xsl:when>
+        <xsl:when test="$seealsotarget">
+          <fo:basic-link internal-destination="{$linkend}"
+                         xsl:use-attribute-sets="xref.properties">
+            <xsl:value-of select="$seealso"/>
+          </fo:basic-link>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$seealso"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>)</xsl:text>
+    </fo:block>
+
+  </xsl:for-each>
+
+</xsl:template>
+
+<!-- ====================================================================== -->
+
+<xsl:template name="generate-index-markup">
+  <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+  <xsl:param name="role" select="@role"/>
+  <xsl:param name="type" select="@type"/>
+
+  <xsl:variable name="terms" select="$scope//indexterm[count(.|key('letter',
+                                     translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;))[&scope;][1]) = 1]"/>
+  <xsl:variable name="alphabetical"
+                select="$terms[contains(concat(&lowercase;, &uppercase;),
+                                        substring(&primary;, 1, 1))]"/>
+  <xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
+                                                 &uppercase;),
+                                             substring(&primary;, 1, 1)))]"/>
+
+  <xsl:text>&lt;index&gt;&#10;</xsl:text>
+  <xsl:if test="$others">
+    <xsl:text>&#10;&lt;indexdiv&gt;&#10;</xsl:text>
+    <xsl:text>&lt;title&gt;</xsl:text>
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="'index symbols'"/>
+    </xsl:call-template>
+    <xsl:text>&lt;/title&gt;&#10;</xsl:text>
+    <xsl:apply-templates select="$others[count(.|key('primary',
+                                 &primary;)[&scope;][1]) = 1]"
+                         mode="index-symbol-div-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+    <xsl:text>&lt;/indexdiv&gt;&#10;</xsl:text>
+  </xsl:if>
+
+  <xsl:apply-templates select="$alphabetical[count(.|key('letter',
+                               translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;))[&scope;][1]) = 1]"
+                       mode="index-div-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+  </xsl:apply-templates>
+  <xsl:text>&lt;/index&gt;&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="*" mode="index-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:text>&lt;</xsl:text>
+  <xsl:value-of select="local-name(.)"/>
+  <xsl:text>&gt;&#10;</xsl:text>
+  <xsl:apply-templates mode="index-markup">
+    <xsl:with-param name="scope" select="$scope"/>
+    <xsl:with-param name="role" select="$role"/>
+    <xsl:with-param name="type" select="$type"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-div-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
+  <xsl:text>&#10;&lt;indexdiv&gt;&#10;</xsl:text>
+  <xsl:text>&lt;title&gt;</xsl:text>
+  <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
+  <xsl:text>&lt;/title&gt;&#10;</xsl:text>
+
+  <xsl:apply-templates select="key('letter', $key)[&scope;][count(.|key('primary', &primary;)[&scope;][1]) = 1]"
+                       mode="index-primary-markup">
+    <xsl:with-param name="scope" select="$scope"/>
+    <xsl:with-param name="role" select="$role"/>
+    <xsl:with-param name="type" select="$type"/>
+    <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+  </xsl:apply-templates>
+  <xsl:text>&lt;/indexdiv&gt;&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-symbol-div-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
+
+  <xsl:apply-templates select="key('letter', $key)[&scope;][count(.|key('primary', &primary;)[&scope;][1]) = 1]"
+                       mode="index-primary-markup">
+    <xsl:with-param name="scope" select="$scope"/>
+    <xsl:with-param name="role" select="$role"/>
+    <xsl:with-param name="type" select="$type"/>
+    <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-primary-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:variable name="key" select="&primary;"/>
+  <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
+  <xsl:variable name="pages" select="$refs[not(see) and not(seealso)]"/>
+
+  <xsl:text>&#10;&lt;indexentry&gt;&#10;</xsl:text>
+  <xsl:text>&lt;primaryie&gt;</xsl:text>
+  <xsl:text>&lt;phrase&gt;</xsl:text>
+  <xsl:call-template name="escape-text">
+    <xsl:with-param name="text" select="string(primary)"/>
+  </xsl:call-template>
+  <xsl:text>&lt;/phrase&gt;</xsl:text>
+  <xsl:if test="$pages">,</xsl:if>
+  <xsl:text>&#10;</xsl:text>
+
+  <xsl:for-each select="$pages">
+    <xsl:apply-templates select="." mode="reference-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+    </xsl:apply-templates>
+  </xsl:for-each>
+
+  <xsl:text>&lt;/primaryie&gt;&#10;</xsl:text>
+
+  <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::see or self::seealso]">
+    <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
+                         mode="index-see-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+
+    <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
+                         mode="index-seealso-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+
+    <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" 
+                         mode="index-secondary-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+  </xsl:if>
+  <xsl:text>&lt;/indexentry&gt;&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-secondary-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
+  <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
+  <xsl:variable name="pages" select="$refs[not(see) and not(seealso)]"/>
+
+  <xsl:text>&lt;secondaryie&gt;</xsl:text>
+  <xsl:text>&lt;phrase&gt;</xsl:text>
+  <xsl:call-template name="escape-text">
+    <xsl:with-param name="text" select="string(secondary)"/>
+  </xsl:call-template>
+  <xsl:text>&lt;/phrase&gt;</xsl:text>
+  <xsl:if test="$pages">,</xsl:if>
+  <xsl:text>&#10;</xsl:text>
+
+  <xsl:for-each select="$pages">
+    <xsl:apply-templates select="." mode="reference-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+    </xsl:apply-templates>
+  </xsl:for-each>
+
+  <xsl:text>&lt;/secondaryie&gt;&#10;</xsl:text>
+
+  <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::see or self::seealso]">
+    <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
+                         mode="index-see-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
+                         mode="index-seealso-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]" 
+                         mode="index-tertiary-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-tertiary-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+  <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
+  <xsl:variable name="pages" select="$refs[not(see) and not(seealso)]"/>
+
+  <xsl:text>&lt;tertiaryie&gt;</xsl:text>
+  <xsl:text>&lt;phrase&gt;</xsl:text>
+  <xsl:call-template name="escape-text">
+    <xsl:with-param name="text" select="string(tertiary)"/>
+  </xsl:call-template>
+  <xsl:text>&lt;/phrase&gt;</xsl:text>
+  <xsl:if test="$pages">,</xsl:if>
+  <xsl:text>&#10;</xsl:text>
+
+  <xsl:for-each select="$pages">
+    <xsl:apply-templates select="." mode="reference-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+    </xsl:apply-templates>
+  </xsl:for-each>
+
+  <xsl:text>&lt;/tertiaryie&gt;&#10;</xsl:text>
+
+  <xsl:variable name="see" select="$refs/see | $refs/seealso"/>
+  <xsl:if test="$see">
+    <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
+                         mode="index-see-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
+                         mode="index-seealso-markup">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="reference-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="@zone and string(@zone)">
+      <xsl:call-template name="reference-markup">
+        <xsl:with-param name="zones" select="normalize-space(@zone)"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:variable>
+
+
+      <xsl:choose>
+        <xsl:when test="@startref and @class='endofrange'">
+          <xsl:text>&lt;phrase role="pageno"&gt;</xsl:text>
+          <xsl:text>&lt;link linkend="</xsl:text>
+          <xsl:value-of select="@startref"/>
+          <xsl:text>"&gt;</xsl:text>
+          <fo:basic-link internal-destination="{@startref}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+            <fo:page-number-citation ref-id="{@startref}"/>
+            <xsl:text>-</xsl:text>
+            <fo:page-number-citation ref-id="{$id}"/>
+          </fo:basic-link>
+          <xsl:text>&lt;/link&gt;</xsl:text>
+          <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&lt;phrase role="pageno"&gt;</xsl:text>
+          <xsl:if test="$id">
+            <xsl:text>&lt;link linkend="</xsl:text>
+            <xsl:value-of select="$id"/>
+            <xsl:text>"&gt;</xsl:text>
+          </xsl:if>
+          <fo:basic-link internal-destination="{$id}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+            <fo:page-number-citation ref-id="{$id}"/>
+          </fo:basic-link>
+          <xsl:if test="$id">
+            <xsl:text>&lt;/link&gt;</xsl:text>
+          </xsl:if>
+          <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="reference-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="zones"/>
+  <xsl:choose>
+    <xsl:when test="contains($zones, ' ')">
+      <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
+      <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
+
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="$target[1]"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:text>&lt;phrase role="pageno"&gt;</xsl:text>
+      <xsl:if test="$target[1]/@id or $target[1]/@xml:id">
+        <xsl:text>&lt;link linkend="</xsl:text>
+        <xsl:value-of select="$id"/>
+        <xsl:text>"&gt;</xsl:text>
+      </xsl:if>
+      <fo:basic-link internal-destination="{$id}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+        <fo:page-number-citation ref-id="{$id}"/>
+      </fo:basic-link>
+      <xsl:if test="$target[1]/@id or $target[1]/@xml:id">
+        <xsl:text>&lt;/link&gt;</xsl:text>
+      </xsl:if>
+      <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
+
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="zone" select="$zones"/>
+      <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
+
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="$target[1]"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:text>&lt;phrase role="pageno"&gt;</xsl:text>
+      <xsl:if test="$target[1]/@id or target[1]/@xml:id">
+        <xsl:text>&lt;link linkend="</xsl:text>
+        <xsl:value-of select="$id"/>
+        <xsl:text>"&gt;</xsl:text>
+      </xsl:if>
+      <fo:basic-link internal-destination="{$id}"
+                     xsl:use-attribute-sets="index.page.number.properties">
+        <fo:page-number-citation ref-id="{$id}"/>
+      </fo:basic-link>
+      <xsl:if test="$target[1]/@id or target[1]/@xml:id">
+        <xsl:text>&lt;/link&gt;</xsl:text>
+      </xsl:if>
+      <xsl:text>&lt;/phrase&gt;&#10;</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-see-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <fo:block>
+    <xsl:text>&lt;seeie&gt;</xsl:text>
+    <xsl:text>&lt;phrase&gt;</xsl:text>
+    <xsl:call-template name="escape-text">
+      <xsl:with-param name="text" select="string(see)"/>
+    </xsl:call-template>
+    <xsl:text>&lt;/phrase&gt;</xsl:text>
+    <xsl:text>&lt;/seeie&gt;&#10;</xsl:text>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-seealso-markup">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <fo:block>
+    <xsl:text>&lt;seealsoie&gt;</xsl:text>
+    <xsl:text>&lt;phrase&gt;</xsl:text>
+    <xsl:call-template name="escape-text">
+      <xsl:with-param name="text" select="string(seealso)"/>
+    </xsl:call-template>
+    <xsl:text>&lt;/phrase&gt;</xsl:text>
+    <xsl:text>&lt;/seealsoie&gt;&#10;</xsl:text>
+  </fo:block>
+</xsl:template>
+
+<xsl:template name="escape-text">
+  <xsl:param name="text" select="''"/>
+
+  <xsl:variable name="ltpos" select="substring-before($text, '&lt;')"/>
+  <xsl:variable name="amppos" select="substring-before($text, '&amp;')"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($text,'&lt;') and contains($text, '&amp;')
+                    and string-length($ltpos) &lt; string-length($amppos)">
+      <xsl:value-of select="$ltpos"/>
+      <xsl:text>&amp;lt;</xsl:text>
+      <xsl:call-template name="escape-text">
+        <xsl:with-param name="text" select="substring-after($text, '&lt;')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="contains($text,'&lt;') and contains($text, '&amp;')
+                    and string-length($amppos) &lt; string-length($ltpos)">
+      <xsl:value-of select="$amppos"/>
+      <xsl:text>&amp;amp;</xsl:text>
+      <xsl:call-template name="escape-text">
+        <xsl:with-param name="text" select="substring-after($text, '&amp;')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="contains($text, '&lt;')">
+      <xsl:value-of select="$ltpos"/>
+      <xsl:text>&amp;lt;</xsl:text>
+      <xsl:call-template name="escape-text">
+        <xsl:with-param name="text" select="substring-after($text, '&lt;')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="contains($text, '&amp;')">
+      <xsl:value-of select="$amppos"/>
+      <xsl:text>&amp;amp;</xsl:text>
+      <xsl:call-template name="escape-text">
+        <xsl:with-param name="text" select="substring-after($text, '&amp;')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:value-of select="$text"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="index.separator">
+  <xsl:param name="key" select="''"/>
+  <xsl:param name="lang">
+    <xsl:call-template name="l10n.language"/>
+  </xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$key = 'index.term.separator'">
+      <xsl:choose>
+        <!-- Use the override if not blank -->
+        <xsl:when test="$index.term.separator != ''">
+          <xsl:copy-of select="$index.term.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="context">index</xsl:with-param>
+            <xsl:with-param name="name">term-separator</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$key = 'index.number.separator'">
+      <xsl:choose>
+        <!-- Use the override if not blank -->
+        <xsl:when test="$index.number.separator != ''">
+          <xsl:copy-of select="$index.number.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="context">index</xsl:with-param>
+            <xsl:with-param name="name">number-separator</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$key = 'index.range.separator'">
+      <xsl:choose>
+        <!-- Use the override if not blank -->
+        <xsl:when test="$index.range.separator != ''">
+          <xsl:copy-of select="$index.range.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="context">index</xsl:with-param>
+            <xsl:with-param name="name">range-separator</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/lists.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/lists.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/lists.xsl	(revision 119)
@@ -0,0 +1,1438 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version='1.0'>
+
+<!-- ********************************************************************
+     $Id: lists.xsl 9999 2015-10-15 17:55:56Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:template match="itemizedlist">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:variable name="pi-label-width">
+    <xsl:call-template name="pi.dbfo_label-width"/>
+  </xsl:variable>
+
+  <xsl:variable name="label-width">
+    <xsl:choose>
+      <xsl:when test="$pi-label-width = ''">
+        <xsl:value-of select="$itemizedlist.label.width"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$pi-label-width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:if test="title">
+    <xsl:apply-templates select="title" mode="list.title.mode"/>
+  </xsl:if>
+
+  <!-- Preserve order of PIs and comments -->
+  <xsl:apply-templates 
+      select="*[not(self::listitem
+                or self::title
+                or self::titleabbrev)]
+              |comment()[not(preceding-sibling::listitem)]
+              |processing-instruction()[not(preceding-sibling::listitem)]"/>
+
+  <xsl:variable name="content">
+    <xsl:apply-templates 
+          select="listitem
+                  |comment()[preceding-sibling::listitem]
+                  |processing-instruction()[preceding-sibling::listitem]"/>
+  </xsl:variable>
+
+  <!-- nested lists don't add extra list-block spacing -->
+  <xsl:choose>
+    <xsl:when test="ancestor::listitem">
+      <fo:list-block id="{$id}" xsl:use-attribute-sets="itemizedlist.properties">
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </fo:list-block>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing itemizedlist.properties">
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </fo:list-block>
+    </xsl:otherwise>
+  </xsl:choose>
+
+</xsl:template>
+
+<xsl:template match="itemizedlist/title|orderedlist/title">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="variablelist/title" mode="vl.as.list">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="variablelist/title" mode="vl.as.blocks">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="procedure/titleabbrev">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="variablelist/titleabbrev" mode="vl.as.list">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="variablelist/titleabbrev" mode="vl.as.blocks">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="itemizedlist/listitem">
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:variable name="item.contents">
+    <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="itemizedlist.label.properties">
+      <fo:block>
+        <xsl:call-template name="itemizedlist.label.markup">
+          <xsl:with-param name="itemsymbol">
+            <xsl:call-template name="list.itemsymbol">
+              <xsl:with-param name="node" select="parent::itemizedlist"/>
+            </xsl:call-template>
+          </xsl:with-param>
+        </xsl:call-template>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <fo:block>
+        <xsl:apply-templates/>
+      </fo:block>
+    </fo:list-item-body>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="parent::*/@spacing = 'compact'">
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="itemizedlist.label.markup">
+  <xsl:param name="itemsymbol" select="'disc'"/>
+
+  <xsl:choose>
+    <xsl:when test="$itemsymbol='none'"></xsl:when>
+    <xsl:when test="$itemsymbol='disc'">&#x2022;</xsl:when>
+    <xsl:when test="$itemsymbol='bullet'">&#x2022;</xsl:when>
+    <xsl:when test="$itemsymbol='endash'">&#x2013;</xsl:when>
+    <xsl:when test="$itemsymbol='emdash'">&#x2014;</xsl:when>
+    <!-- Some of these may work in your XSL-FO processor and fonts -->
+    <!--
+    <xsl:when test="$itemsymbol='square'">&#x25A0;</xsl:when>
+    <xsl:when test="$itemsymbol='box'">&#x25A0;</xsl:when>
+    <xsl:when test="$itemsymbol='smallblacksquare'">&#x25AA;</xsl:when>
+    <xsl:when test="$itemsymbol='circle'">&#x25CB;</xsl:when>
+    <xsl:when test="$itemsymbol='opencircle'">&#x25CB;</xsl:when>
+    <xsl:when test="$itemsymbol='whitesquare'">&#x25A1;</xsl:when>
+    <xsl:when test="$itemsymbol='smallwhitesquare'">&#x25AB;</xsl:when>
+    <xsl:when test="$itemsymbol='round'">&#x25CF;</xsl:when>
+    <xsl:when test="$itemsymbol='blackcircle'">&#x25CF;</xsl:when>
+    <xsl:when test="$itemsymbol='whitebullet'">&#x25E6;</xsl:when>
+    <xsl:when test="$itemsymbol='triangle'">&#x2023;</xsl:when>
+    <xsl:when test="$itemsymbol='point'">&#x203A;</xsl:when>
+    <xsl:when test="$itemsymbol='hand'"><fo:inline 
+                         font-family="Wingdings 2">A</fo:inline></xsl:when>
+    -->
+    <xsl:otherwise>&#x2022;</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="orderedlist">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="pi-label-width">
+    <xsl:call-template name="pi.dbfo_label-width"/>
+  </xsl:variable>
+
+  <xsl:variable name="label-width">
+    <xsl:choose>
+      <xsl:when test="$pi-label-width = ''">
+        <xsl:value-of select="$orderedlist.label.width"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$pi-label-width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:if test="title">
+    <xsl:apply-templates select="title" mode="list.title.mode"/>
+  </xsl:if>
+
+  <!-- Preserve order of PIs and comments -->
+  <xsl:apply-templates 
+      select="*[not(self::listitem
+                or self::title
+                or self::titleabbrev)]
+              |comment()[not(preceding-sibling::listitem)]
+              |processing-instruction()[not(preceding-sibling::listitem)]"/>
+
+  <xsl:variable name="content">
+    <xsl:apply-templates 
+          select="listitem
+                  |comment()[preceding-sibling::listitem]
+                  |processing-instruction()[preceding-sibling::listitem]"/>
+  </xsl:variable>
+
+  <!-- nested lists don't add extra list-block spacing -->
+  <xsl:choose>
+    <xsl:when test="ancestor::listitem">
+      <fo:list-block id="{$id}" xsl:use-attribute-sets="orderedlist.properties">
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </fo:list-block>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing orderedlist.properties">
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$label-width"/>
+        </xsl:attribute>
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </fo:list-block>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="orderedlist/listitem">
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:variable name="item.contents">
+    <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="orderedlist.label.properties">
+      <fo:block>
+        <xsl:apply-templates select="." mode="item-number"/>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:choose>
+        <!-- * work around broken passivetex list-item-body rendering -->
+        <xsl:when test="$passivetex.extensions = '1'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-body>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="parent::*/@spacing = 'compact'">
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="listitem/*[1][local-name()='para' or 
+                                   local-name()='simpara' or 
+                                   local-name()='formalpara']
+                     |glossdef/*[1][local-name()='para' or 
+                                   local-name()='simpara' or 
+                                   local-name()='formalpara']
+                     |step/*[1][local-name()='para' or 
+                                   local-name()='simpara' or 
+                                   local-name()='formalpara']
+                     |callout/*[1][local-name()='para' or 
+                                   local-name()='simpara' or 
+                                   local-name()='formalpara']"
+              priority="2">
+  <fo:block xsl:use-attribute-sets="para.properties">
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="variablelist">
+  <xsl:variable name="presentation">
+    <xsl:call-template name="pi.dbfo_list-presentation"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$presentation = 'list'">
+      <xsl:apply-templates select="." mode="vl.as.list"/>
+    </xsl:when>
+    <xsl:when test="$presentation = 'blocks'">
+      <xsl:apply-templates select="." mode="vl.as.blocks"/>
+    </xsl:when>
+    <xsl:when test="$variablelist.as.blocks != 0">
+      <xsl:apply-templates select="." mode="vl.as.blocks"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="." mode="vl.as.list"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="variablelist" mode="vl.as.list">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:variable name="term-width">
+    <xsl:call-template name="pi.dbfo_term-width"/>
+  </xsl:variable>
+
+  <xsl:variable name="termlength">
+    <xsl:choose>
+      <xsl:when test="$term-width != ''">
+        <xsl:value-of select="$term-width"/>
+      </xsl:when>
+      <xsl:when test="@termlength">
+        <xsl:variable name="termlength.is.number">
+          <xsl:value-of select="@termlength"/>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="string($termlength.is.number) = 'NaN'">
+            <!-- if the term length isn't just a number, assume it's a measurement -->
+            <xsl:value-of select="@termlength"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@termlength"/>
+            <xsl:text>em</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="longest.term">
+          <xsl:with-param name="terms" select="varlistentry/term"/>
+          <xsl:with-param name="maxlength" select="$variablelist.max.termlength"/>
+        </xsl:call-template>
+        <xsl:text>em</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+<!--
+  <xsl:message>
+    <xsl:text>term width: </xsl:text>
+    <xsl:value-of select="$termlength"/>
+  </xsl:message>
+-->
+
+  <xsl:variable name="label-separation">1em</xsl:variable>
+  <xsl:variable name="distance-between-starts">
+    <xsl:value-of select="$termlength"/>
+  </xsl:variable>
+
+  <xsl:if test="title">
+    <xsl:apply-templates select="title" mode="list.title.mode"/>
+  </xsl:if>
+
+  <!-- Preserve order of PIs and comments -->
+  <xsl:apply-templates 
+    select="*[not(self::varlistentry
+              or self::title
+              or self::titleabbrev)]
+            |comment()[not(preceding-sibling::varlistentry)]
+            |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
+
+  <xsl:variable name="content">
+    <xsl:apply-templates mode="vl.as.list"
+      select="varlistentry
+              |comment()[preceding-sibling::varlistentry]
+              |processing-instruction()[preceding-sibling::varlistentry]"/>
+  </xsl:variable>
+
+  <!-- nested lists don't add extra list-block spacing -->
+  <xsl:choose>
+    <xsl:when test="ancestor::listitem">
+      <fo:list-block id="{$id}"
+                     provisional-distance-between-starts=
+                        "{$distance-between-starts}"
+                     provisional-label-separation="{$label-separation}">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </fo:list-block>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-block id="{$id}"
+                     provisional-distance-between-starts=
+                        "{$distance-between-starts}"
+                     provisional-label-separation="{$label-separation}"
+                     xsl:use-attribute-sets="list.block.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </fo:list-block>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="longest.term">
+  <xsl:param name="longest" select="0"/>
+  <xsl:param name="terms" select="."/>
+  <xsl:param name="maxlength" select="-1"/>
+
+  <!-- Process out any indexterms in the term -->
+  <xsl:variable name="term.text">
+    <xsl:apply-templates select="$terms[1]"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$longest &gt; $maxlength and $maxlength &gt; 0">
+      <xsl:value-of select="$maxlength"/>
+    </xsl:when>
+    <xsl:when test="not($terms)">
+      <xsl:value-of select="$longest"/>
+    </xsl:when>
+    <xsl:when test="string-length($term.text) &gt; $longest">
+      <xsl:call-template name="longest.term">
+        <xsl:with-param name="longest" 
+            select="string-length($term.text)"/>
+        <xsl:with-param name="maxlength" select="$maxlength"/>
+        <xsl:with-param name="terms" select="$terms[position() &gt; 1]"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="longest.term">
+        <xsl:with-param name="longest" select="$longest"/>
+        <xsl:with-param name="maxlength" select="$maxlength"/>
+        <xsl:with-param name="terms" select="$terms[position() &gt; 1]"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="varlistentry" mode="vl.as.list">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:variable name="item.contents">
+    <fo:list-item-label end-indent="label-end()" text-align="start">
+      <fo:block xsl:use-attribute-sets="variablelist.term.properties">
+        <xsl:apply-templates select="term"/>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:choose>
+        <!-- * work around broken passivetex list-item-body rendering -->
+        <xsl:when test="$passivetex.extensions = '1'">
+          <xsl:apply-templates select="listitem"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates select="listitem"/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+     </fo:list-item-body>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="parent::*/@spacing = 'compact'">
+      <fo:list-item id="{$id}"
+          xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="variablelist" mode="vl.as.blocks">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <!-- termlength is irrelevant -->
+
+  <xsl:if test="title">
+    <xsl:apply-templates select="title" mode="list.title.mode"/>
+  </xsl:if>
+
+  <!-- Preserve order of PIs and comments -->
+  <xsl:apply-templates 
+    select="*[not(self::varlistentry
+              or self::title
+              or self::titleabbrev)]
+            |comment()[not(preceding-sibling::varlistentry)]
+            |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
+
+  <xsl:variable name="content">
+    <xsl:apply-templates mode="vl.as.blocks"
+      select="varlistentry
+              |comment()[preceding-sibling::varlistentry]
+              |processing-instruction()[preceding-sibling::varlistentry]"/>
+  </xsl:variable>
+
+  <!-- nested lists don't add extra list-block spacing -->
+  <xsl:choose>
+    <xsl:when test="ancestor::listitem">
+      <fo:block id="{$id}">
+        <xsl:copy-of select="$content"/>
+      </fo:block>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:block id="{$id}" xsl:use-attribute-sets="list.block.spacing">
+        <xsl:copy-of select="$content"/>
+      </fo:block>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="varlistentry" mode="vl.as.blocks">
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <fo:block id="{$id}" xsl:use-attribute-sets="variablelist.term.properties
+                                               list.item.spacing"  
+      keep-together.within-column="always" 
+      keep-with-next.within-column="always">
+    <xsl:apply-templates select="term"/>
+  </fo:block>
+
+  <fo:block>
+    <xsl:attribute name="margin-{$direction.align.start}">0.25in</xsl:attribute>
+    <xsl:apply-templates select="listitem"/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="varlistentry/term">
+  <fo:inline>
+    <xsl:call-template name="anchor"/>
+    <xsl:call-template name="simple.xlink">
+      <xsl:with-param name="content">
+        <xsl:apply-templates/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </fo:inline>
+  <xsl:choose>
+    <xsl:when test="not(following-sibling::term)"/> <!-- do nothing -->
+    <xsl:otherwise>
+      <!-- * if we have multiple terms in the same varlistentry, generate -->
+      <!-- * a separator (", " by default) and/or an additional line -->
+      <!-- * break after each one except the last -->
+      <fo:inline><xsl:value-of select="$variablelist.term.separator"/></fo:inline>
+      <xsl:if test="not($variablelist.term.break.after = '0')">
+        <fo:block/>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="varlistentry/listitem">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="title" mode="list.title.mode">
+  <xsl:call-template name="formal.object.heading">
+    <xsl:with-param name="object" select=".."/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="simplelist|simplelist[@type='vert']">
+  <!-- with no type specified, the default is 'vert' -->
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="explicit.table.width">
+    <xsl:call-template name="dbfo-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbfo')"/>
+      <xsl:with-param name="attribute" select="'list-width'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="table.width">
+    <xsl:choose>
+      <xsl:when test="$explicit.table.width != ''">
+        <xsl:value-of select="$explicit.table.width"/>
+      </xsl:when>
+      <xsl:when test="$default.table.width = ''">
+        <xsl:text>100%</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$default.table.width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
+
+    <xsl:choose>
+      <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
+        <xsl:attribute name="table-layout">auto</xsl:attribute>
+        <xsl:if test="$explicit.table.width != ''">
+          <xsl:attribute name="width"><xsl:value-of 
+          select="$explicit.table.width"/></xsl:attribute>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="table-layout">fixed</xsl:attribute>
+        <xsl:attribute name="width"><xsl:value-of 
+                                      select="$table.width"/></xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:call-template name="simplelist.table.columns">
+      <xsl:with-param name="cols">
+        <xsl:choose>
+          <xsl:when test="@columns">
+            <xsl:value-of select="@columns"/>
+          </xsl:when>
+          <xsl:otherwise>1</xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
+    <fo:table-body start-indent="0pt" end-indent="0pt">
+      <xsl:call-template name="simplelist.vert">
+        <xsl:with-param name="cols">
+          <xsl:choose>
+            <xsl:when test="@columns">
+              <xsl:value-of select="@columns"/>
+            </xsl:when>
+            <xsl:otherwise>1</xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </xsl:call-template>
+    </fo:table-body>
+  </fo:table>
+</xsl:template>
+
+<xsl:template match="simplelist[@type='inline']">
+  <!-- if dbchoice PI exists, use that to determine the choice separator -->
+  <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
+  <!-- value of "choice" otherwise -->
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <fo:inline id="{$id}"><xsl:variable name="localized-choice-separator">
+    <xsl:choose>
+      <xsl:when test="processing-instruction('dbchoice')">
+        <xsl:call-template name="select.choice.separator"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- empty -->
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:for-each select="member">
+    <xsl:apply-templates/>
+    <xsl:choose>
+      <xsl:when test="position() = last()"/> <!-- do nothing -->
+      <xsl:otherwise>
+        <xsl:text>, </xsl:text>
+        <xsl:if test="position() = last() - 1">
+          <xsl:if test="$localized-choice-separator != ''">
+            <xsl:value-of select="$localized-choice-separator"/>
+            <xsl:text> </xsl:text>
+          </xsl:if>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:for-each></fo:inline>
+</xsl:template>
+
+<xsl:template match="simplelist[@type='horiz']">
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="explicit.table.width">
+    <xsl:call-template name="pi.dbfo_list-width"/>
+  </xsl:variable>
+
+  <xsl:variable name="table.width">
+    <xsl:choose>
+      <xsl:when test="$explicit.table.width != ''">
+        <xsl:value-of select="$explicit.table.width"/>
+      </xsl:when>
+      <xsl:when test="$default.table.width = ''">
+        <xsl:text>100%</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$default.table.width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
+    <xsl:choose>
+      <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
+        <xsl:attribute name="table-layout">auto</xsl:attribute>
+        <xsl:if test="$explicit.table.width != ''">
+          <xsl:attribute name="width"><xsl:value-of 
+                             select="$explicit.table.width"/></xsl:attribute>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="table-layout">fixed</xsl:attribute>
+        <xsl:attribute name="width"><xsl:value-of 
+                                      select="$table.width"/></xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:call-template name="simplelist.table.columns">
+      <xsl:with-param name="cols">
+        <xsl:choose>
+          <xsl:when test="@columns">
+            <xsl:value-of select="@columns"/>
+          </xsl:when>
+          <xsl:otherwise>1</xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
+    <fo:table-body start-indent="0pt" end-indent="0pt">
+      <xsl:call-template name="simplelist.horiz">
+        <xsl:with-param name="cols">
+          <xsl:choose>
+            <xsl:when test="@columns">
+              <xsl:value-of select="@columns"/>
+            </xsl:when>
+            <xsl:otherwise>1</xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </xsl:call-template>
+    </fo:table-body>
+  </fo:table>
+</xsl:template>
+
+<xsl:template name="simplelist.table.columns">
+  <xsl:param name="cols" select="1"/>
+  <xsl:param name="curcol" select="1"/>
+  <fo:table-column column-number="{$curcol}"
+                   column-width="proportional-column-width(1)"/>
+  <xsl:if test="$curcol &lt; $cols">
+    <xsl:call-template name="simplelist.table.columns">
+      <xsl:with-param name="cols" select="$cols"/>
+      <xsl:with-param name="curcol" select="$curcol + 1"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="simplelist.horiz">
+  <xsl:param name="cols">1</xsl:param>
+  <xsl:param name="cell">1</xsl:param>
+  <xsl:param name="members" select="./member"/>
+
+  <xsl:if test="$cell &lt;= count($members)">
+    <fo:table-row>
+      <xsl:call-template name="simplelist.horiz.row">
+        <xsl:with-param name="cols" select="$cols"/>
+        <xsl:with-param name="cell" select="$cell"/>
+        <xsl:with-param name="members" select="$members"/>
+      </xsl:call-template>
+   </fo:table-row>
+    <xsl:call-template name="simplelist.horiz">
+      <xsl:with-param name="cols" select="$cols"/>
+      <xsl:with-param name="cell" select="$cell + $cols"/>
+      <xsl:with-param name="members" select="$members"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="simplelist.horiz.row">
+  <xsl:param name="cols">1</xsl:param>
+  <xsl:param name="cell">1</xsl:param>
+  <xsl:param name="members" select="./member"/>
+  <xsl:param name="curcol">1</xsl:param>
+
+  <xsl:if test="$curcol &lt;= $cols">
+    <fo:table-cell>
+      <fo:block>
+        <xsl:if test="$members[position()=$cell]">
+          <xsl:apply-templates select="$members[position()=$cell]"/>
+        </xsl:if>
+      </fo:block>
+    </fo:table-cell>
+    <xsl:call-template name="simplelist.horiz.row">
+      <xsl:with-param name="cols" select="$cols"/>
+      <xsl:with-param name="cell" select="$cell+1"/>
+      <xsl:with-param name="members" select="$members"/>
+      <xsl:with-param name="curcol" select="$curcol+1"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="simplelist.vert">
+  <xsl:param name="cols">1</xsl:param>
+  <xsl:param name="cell">1</xsl:param>
+  <xsl:param name="members" select="./member"/>
+  <xsl:param name="rows"
+             select="floor((count($members)+$cols - 1) div $cols)"/>
+
+  <xsl:if test="$cell &lt;= $rows">
+    <fo:table-row>
+      <xsl:call-template name="simplelist.vert.row">
+        <xsl:with-param name="cols" select="$cols"/>
+        <xsl:with-param name="rows" select="$rows"/>
+        <xsl:with-param name="cell" select="$cell"/>
+        <xsl:with-param name="members" select="$members"/>
+      </xsl:call-template>
+   </fo:table-row>
+    <xsl:call-template name="simplelist.vert">
+      <xsl:with-param name="cols" select="$cols"/>
+      <xsl:with-param name="cell" select="$cell+1"/>
+      <xsl:with-param name="members" select="$members"/>
+      <xsl:with-param name="rows" select="$rows"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="simplelist.vert.row">
+  <xsl:param name="cols">1</xsl:param>
+  <xsl:param name="rows">1</xsl:param>
+  <xsl:param name="cell">1</xsl:param>
+  <xsl:param name="members" select="./member"/>
+  <xsl:param name="curcol">1</xsl:param>
+
+  <xsl:if test="$curcol &lt;= $cols">
+    <fo:table-cell>
+      <fo:block>
+        <xsl:if test="$members[position()=$cell]">
+          <xsl:apply-templates select="$members[position()=$cell]"/>
+        </xsl:if>
+      </fo:block>
+    </fo:table-cell>
+    <xsl:call-template name="simplelist.vert.row">
+      <xsl:with-param name="cols" select="$cols"/>
+      <xsl:with-param name="rows" select="$rows"/>
+      <xsl:with-param name="cell" select="$cell+$rows"/>
+      <xsl:with-param name="members" select="$members"/>
+      <xsl:with-param name="curcol" select="$curcol+1"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="member">
+  <xsl:call-template name="simple.xlink">
+    <xsl:with-param name="content">
+      <xsl:apply-templates/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="procedure">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="param.placement"
+                select="substring-after(normalize-space($formal.title.placement),
+                                        concat(local-name(.), ' '))"/>
+
+  <xsl:variable name="placement">
+    <xsl:choose>
+      <xsl:when test="contains($param.placement, ' ')">
+        <xsl:value-of select="substring-before($param.placement, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$param.placement = ''">before</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$param.placement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- Preserve order of PIs and comments -->
+  <xsl:variable name="preamble"
+        select="*[not(self::step
+                  or self::title
+                  or self::titleabbrev)]
+                |comment()[not(preceding-sibling::step)]
+                |processing-instruction()[not(preceding-sibling::step)]"/>
+
+  <xsl:variable name="steps" 
+                select="step
+                        |comment()[preceding-sibling::step]
+                        |processing-instruction()[preceding-sibling::step]"/>
+
+  <fo:block id="{$id}" xsl:use-attribute-sets="procedure.properties list.block.spacing">
+    <xsl:if test="(title or blockinfo/title or info/title) and $placement = 'before'">
+      <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" -->
+      <!-- heading even though we called formal.object.heading. odd but true. -->
+      <xsl:call-template name="formal.object.heading"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="$preamble"/>
+
+    <fo:list-block xsl:use-attribute-sets="list.block.spacing"
+                   provisional-distance-between-starts="2em"
+                   provisional-label-separation="0.2em">
+      <xsl:apply-templates select="$steps"/>
+    </fo:list-block>
+
+    <xsl:if test="(title or blockinfo/title or info/title) and $placement != 'before'">
+      <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" -->
+      <!-- heading even though we called formal.object.heading. odd but true. -->
+      <xsl:call-template name="formal.object.heading"/>
+    </xsl:if>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="procedure/title">
+</xsl:template>
+
+<xsl:template match="substeps">
+  <fo:list-block xsl:use-attribute-sets="list.block.spacing"
+                 provisional-distance-between-starts="2em"
+                 provisional-label-separation="0.2em">
+    <xsl:apply-templates/>
+  </fo:list-block>
+</xsl:template>
+
+<xsl:template match="procedure/step|substeps/step">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <fo:list-item xsl:use-attribute-sets="list.item.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
+    <fo:list-item-label end-indent="label-end()">
+      <fo:block id="{$id}">
+        <!-- dwc: fix for one step procedures. Use a bullet if there's no step 2 -->
+        <xsl:choose>
+          <xsl:when test="count(../step) = 1">
+            <xsl:text>&#x2022;</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="." mode="number">
+              <xsl:with-param name="recursive" select="0"/>
+            </xsl:apply-templates>.
+          </xsl:otherwise>
+        </xsl:choose>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:choose>
+        <!-- * work around broken passivetex list-item-body rendering -->
+        <xsl:when test="$passivetex.extensions = '1'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-body>
+  </fo:list-item>
+</xsl:template>
+
+<xsl:template match="stepalternatives">
+  <fo:list-block provisional-distance-between-starts="2em"
+                 provisional-label-separation="0.2em">
+    <xsl:apply-templates select="step"/>
+  </fo:list-block>
+</xsl:template>
+
+<xsl:template match="stepalternatives/step">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <fo:list-item xsl:use-attribute-sets="list.item.spacing">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
+    <fo:list-item-label end-indent="label-end()">
+      <fo:block id="{$id}">
+        <xsl:text>&#x2022;</xsl:text>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:choose>
+        <!-- * work around broken passivetex list-item-body rendering -->
+        <xsl:when test="$passivetex.extensions = '1'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-body>
+  </fo:list-item>
+</xsl:template>
+
+<xsl:template match="step/title">
+  <fo:block font-weight="bold"
+            keep-together.within-column="always" 
+            keep-with-next.within-column="always">
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<!-- Add (Optional) when the step is optional -->
+<xsl:template match="step[@performance = 'optional']/*[1][self::para]" priority="3">
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+  <fo:block xsl:use-attribute-sets="para.properties">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
+    <xsl:call-template name="anchor"/>
+    <xsl:if test="$mark.optional.procedure.steps != 0">
+      <xsl:call-template name="optional.step.marker"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template name="optional.step.marker">
+  <fo:inline>
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key">optional-step</xsl:with-param>
+    </xsl:call-template>
+  </fo:inline>
+</xsl:template>
+<!-- ==================================================================== -->
+
+<xsl:template match="segmentedlist">
+  <xsl:variable name="presentation">
+    <xsl:call-template name="pi.dbfo_list-presentation"/>
+  </xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$presentation = 'table'">
+      <fo:block id="{$id}">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="." mode="seglist-table"/>
+      </fo:block>
+    </xsl:when>
+    <xsl:when test="$presentation = 'list'">
+      <fo:block id="{$id}">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates/>
+      </fo:block>
+    </xsl:when>
+    <xsl:when test="$segmentedlist.as.table != 0">
+      <fo:block id="{$id}">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="." mode="seglist-table"/>
+      </fo:block>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:block id="{$id}">
+        <xsl:if test="$keep.together != ''">
+          <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                          select="$keep.together"/></xsl:attribute>
+        </xsl:if>
+
+        <xsl:apply-templates/>
+      </fo:block>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="segmentedlist/title">
+  <xsl:apply-templates select="." mode="list.title.mode" />
+</xsl:template>
+
+<xsl:template match="segtitle">
+</xsl:template>
+
+<xsl:template match="segtitle" mode="segtitle-in-seg">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="seglistitem">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+  <fo:block id="{$id}">
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="seg">
+  <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
+  <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
+  <xsl:variable name="segtitles" select="$seglist/segtitle"/>
+
+  <!--
+     Note: segtitle is only going to be the right thing in a well formed
+     SegmentedList.  If there are too many Segs or too few SegTitles,
+     you'll get something odd...maybe an error
+  -->
+
+  <fo:block>
+    <fo:inline font-weight="bold">
+      <xsl:apply-templates select="$segtitles[$segnum=position()]"
+                           mode="segtitle-in-seg"/>
+      <xsl:text>: </xsl:text>
+    </fo:inline>
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="segmentedlist" mode="seglist-table">
+  <xsl:apply-templates select="title" mode="list.title.mode" />
+  <fo:table table-layout="fixed">
+    <xsl:call-template name="segmentedlist.table.columns">
+      <xsl:with-param name="cols" select="count(segtitle)"/>
+    </xsl:call-template>
+    <fo:table-header start-indent="0pt" end-indent="0pt">
+      <fo:table-row>
+        <xsl:apply-templates select="segtitle" mode="seglist-table"/>
+      </fo:table-row>
+    </fo:table-header>
+    <fo:table-body start-indent="0pt" end-indent="0pt">
+      <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
+    </fo:table-body>
+  </fo:table>
+</xsl:template>
+
+<xsl:template name="segmentedlist.table.columns">
+  <xsl:param name="cols" select="1"/>
+  <xsl:param name="curcol" select="1"/>
+
+  <fo:table-column column-number="{$curcol}"
+                   column-width="proportional-column-width(1)"/>
+  <xsl:if test="$curcol &lt; $cols">
+    <xsl:call-template name="segmentedlist.table.columns">
+      <xsl:with-param name="cols" select="$cols"/>
+      <xsl:with-param name="curcol" select="$curcol+1"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="segtitle" mode="seglist-table">
+  <fo:table-cell>
+    <fo:block font-weight="bold">
+      <xsl:apply-templates/>
+    </fo:block>
+  </fo:table-cell>
+</xsl:template>
+
+<xsl:template match="seglistitem" mode="seglist-table">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+  <fo:table-row id="{$id}">
+    <xsl:apply-templates mode="seglist-table"/>
+  </fo:table-row>
+</xsl:template>
+
+<xsl:template match="seg" mode="seglist-table">
+  <fo:table-cell>
+    <fo:block>
+      <xsl:apply-templates/>
+    </fo:block>
+  </fo:table-cell>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="calloutlist">
+  <xsl:variable name="id">
+  <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="pi-label-width">
+    <xsl:call-template name="pi.dbfo_label-width"/>
+  </xsl:variable>
+
+  <fo:block id="{$id}"
+            text-align="{$alignment}">
+    <!-- The above restores alignment altered by image align attribute -->
+    <xsl:if test="title|info/title">
+      <xsl:apply-templates select="(title|info/title)[1]" 
+                           mode="list.title.mode"/>
+    </xsl:if>
+
+    <!-- Preserve order of PIs and comments -->
+    <xsl:apply-templates 
+         select="*[not(self::callout or self::title or self::titleabbrev)]
+                   |comment()[not(preceding-sibling::callout)]
+                   |processing-instruction()[not(preceding-sibling::callout)]"/>
+
+    <fo:list-block xsl:use-attribute-sets="calloutlist.properties">
+
+      <xsl:if test="$pi-label-width != ''">
+        <xsl:attribute name="provisional-distance-between-starts">
+          <xsl:value-of select="$pi-label-width"/>
+        </xsl:attribute>
+      </xsl:if>
+      
+      <xsl:apply-templates select="callout
+                                |comment()[preceding-sibling::callout]
+                                |processing-instruction()[preceding-sibling::callout]"/>
+    </fo:list-block>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="calloutlist/title">
+</xsl:template>
+
+<xsl:template match="callout">
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <xsl:variable name="keep.together">
+    <xsl:call-template name="pi.dbfo_keep-together"/>
+  </xsl:variable>
+
+  <fo:list-item id="{$id}" xsl:use-attribute-sets="callout.properties">
+    <xsl:if test="$keep.together != ''">
+      <xsl:attribute name="keep-together.within-column"><xsl:value-of
+                      select="$keep.together"/></xsl:attribute>
+    </xsl:if>
+    <fo:list-item-label end-indent="label-end()">
+      <fo:block>
+        <xsl:call-template name="callout.arearefs">
+          <xsl:with-param name="arearefs" select="@arearefs"/>
+        </xsl:call-template>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:choose>
+        <!-- * work around broken passivetex list-item-body rendering -->
+        <xsl:when test="$passivetex.extensions = '1'">
+          <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-body>
+  </fo:list-item>
+</xsl:template>
+
+<xsl:template name="callout.arearefs">
+  <xsl:param name="arearefs"></xsl:param>
+  <xsl:if test="$arearefs!=''">
+    <xsl:choose>
+      <xsl:when test="substring-before($arearefs,' ')=''">
+        <xsl:call-template name="callout.arearef">
+          <xsl:with-param name="arearef" select="$arearefs"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="callout.arearef">
+          <xsl:with-param name="arearef"
+                          select="substring-before($arearefs,' ')"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:call-template name="callout.arearefs">
+      <xsl:with-param name="arearefs"
+                      select="substring-after($arearefs,' ')"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="callout.arearef">
+  <xsl:param name="arearef"></xsl:param>
+  <xsl:variable name="targets" select="key('id',$arearef)"/>
+  <xsl:variable name="target" select="$targets[1]"/>
+
+  <xsl:choose>
+    <xsl:when test="count($target)=0">
+      <xsl:value-of select="$arearef"/>
+      <xsl:text>: ???</xsl:text>
+    </xsl:when>
+    <xsl:when test="local-name($target)='co'">
+      <fo:basic-link internal-destination="{$arearef}">
+        <xsl:apply-templates select="$target" mode="callout-bug"/>
+      </fo:basic-link>
+    </xsl:when>
+    <xsl:when test="local-name($target)='areaset'">
+      <xsl:call-template name="callout-bug">
+        <xsl:with-param name="conum">
+          <xsl:apply-templates select="$target" mode="conumber"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($target)='area'">
+      <xsl:choose>
+        <xsl:when test="$target/parent::areaset">
+          <xsl:call-template name="callout-bug">
+            <xsl:with-param name="conum">
+              <xsl:apply-templates select="$target/parent::areaset"
+                                   mode="conumber"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="callout-bug">
+            <xsl:with-param name="conum">
+              <xsl:apply-templates select="$target" mode="conumber"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>???</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="orderedlist-starting-number">
+  <xsl:param name="list" select="."/>
+  <xsl:variable name="pi-start">
+    <xsl:call-template name="pi.dbfo_start">
+      <xsl:with-param name="node" select="$list"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:call-template name="output-orderedlist-starting-number">
+    <xsl:with-param name="list" select="$list"/>
+    <xsl:with-param name="pi-start" select="$pi-start"/>
+  </xsl:call-template>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/pagesetup.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/pagesetup.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/pagesetup.xsl	(revision 119)
@@ -0,0 +1,3589 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version="1.0">
+
+<!-- ********************************************************************
+     $Id: pagesetup.xsl 9945 2014-09-28 16:18:14Z bobstayton $
+     ********************************************************************
+
+     This file is part of the DocBook XSL Stylesheet distribution.
+     See ../README or http://docbook.sf.net/ for copyright
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:param name="body.fontset">
+  <xsl:value-of select="$body.font.family"/>
+  <xsl:if test="$body.font.family != ''
+                and $symbol.font.family  != ''">,</xsl:if>
+  <xsl:value-of select="$symbol.font.family"/>
+</xsl:param>
+
+<xsl:param name="title.fontset">
+  <xsl:value-of select="$title.font.family"/>
+  <xsl:if test="$title.font.family != ''
+                and $symbol.font.family  != ''">,</xsl:if>
+  <xsl:value-of select="$symbol.font.family"/>
+</xsl:param>
+
+<xsl:param name="dingbat.fontset">
+  <xsl:value-of select="$dingbat.font.family"/>
+  <xsl:if test="$dingbat.font.family != ''
+                and $symbol.font.family  != ''">,</xsl:if>
+  <xsl:value-of select="$symbol.font.family"/>
+</xsl:param>
+
+<!-- These are internal parameters are for the individual precedence attributes -->
+<xsl:param name="region.start.precedence">
+  <xsl:choose>
+    <xsl:when test="$side.region.precedence = 'true'">true</xsl:when>
+    <xsl:otherwise>false</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:param name="region.end.precedence">
+  <xsl:choose>
+    <xsl:when test="$side.region.precedence = 'true'">true</xsl:when>
+    <xsl:otherwise>false</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:param name="region.before.precedence">
+  <xsl:choose>
+    <xsl:when test="$side.region.precedence = 'true'">false</xsl:when>
+    <xsl:otherwise>true</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:param name="region.after.precedence">
+  <xsl:choose>
+    <xsl:when test="$side.region.precedence = 'true'">false</xsl:when>
+    <xsl:otherwise>true</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:template name="setup.pagemasters">
+  <fo:layout-master-set>
+    <!-- blank pages -->
+    <fo:simple-page-master master-name="blank"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">blank</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body display-align="center"
+                      margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$fop.extensions = 0 and $fop1.extensions = 0">
+          <xsl:attribute name="region-name">blank-body</xsl:attribute>
+        </xsl:if>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-blank"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-blank"
+                       extent="{$region.after.extent}"
+                       precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">blank</xsl:with-param>
+        <xsl:with-param name="pageclass">blank</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">blank</xsl:with-param>
+        <xsl:with-param name="pageclass">blank</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <!-- title pages -->
+    <fo:simple-page-master master-name="titlepage-first"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">titlepage-first</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.titlepage}"
+                      column-count="{$column.count.titlepage}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-first"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-first"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="titlepage-odd"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">titlepage-odd</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.titlepage}"
+                      column-count="{$column.count.titlepage}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-odd"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-odd"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="titlepage-even"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">titlepage-even</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.titlepage}"
+                      column-count="{$column.count.titlepage}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-even"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-even"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <!-- list-of-title pages -->
+    <fo:simple-page-master master-name="lot-first"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">lot-first</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.lot}"
+                      column-count="{$column.count.lot}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-first"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-first"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">lot</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">lot</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="lot-odd"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">lot-odd</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.lot}"
+                      column-count="{$column.count.lot}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-odd"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-odd"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">lot</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">lot</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="lot-even"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">lot-even</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.lot}"
+                      column-count="{$column.count.lot}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-even"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-even"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">lot</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">lot</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <!-- frontmatter pages -->
+    <fo:simple-page-master master-name="front-first"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">front-first</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.front}"
+                      column-count="{$column.count.front}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-first"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-first"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">front</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">front</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="front-odd"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">front-odd</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.front}"
+                      column-count="{$column.count.front}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-odd"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-odd"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">front</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">front</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="front-even"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">front-even</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.front}"
+                      column-count="{$column.count.front}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-even"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-even"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                        display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">front</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">front</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <!-- body pages -->
+    <fo:simple-page-master master-name="body-first"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">body-first</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.body}"
+                      column-count="{$column.count.body}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-first"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-first"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">body</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">body</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="body-odd"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">body-odd</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.body}"
+                      column-count="{$column.count.body}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-odd"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-odd"
+                       extent="{$region.after.extent}"
+                       precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="pageclass">body</xsl:with-param>
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="pageclass">body</xsl:with-param>
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="body-even"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">body-even</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.body}"
+                      column-count="{$column.count.body}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-even"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-even"
+                       extent="{$region.after.extent}"
+                       precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="pageclass">body</xsl:with-param>
+        <xsl:with-param name="sequence">even</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="pageclass">body</xsl:with-param>
+        <xsl:with-param name="sequence">even</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <!-- backmatter pages -->
+    <fo:simple-page-master master-name="back-first"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">back-first</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.back}"
+                      column-count="{$column.count.back}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-first"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-first"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">back</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">back</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="back-odd"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">back-odd</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.back}"
+                      column-count="{$column.count.back}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-odd"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-odd"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">back</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">back</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="back-even"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">back-even</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.back}"
+                      column-count="{$column.count.back}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-even"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-even"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">back</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">back</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <!-- index pages -->
+    <fo:simple-page-master master-name="index-first"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">index-first</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.index}"
+                      column-count="{$column.count.index}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-first"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-first"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">index</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">first</xsl:with-param>
+        <xsl:with-param name="pageclass">index</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="index-odd"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.inner"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.outer"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">index-odd</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.index}"
+                      column-count="{$column.count.index}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-odd"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-odd"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">index</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">odd</xsl:with-param>
+        <xsl:with-param name="pageclass">index</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <fo:simple-page-master master-name="index-even"
+                           page-width="{$page.width}"
+                           page-height="{$page.height}"
+                           margin-top="{$page.margin.top}"
+                           margin-bottom="{$page.margin.bottom}">
+      <xsl:attribute name="margin-{$direction.align.start}">
+        <xsl:value-of select="$page.margin.outer"/>
+	<xsl:if test="$fop.extensions != 0">
+	  <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:attribute name="margin-{$direction.align.end}">
+        <xsl:value-of select="$page.margin.inner"/>
+      </xsl:attribute>
+      <xsl:if test="$axf.extensions != 0">
+        <xsl:call-template name="axf-page-master-properties">
+          <xsl:with-param name="page.master">index-even</xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+      <fo:region-body margin-bottom="{$body.margin.bottom}"
+                      margin-top="{$body.margin.top}"
+                      column-gap="{$column.gap.index}"
+                      column-count="{$column.count.index}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$body.margin.outer"/>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$body.margin.inner"/>
+        </xsl:attribute>
+      </fo:region-body>
+      <fo:region-before region-name="xsl-region-before-even"
+                        extent="{$region.before.extent}"
+                        precedence="{$region.before.precedence}"
+                        display-align="before"/>
+      <fo:region-after region-name="xsl-region-after-even"
+                       extent="{$region.after.extent}"
+                        precedence="{$region.after.precedence}"
+                       display-align="after"/>
+      <xsl:call-template name="region.outer">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">index</xsl:with-param>
+      </xsl:call-template>
+      <xsl:call-template name="region.inner">
+        <xsl:with-param name="sequence">even</xsl:with-param>
+        <xsl:with-param name="pageclass">index</xsl:with-param>
+      </xsl:call-template>
+    </fo:simple-page-master>
+
+    <xsl:if test="$draft.mode != 'no'">
+      <!-- draft blank pages -->
+      <fo:simple-page-master master-name="blank-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">blank-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-blank"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-blank"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">blank</xsl:with-param>
+          <xsl:with-param name="pageclass">blank</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">blank</xsl:with-param>
+          <xsl:with-param name="pageclass">blank</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <!-- draft title pages -->
+      <fo:simple-page-master master-name="titlepage-first-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">titlepage-first-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.titlepage}"
+                        column-count="{$column.count.titlepage}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-first"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-first"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="titlepage-odd-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">titlepage-odd-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.titlepage}"
+                        column-count="{$column.count.titlepage}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-odd"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-odd"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="titlepage-even-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">titlepage-even-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.titlepage}"
+                        column-count="{$column.count.titlepage}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-even"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-even"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">titlepage</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <!-- draft list-of-title pages -->
+      <fo:simple-page-master master-name="lot-first-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">lot-first-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.lot}"
+                        column-count="{$column.count.lot}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-first"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-first"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">lot</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">lot</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="lot-odd-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">lot-odd-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.lot}"
+                        column-count="{$column.count.lot}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-odd"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-odd"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">lot</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">lot</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="lot-even-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">lot-even-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.lot}"
+                        column-count="{$column.count.lot}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-even"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-even"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">lot</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">lot</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <!-- draft frontmatter pages -->
+      <fo:simple-page-master master-name="front-first-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">front-first-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.front}"
+                        column-count="{$column.count.front}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-first"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-first"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">front</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">front</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="front-odd-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">front-odd-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.front}"
+                        column-count="{$column.count.front}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-odd"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-odd"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">front</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">front</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="front-even-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">front-even-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.front}"
+                        column-count="{$column.count.front}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-even"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-even"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">front</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">front</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <!-- draft body pages -->
+      <fo:simple-page-master master-name="body-first-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">body-first-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.body}"
+                        column-count="{$column.count.body}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-first"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-first"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">body</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">body</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="body-odd-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">body-odd-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.body}"
+                        column-count="{$column.count.body}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-odd"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-odd"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">body</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">body</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="body-even-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">body-even-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.body}"
+                        column-count="{$column.count.body}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-even"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-even"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">body</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">body</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <!-- draft backmatter pages -->
+      <fo:simple-page-master master-name="back-first-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">back-first-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.back}"
+                        column-count="{$column.count.back}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-first"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-first"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">back</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">back</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="back-odd-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">back-odd-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.back}"
+                        column-count="{$column.count.back}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-odd"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-odd"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">back</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">back</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="back-even-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">back-even-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.back}"
+                        column-count="{$column.count.back}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-even"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-even"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">back</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">back</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <!-- draft index pages -->
+      <fo:simple-page-master master-name="index-first-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">index-first-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.index}"
+                        column-count="{$column.count.index}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-first"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-first"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">index</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">first</xsl:with-param>
+          <xsl:with-param name="pageclass">index</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="index-odd-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.inner"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.outer"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">index-odd-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.index}"
+                        column-count="{$column.count.index}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-odd"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-odd"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">index</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">odd</xsl:with-param>
+          <xsl:with-param name="pageclass">index</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+
+      <fo:simple-page-master master-name="index-even-draft"
+                             page-width="{$page.width}"
+                             page-height="{$page.height}"
+                             margin-top="{$page.margin.top}"
+                             margin-bottom="{$page.margin.bottom}">
+        <xsl:attribute name="margin-{$direction.align.start}">
+          <xsl:value-of select="$page.margin.outer"/>
+	  <xsl:if test="$fop.extensions != 0">
+	    <xsl:value-of select="concat(' - (',$title.margin.left,')')"/>
+          </xsl:if>
+        </xsl:attribute>
+        <xsl:attribute name="margin-{$direction.align.end}">
+          <xsl:value-of select="$page.margin.inner"/>
+        </xsl:attribute>
+        <xsl:if test="$axf.extensions != 0">
+          <xsl:call-template name="axf-page-master-properties">
+            <xsl:with-param name="page.master">index-even-draft</xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+        <fo:region-body margin-bottom="{$body.margin.bottom}"
+                        margin-top="{$body.margin.top}"
+                        column-gap="{$column.gap.index}"
+                        column-count="{$column.count.index}">
+          <xsl:attribute name="margin-{$direction.align.start}">
+            <xsl:value-of select="$body.margin.outer"/>
+          </xsl:attribute>
+          <xsl:attribute name="margin-{$direction.align.end}">
+            <xsl:value-of select="$body.margin.inner"/>
+          </xsl:attribute>
+          <xsl:if test="$draft.watermark.image != ''">
+            <xsl:attribute name="background-image">
+              <xsl:call-template name="fo-external-image">
+                <xsl:with-param name="filename" select="$draft.watermark.image"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="background-attachment">fixed</xsl:attribute>
+            <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
+            <xsl:attribute name="background-position-horizontal">center</xsl:attribute>
+            <xsl:attribute name="background-position-vertical">center</xsl:attribute>
+          </xsl:if>
+        </fo:region-body>
+        <fo:region-before region-name="xsl-region-before-even"
+                          extent="{$region.before.extent}"
+                          precedence="{$region.before.precedence}"
+                          display-align="before"/>
+        <fo:region-after region-name="xsl-region-after-even"
+                         extent="{$region.after.extent}"
+                          precedence="{$region.after.precedence}"
+                         display-align="after"/>
+        <xsl:call-template name="region.outer">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">index</xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="region.inner">
+          <xsl:with-param name="sequence">even</xsl:with-param>
+          <xsl:with-param name="pageclass">index</xsl:with-param>
+        </xsl:call-template>
+      </fo:simple-page-master>
+    </xsl:if>
+
+    <!-- setup for title page(s) -->
+    <fo:page-sequence-master master-name="titlepage">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="blank"
+                                              blank-or-not-blank="blank"/>
+        <xsl:if test="$force.blank.pages != 0">
+          <fo:conditional-page-master-reference master-reference="titlepage-first"
+                                                page-position="first"/>
+        </xsl:if>
+        <fo:conditional-page-master-reference master-reference="titlepage-odd"
+                                              odd-or-even="odd"/>
+        <fo:conditional-page-master-reference 
+                                              odd-or-even="even">
+          <xsl:attribute name="master-reference">
+            <xsl:choose>
+              <xsl:when test="$double.sided != 0">titlepage-even</xsl:when>
+              <xsl:otherwise>titlepage-odd</xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+        </fo:conditional-page-master-reference>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+
+    <!-- setup for lots -->
+    <fo:page-sequence-master master-name="lot">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="blank"
+                                              blank-or-not-blank="blank"/>
+        <xsl:if test="$force.blank.pages != 0">
+          <fo:conditional-page-master-reference master-reference="lot-first"
+                                                page-position="first"/>
+        </xsl:if>
+        <fo:conditional-page-master-reference master-reference="lot-odd"
+                                              odd-or-even="odd"/>
+        <fo:conditional-page-master-reference 
+                                              odd-or-even="even">
+          <xsl:attribute name="master-reference">
+            <xsl:choose>
+              <xsl:when test="$double.sided != 0">lot-even</xsl:when>
+              <xsl:otherwise>lot-odd</xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+        </fo:conditional-page-master-reference>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+
+    <!-- setup front matter -->
+    <fo:page-sequence-master master-name="front">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="blank"
+                                              blank-or-not-blank="blank"/>
+        <xsl:if test="$force.blank.pages != 0">
+          <fo:conditional-page-master-reference master-reference="front-first"
+                                                page-position="first"/>
+        </xsl:if>
+        <fo:conditional-page-master-reference master-reference="front-odd"
+                                              odd-or-even="odd"/>
+        <fo:conditional-page-master-reference 
+                                              odd-or-even="even">
+          <xsl:attribute name="master-reference">
+            <xsl:choose>
+              <xsl:when test="$double.sided != 0">front-even</xsl:when>
+              <xsl:otherwise>front-odd</xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+        </fo:conditional-page-master-reference>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+
+    <!-- setup for body pages -->
+    <fo:page-sequence-master master-name="body">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="blank"
+                                              blank-or-not-blank="blank"/>
+        <xsl:if test="$force.blank.pages != 0">
+          <fo:conditional-page-master-reference master-reference="body-first"
+                                                page-position="first"/>
+        </xsl:if>
+        <fo:conditional-page-master-reference master-reference="body-odd"
+                                              odd-or-even="odd"/>
+        <fo:conditional-page-master-reference 
+                                              odd-or-even="even">
+          <xsl:attribute name="master-reference">
+            <xsl:choose>
+              <xsl:when test="$double.sided != 0">body-even</xsl:when>
+              <xsl:otherwise>body-odd</xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+        </fo:conditional-page-master-reference>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+
+    <!-- setup back matter -->
+    <fo:page-sequence-master master-name="back">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="blank"
+                                              blank-or-not-blank="blank"/>
+        <xsl:if test="$force.blank.pages != 0">
+          <fo:conditional-page-master-reference master-reference="back-first"
+                                                page-position="first"/>
+        </xsl:if>
+        <fo:conditional-page-master-reference master-reference="back-odd"
+                                              odd-or-even="odd"/>
+        <fo:conditional-page-master-reference 
+                                              odd-or-even="even">
+          <xsl:attribute name="master-reference">
+            <xsl:choose>
+              <xsl:when test="$double.sided != 0">back-even</xsl:when>
+              <xsl:otherwise>back-odd</xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+        </fo:conditional-page-master-reference>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+
+    <!-- setup back matter -->
+    <fo:page-sequence-master master-name="index">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference master-reference="blank"
+                                              blank-or-not-blank="blank"/>
+        <xsl:if test="$force.blank.pages != 0">
+          <fo:conditional-page-master-reference master-reference="index-first"
+                                                page-position="first"/>
+        </xsl:if>
+        <fo:conditional-page-master-reference master-reference="index-odd"
+                                              odd-or-even="odd"/>
+        <fo:conditional-page-master-reference 
+                                              odd-or-even="even">
+          <xsl:attribute name="master-reference">
+            <xsl:choose>
+              <xsl:when test="$double.sided != 0">index-even</xsl:when>
+              <xsl:otherwise>index-odd</xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+        </fo:conditional-page-master-reference>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+
+    <xsl:if test="$draft.mode != 'no'">
+      <!-- setup for draft title page(s) -->
+      <fo:page-sequence-master master-name="titlepage-draft">
+        <fo:repeatable-page-master-alternatives>
+          <fo:conditional-page-master-reference master-reference="blank-draft"
+                                                blank-or-not-blank="blank"/>
+          <xsl:if test="$force.blank.pages != 0">
+            <fo:conditional-page-master-reference master-reference="titlepage-first-draft"
+                                                  page-position="first"/>
+          </xsl:if>
+          <fo:conditional-page-master-reference master-reference="titlepage-odd-draft"
+                                                odd-or-even="odd"/>
+          <fo:conditional-page-master-reference 
+                                                odd-or-even="even">
+            <xsl:attribute name="master-reference">
+              <xsl:choose>
+                <xsl:when test="$double.sided != 0">titlepage-even-draft</xsl:when>
+                <xsl:otherwise>titlepage-odd-draft</xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </fo:conditional-page-master-reference>
+        </fo:repeatable-page-master-alternatives>
+      </fo:page-sequence-master>
+
+      <!-- setup for draft lots -->
+      <fo:page-sequence-master master-name="lot-draft">
+        <fo:repeatable-page-master-alternatives>
+          <fo:conditional-page-master-reference master-reference="blank-draft"
+                                                blank-or-not-blank="blank"/>
+          <xsl:if test="$force.blank.pages != 0">
+            <fo:conditional-page-master-reference master-reference="lot-first-draft"
+                                                  page-position="first"/>
+          </xsl:if>
+          <fo:conditional-page-master-reference master-reference="lot-odd-draft"
+                                                odd-or-even="odd"/>
+          <fo:conditional-page-master-reference 
+                                                odd-or-even="even">
+            <xsl:attribute name="master-reference">
+              <xsl:choose>
+                <xsl:when test="$double.sided != 0">lot-even-draft</xsl:when>
+                <xsl:otherwise>lot-odd-draft</xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </fo:conditional-page-master-reference>
+        </fo:repeatable-page-master-alternatives>
+      </fo:page-sequence-master>
+
+      <!-- setup draft front matter -->
+      <fo:page-sequence-master master-name="front-draft">
+        <fo:repeatable-page-master-alternatives>
+          <fo:conditional-page-master-reference master-reference="blank-draft"
+                                                blank-or-not-blank="blank"/>
+          <xsl:if test="$force.blank.pages != 0">
+            <fo:conditional-page-master-reference master-reference="front-first-draft"
+                                                  page-position="first"/>
+          </xsl:if>
+          <fo:conditional-page-master-reference master-reference="front-odd-draft"
+                                                odd-or-even="odd"/>
+          <fo:conditional-page-master-reference 
+                                                odd-or-even="even">
+            <xsl:attribute name="master-reference">
+              <xsl:choose>
+                <xsl:when test="$double.sided != 0">front-even-draft</xsl:when>
+                <xsl:otherwise>front-odd-draft</xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </fo:conditional-page-master-reference>
+        </fo:repeatable-page-master-alternatives>
+      </fo:page-sequence-master>
+
+      <!-- setup for draft body pages -->
+      <fo:page-sequence-master master-name="body-draft">
+        <fo:repeatable-page-master-alternatives>
+          <fo:conditional-page-master-reference master-reference="blank-draft"
+                                                blank-or-not-blank="blank"/>
+          <xsl:if test="$force.blank.pages != 0">
+            <fo:conditional-page-master-reference master-reference="body-first-draft"
+                                                  page-position="first"/>
+          </xsl:if>
+          <fo:conditional-page-master-reference master-reference="body-odd-draft"
+                                                odd-or-even="odd"/>
+          <fo:conditional-page-master-reference 
+                                                odd-or-even="even">
+            <xsl:attribute name="master-reference">
+              <xsl:choose>
+                <xsl:when test="$double.sided != 0">body-even-draft</xsl:when>
+                <xsl:otherwise>body-odd-draft</xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </fo:conditional-page-master-reference>
+        </fo:repeatable-page-master-alternatives>
+      </fo:page-sequence-master>
+
+      <!-- setup draft back matter -->
+      <fo:page-sequence-master master-name="back-draft">
+        <fo:repeatable-page-master-alternatives>
+          <fo:conditional-page-master-reference master-reference="blank-draft"
+                                                blank-or-not-blank="blank"/>
+          <xsl:if test="$force.blank.pages != 0">
+            <fo:conditional-page-master-reference master-reference="back-first-draft"
+                                                  page-position="first"/>
+          </xsl:if>
+          <fo:conditional-page-master-reference master-reference="back-odd-draft"
+                                                odd-or-even="odd"/>
+          <fo:conditional-page-master-reference 
+                                                odd-or-even="even">
+            <xsl:attribute name="master-reference">
+              <xsl:choose>
+                <xsl:when test="$double.sided != 0">back-even-draft</xsl:when>
+                <xsl:otherwise>back-odd-draft</xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </fo:conditional-page-master-reference>
+        </fo:repeatable-page-master-alternatives>
+      </fo:page-sequence-master>
+
+      <!-- setup draft index pages -->
+      <fo:page-sequence-master master-name="index-draft">
+        <fo:repeatable-page-master-alternatives>
+          <fo:conditional-page-master-reference master-reference="blank-draft"
+                                                blank-or-not-blank="blank"/>
+          <xsl:if test="$force.blank.pages != 0">
+            <fo:conditional-page-master-reference master-reference="index-first-draft"
+                                                  page-position="first"/>
+          </xsl:if>
+          <fo:conditional-page-master-reference master-reference="index-odd-draft"
+                                                odd-or-even="odd"/>
+          <fo:conditional-page-master-reference 
+                                                odd-or-even="even">
+            <xsl:attribute name="master-reference">
+              <xsl:choose>
+                <xsl:when test="$double.sided != 0">index-even-draft</xsl:when>
+                <xsl:otherwise>index-odd-draft</xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </fo:conditional-page-master-reference>
+        </fo:repeatable-page-master-alternatives>
+      </fo:page-sequence-master>
+    </xsl:if>
+
+    <xsl:call-template name="user.pagemasters"/>
+
+    </fo:layout-master-set>
+  
+    <xsl:call-template name="user.declarations"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="user.pagemasters"/> <!-- intentionally empty -->
+
+<!-- ==================================================================== -->
+
+<xsl:template name="user.declarations"/> <!-- intentionally empty; add your fo:declarations -->
+
+
+<!-- ==================================================================== -->
+
+<xsl:template name="select.pagemaster">
+  <xsl:param name="element" select="local-name(.)"/>
+  <xsl:param name="pageclass" select="''"/>
+
+  <xsl:variable name="pagemaster">
+    <xsl:choose>
+      <xsl:when test="$pageclass != ''">
+        <xsl:value-of select="$pageclass"/>
+      </xsl:when>
+      <xsl:when test="$pageclass = 'lot'">lot</xsl:when>
+      <xsl:when test="$element = 'dedication'">front</xsl:when>
+      <xsl:when test="$element = 'acknowledgements'">front</xsl:when>
+      <xsl:when test="$element = 'preface'">front</xsl:when>
+      <xsl:when test="$element = 'appendix'">back</xsl:when>
+      <xsl:when test="$element = 'glossary'">back</xsl:when>
+      <xsl:when test="$element = 'bibliography'">back</xsl:when>
+      <xsl:when test="$element = 'index'">index</xsl:when>
+      <xsl:when test="$element = 'colophon'">back</xsl:when>
+      <xsl:otherwise>body</xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:choose>
+      <xsl:when test="$draft.mode = 'yes'">
+        <xsl:text>-draft</xsl:text>
+      </xsl:when>
+      <xsl:when test="$draft.mode = 'no'">
+        <!-- nop -->
+      </xsl:when>
+      <xsl:when test="ancestor-or-self::*[@status][1]/@status = 'draft'">
+        <xsl:text>-draft</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- nop -->
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="select.user.pagemaster">
+    <xsl:with-param name="element" select="$element"/>
+    <xsl:with-param name="pageclass" select="$pageclass"/>
+    <xsl:with-param name="default-pagemaster" select="$pagemaster"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="select.user.pagemaster">
+  <xsl:param name="element"/>
+  <xsl:param name="pageclass"/>
+  <xsl:param name="default-pagemaster"/>
+
+  <!-- by default, return the default. But if you've created your own
+       pagemasters in user.pagemasters, you might want to select one here. -->
+  <xsl:value-of select="$default-pagemaster"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="head.sep.rule">
+  <xsl:param name="pageclass"/>
+  <xsl:param name="sequence"/>
+  <xsl:param name="gentext-key"/>
+
+  <xsl:if test="$header.rule != 0">
+    <xsl:attribute name="border-bottom-width">0.5pt</xsl:attribute>
+    <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
+    <xsl:attribute name="border-bottom-color">black</xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="foot.sep.rule">
+  <xsl:param name="pageclass"/>
+  <xsl:param name="sequence"/>
+  <xsl:param name="gentext-key"/>
+
+  <xsl:if test="$footer.rule != 0">
+    <xsl:attribute name="border-top-width">0.5pt</xsl:attribute>
+    <xsl:attribute name="border-top-style">solid</xsl:attribute>
+    <xsl:attribute name="border-top-color">black</xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="running.head.mode">
+  <xsl:param name="master-reference" select="'unknown'"/>
+  <xsl:param name="gentext-key" select="local-name(.)"/>
+
+  <!-- remove -draft from reference -->
+  <xsl:variable name="pageclass">
+    <xsl:choose>
+      <xsl:when test="contains($master-reference, '-draft')">
+        <xsl:value-of select="substring-before($master-reference, '-draft')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$master-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:static-content flow-name="xsl-region-before-first">
+    <fo:block xsl:use-attribute-sets="header.content.properties">
+      <xsl:call-template name="header.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'first'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-before-odd">
+    <fo:block xsl:use-attribute-sets="header.content.properties">
+      <xsl:call-template name="header.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'odd'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-before-even">
+    <fo:block xsl:use-attribute-sets="header.content.properties">
+      <xsl:call-template name="header.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'even'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-before-blank">
+    <fo:block xsl:use-attribute-sets="header.content.properties">
+      <xsl:call-template name="header.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'blank'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <xsl:call-template name="footnote-separator"/>
+
+  <xsl:if test="$fop.extensions = 0 and $fop1.extensions = 0">
+    <xsl:call-template name="blank.page.content"/>
+  </xsl:if>
+
+  <xsl:apply-templates select="." mode="region.inner.mode">
+    <xsl:with-param name="master-reference" select="$master-reference"/>
+    <xsl:with-param name="gentext-key" select="$gentext-key"/>
+  </xsl:apply-templates>
+
+  <xsl:apply-templates select="." mode="region.outer.mode">
+    <xsl:with-param name="master-reference" select="$master-reference"/>
+    <xsl:with-param name="gentext-key" select="$gentext-key"/>
+  </xsl:apply-templates>
+
+</xsl:template>
+
+<xsl:template name="footnote-separator">
+  <fo:static-content flow-name="xsl-footnote-separator">
+    <fo:block>
+      <fo:leader xsl:use-attribute-sets="footnote.sep.leader.properties"/>
+    </fo:block>
+  </fo:static-content>
+</xsl:template>
+
+<xsl:template name="blank.page.content">
+  <fo:static-content flow-name="blank-body">
+    <fo:block text-align="center"/>
+  </fo:static-content>
+</xsl:template>
+
+<xsl:template name="running.side.content">
+  <xsl:apply-templates select="." mode="region.inner.mode"/>
+</xsl:template>
+
+<xsl:template name="header.table">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+  <!-- default is a single table style for all headers -->
+  <!-- Customize it for different page classes or sequence location -->
+
+  <xsl:variable name="column1">
+    <xsl:choose>
+      <xsl:when test="$double.sided = 0">1</xsl:when>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
+      <xsl:otherwise>3</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="column3">
+    <xsl:choose>
+      <xsl:when test="$double.sided = 0">3</xsl:when>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="candidate">
+    <fo:table xsl:use-attribute-sets="header.table.properties">
+      <xsl:call-template name="head.sep.rule">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="$sequence"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+
+      <xsl:choose>
+        <xsl:when test="$passivetex.extensions != 0">
+          <fo:table-column column-number="1">
+            <xsl:attribute name="column-width">
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">header</xsl:with-param>
+                <xsl:with-param name="position" select="$column1"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>%</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:table-column column-number="1">
+            <xsl:attribute name="column-width">
+              <xsl:text>proportional-column-width(</xsl:text>
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">header</xsl:with-param>
+                <xsl:with-param name="position" select="$column1"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>)</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:otherwise>
+			</xsl:choose>
+      <xsl:choose>
+        <xsl:when test="$passivetex.extensions != 0">
+          <fo:table-column column-number="2">
+            <xsl:attribute name="column-width">
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">header</xsl:with-param>
+                <xsl:with-param name="position" select="2"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>%</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:table-column column-number="2">
+            <xsl:attribute name="column-width">
+              <xsl:text>proportional-column-width(</xsl:text>
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">header</xsl:with-param>
+                <xsl:with-param name="position" select="2"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>)</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="$passivetex.extensions != 0">
+          <fo:table-column column-number="3">
+            <xsl:attribute name="column-width">
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">header</xsl:with-param>
+                <xsl:with-param name="position" select="$column3"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>%</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:table-column column-number="3">
+            <xsl:attribute name="column-width">
+              <xsl:text>proportional-column-width(</xsl:text>
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">header</xsl:with-param>
+                <xsl:with-param name="position" select="$column3"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>)</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <fo:table-body>
+        <fo:table-row>
+          <xsl:attribute name="block-progression-dimension.minimum">
+            <xsl:value-of select="$header.table.height"/>
+          </xsl:attribute>
+          <fo:table-cell text-align="start"
+                         display-align="before">
+            <xsl:if test="$fop.extensions = 0">
+              <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            </xsl:if>
+            <fo:block>
+              <xsl:call-template name="header.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="$direction.align.start"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+          <fo:table-cell text-align="center"
+                         display-align="before">
+            <xsl:if test="$fop.extensions = 0">
+              <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            </xsl:if>
+            <fo:block>
+              <xsl:call-template name="header.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="'center'"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+          <fo:table-cell text-align="right"
+                         display-align="before">
+            <xsl:if test="$fop.extensions = 0">
+              <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            </xsl:if>
+            <fo:block>
+              <xsl:call-template name="header.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="$direction.align.end"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+        </fo:table-row>
+      </fo:table-body>
+    </fo:table>
+  </xsl:variable>
+
+  <!-- Really output a header? -->
+  <xsl:choose>
+    <xsl:when test="$pageclass = 'titlepage' and $gentext-key = 'book'
+                    and $sequence='first'">
+      <!-- no, book titlepages have no headers at all -->
+    </xsl:when>
+    <xsl:when test="$sequence = 'blank' and $headers.on.blank.pages = 0">
+      <!-- no output -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$candidate"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="header.content">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="position" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+<!--
+  <fo:block>
+    <xsl:value-of select="$pageclass"/>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$sequence"/>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$position"/>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$gentext-key"/>
+  </fo:block>
+-->
+
+  <fo:block>
+
+    <!-- sequence can be odd, even, first, blank -->
+    <!-- position can be left, center, right -->
+    <xsl:choose>
+      <xsl:when test="$sequence = 'blank'">
+        <!-- nothing -->
+      </xsl:when>
+
+      <xsl:when test="$position='left'">
+        <!-- Same for odd, even, empty, and blank sequences -->
+        <xsl:call-template name="draft.text"/>
+      </xsl:when>
+
+      <xsl:when test="($sequence='odd' or $sequence='even') and $position='center'">
+        <xsl:if test="$pageclass != 'titlepage'">
+          <xsl:choose>
+            <xsl:when test="ancestor::book and ($double.sided != 0)">
+              <fo:retrieve-marker retrieve-class-name="section.head.marker"
+                                  retrieve-position="first-including-carryover"
+                                  retrieve-boundary="page-sequence"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:if>
+      </xsl:when>
+
+      <xsl:when test="$position='center'">
+        <!-- nothing for empty and blank sequences -->
+      </xsl:when>
+
+      <xsl:when test="$position='right'">
+        <!-- Same for odd, even, empty, and blank sequences -->
+        <xsl:call-template name="draft.text"/>
+      </xsl:when>
+
+      <xsl:when test="$sequence = 'first'">
+        <!-- nothing for first pages -->
+      </xsl:when>
+
+      <xsl:when test="$sequence = 'blank'">
+        <!-- nothing for blank pages -->
+      </xsl:when>
+    </xsl:choose>
+  </fo:block>
+</xsl:template>
+
+<xsl:template name="header.footer.width">
+  <xsl:param name="location" select="'header'"/>
+  <xsl:param name="position" select="1"/>
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+  <!-- The location param is either 'header' or 'footer'.
+       The position param is one of '1', '2', or '3' to indicate
+       which column of the header or footer table. -->
+       
+  <!-- The pageclass, sequence, and gentext-key values are passed
+       from the header.table or footer.table template.  They are
+       not currently used, but are made available here
+       for customization of this template. -->
+
+  <xsl:variable name="width.set">
+    <xsl:choose>
+      <xsl:when test="$location = 'header'">
+        <xsl:value-of select="normalize-space($header.column.widths)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space($footer.column.widths)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+
+  <xsl:variable name="width">
+    <xsl:choose>
+      <xsl:when test="$position = 1">
+        <xsl:value-of select="substring-before($width.set, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$position = 2">
+        <xsl:value-of select="substring-before(substring-after($width.set, ' '), ' ')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="substring-after(substring-after($width.set, ' '), ' ')"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- Make sure it is a number -->
+  <xsl:choose>
+    <xsl:when test = "$width = number($width)">
+      <xsl:value-of select="$width"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>Error: value in <xsl:value-of select="$location"/>.column.widths at position <xsl:value-of select="$position"/> is not a number.</xsl:message>
+      <xsl:text>1</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="draft.text">
+  <xsl:choose>
+    <xsl:when test="$draft.mode = 'yes'">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'Draft'"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$draft.mode = 'no'">
+      <!-- nop -->
+    </xsl:when>
+    <xsl:when test="ancestor-or-self::*[@status][1]/@status = 'draft'">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'Draft'"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- nop -->
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="running.foot.mode">
+  <xsl:param name="master-reference" select="'unknown'"/>
+  <xsl:param name="gentext-key" select="local-name(.)"/>
+
+  <!-- remove -draft from reference -->
+  <xsl:variable name="pageclass">
+    <xsl:choose>
+      <xsl:when test="contains($master-reference, '-draft')">
+        <xsl:value-of select="substring-before($master-reference, '-draft')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$master-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:static-content flow-name="xsl-region-after-first">
+    <fo:block xsl:use-attribute-sets="footer.content.properties">
+      <xsl:call-template name="footer.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'first'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-after-odd">
+    <fo:block xsl:use-attribute-sets="footer.content.properties">
+      <xsl:call-template name="footer.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'odd'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-after-even">
+    <fo:block xsl:use-attribute-sets="footer.content.properties">
+      <xsl:call-template name="footer.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'even'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-after-blank">
+    <fo:block xsl:use-attribute-sets="footer.content.properties">
+      <xsl:call-template name="footer.table">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="'blank'"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+    </fo:block>
+  </fo:static-content>
+</xsl:template>
+
+<xsl:template name="footer.table">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+  <!-- default is a single table style for all footers -->
+  <!-- Customize it for different page classes or sequence location -->
+
+  <xsl:variable name="column1">
+    <xsl:choose>
+      <xsl:when test="$double.sided = 0">1</xsl:when>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
+      <xsl:otherwise>3</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="column3">
+    <xsl:choose>
+      <xsl:when test="$double.sided = 0">3</xsl:when>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="candidate">
+    <fo:table xsl:use-attribute-sets="footer.table.properties">
+      <xsl:call-template name="foot.sep.rule">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="$sequence"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+      <xsl:choose>
+        <xsl:when test="$passivetex.extensions != 0">
+          <fo:table-column column-number="1">
+            <xsl:attribute name="column-width">
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">footer</xsl:with-param>
+                <xsl:with-param name="position" select="$column1"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>%</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:table-column column-number="1">
+            <xsl:attribute name="column-width">
+              <xsl:text>proportional-column-width(</xsl:text>
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">footer</xsl:with-param>
+                <xsl:with-param name="position" select="$column1"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>)</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="$passivetex.extensions != 0">
+          <fo:table-column column-number="2">
+            <xsl:attribute name="column-width">
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">footer</xsl:with-param>
+                <xsl:with-param name="position" select="2"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>%</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:table-column column-number="2">
+            <xsl:attribute name="column-width">
+              <xsl:text>proportional-column-width(</xsl:text>
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">footer</xsl:with-param>
+                <xsl:with-param name="position" select="2"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>)</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:choose>
+        <xsl:when test="$passivetex.extensions != 0">
+          <fo:table-column column-number="3">
+            <xsl:attribute name="column-width">
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">footer</xsl:with-param>
+                <xsl:with-param name="position" select="$column3"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>%</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:table-column column-number="3">
+            <xsl:attribute name="column-width">
+              <xsl:text>proportional-column-width(</xsl:text>
+              <xsl:call-template name="header.footer.width">
+                <xsl:with-param name="location">footer</xsl:with-param>
+                <xsl:with-param name="position" select="$column3"/>
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+              <xsl:text>)</xsl:text>
+            </xsl:attribute>
+          </fo:table-column>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <fo:table-body>
+        <fo:table-row>
+          <xsl:attribute name="block-progression-dimension.minimum">
+            <xsl:value-of select="$footer.table.height"/>
+          </xsl:attribute>
+          <fo:table-cell text-align="start"
+                         display-align="after">
+            <xsl:if test="$fop.extensions = 0">
+              <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            </xsl:if>
+            <fo:block>
+              <xsl:call-template name="footer.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="$direction.align.start"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+          <fo:table-cell text-align="center"
+                         display-align="after">
+            <xsl:if test="$fop.extensions = 0">
+              <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            </xsl:if>
+            <fo:block>
+              <xsl:call-template name="footer.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="'center'"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+          <fo:table-cell text-align="end"
+                         display-align="after">
+            <xsl:if test="$fop.extensions = 0">
+              <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            </xsl:if>
+            <fo:block>
+              <xsl:call-template name="footer.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="$direction.align.end"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+        </fo:table-row>
+      </fo:table-body>
+    </fo:table>
+  </xsl:variable>
+
+  <!-- Really output a footer? -->
+  <xsl:choose>
+    <xsl:when test="$pageclass='titlepage' and $gentext-key='book'
+                    and $sequence='first'">
+      <!-- no, book titlepages have no footers at all -->
+    </xsl:when>
+    <xsl:when test="$sequence = 'blank' and $footers.on.blank.pages = 0">
+      <!-- no output -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$candidate"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="footer.content">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="position" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+<!--
+  <fo:block>
+    <xsl:value-of select="$pageclass"/>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$sequence"/>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$position"/>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$gentext-key"/>
+  </fo:block>
+-->
+
+  <fo:block>
+    <!-- pageclass can be front, body, back -->
+    <!-- sequence can be odd, even, first, blank -->
+    <!-- position can be left, center, right -->
+    <xsl:choose>
+      <xsl:when test="$pageclass = 'titlepage'">
+        <!-- nop; no footer on title pages -->
+      </xsl:when>
+
+      <xsl:when test="$double.sided != 0 and $sequence = 'even'
+                      and $position='left'">
+        <fo:page-number/>
+      </xsl:when>
+
+      <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
+                      and $position='right'">
+        <fo:page-number/>
+      </xsl:when>
+
+      <xsl:when test="$double.sided = 0 and $position='center'">
+        <fo:page-number/>
+      </xsl:when>
+
+      <xsl:when test="$sequence='blank'">
+        <xsl:choose>
+          <xsl:when test="$double.sided != 0 and $position = 'left'">
+            <fo:page-number/>
+          </xsl:when>
+          <xsl:when test="$double.sided = 0 and $position = 'center'">
+            <fo:page-number/>
+          </xsl:when>
+          <xsl:otherwise>
+            <!-- nop -->
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+
+
+      <xsl:otherwise>
+        <!-- nop -->
+      </xsl:otherwise>
+    </xsl:choose>
+  </fo:block>
+</xsl:template>
+
+<!-- ==================================================================== -->
+<xsl:template match="*" mode="region.inner.mode">
+  <xsl:param name="master-reference" select="'unknown'"/>
+  <xsl:param name="gentext-key" select="local-name(.)"/>
+
+  <!-- remove -draft from reference -->
+  <xsl:variable name="pageclass">
+    <xsl:choose>
+      <xsl:when test="contains($master-reference, '-draft')">
+        <xsl:value-of select="substring-before($master-reference, '-draft')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$master-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:static-content flow-name="xsl-region-inner-first">
+    <xsl:call-template name="inner.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'first'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-inner-odd">
+    <xsl:call-template name="inner.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'odd'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-inner-even">
+    <xsl:call-template name="inner.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'even'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-inner-blank">
+    <xsl:call-template name="inner.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'blank'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+</xsl:template>
+
+<xsl:template match="*" mode="region.outer.mode">
+  <xsl:param name="master-reference" select="'unknown'"/>
+  <xsl:param name="gentext-key" select="local-name(.)"/>
+
+  <!-- remove -draft from reference -->
+  <xsl:variable name="pageclass">
+    <xsl:choose>
+      <xsl:when test="contains($master-reference, '-draft')">
+        <xsl:value-of select="substring-before($master-reference, '-draft')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$master-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:static-content flow-name="xsl-region-outer-first">
+    <xsl:call-template name="outer.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'first'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-outer-odd">
+    <xsl:call-template name="outer.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'odd'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-outer-even">
+    <xsl:call-template name="outer.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'even'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+  <fo:static-content flow-name="xsl-region-outer-blank">
+    <xsl:call-template name="outer.region.content">
+      <xsl:with-param name="pageclass" select="$pageclass"/>
+      <xsl:with-param name="sequence" select="'blank'"/>
+      <xsl:with-param name="gentext-key" select="$gentext-key"/>
+    </xsl:call-template>
+  </fo:static-content>
+
+</xsl:template>
+
+<xsl:template name="inner.region.content">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="position" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+  <!-- pageclass can be front, body, back -->
+  <!-- sequence can be odd, even, first, blank -->
+  <!-- position can be left, center, right -->
+
+  <!-- Customize to add side region content-->
+  <fo:block xsl:use-attribute-sets="inner.region.content.properties">
+    <!-- Add your content here -->
+  </fo:block>
+</xsl:template>
+
+<xsl:template name="outer.region.content">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="position" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+
+  <!-- pageclass can be front, body, back -->
+  <!-- sequence can be odd, even, first, blank -->
+  <!-- position can be left, center, right -->
+
+  <!-- Customize to add side region content-->
+  <fo:block xsl:use-attribute-sets="outer.region.content.properties">
+    <!-- Add your content here -->
+  </fo:block>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="page.number.format">
+  <xsl:param name="element" select="local-name(.)"/>
+  <xsl:param name="master-reference" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="$element = 'toc' and self::book">i</xsl:when>
+    <xsl:when test="$element = 'set'">i</xsl:when>
+    <xsl:when test="$element = 'book'">i</xsl:when>
+    <xsl:when test="$element = 'preface'">i</xsl:when>
+    <xsl:when test="$element = 'dedication'">i</xsl:when>
+    <xsl:when test="$element = 'acknowledgements'">i</xsl:when>
+    <xsl:otherwise>1</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="initial.page.number">
+  <xsl:param name="element" select="local-name(.)"/>
+  <xsl:param name="master-reference" select="''"/>
+
+  <xsl:variable name="first">
+    <xsl:choose>
+      <xsl:when test="$force.blank.pages = 0">auto</xsl:when>
+      <xsl:otherwise>auto-odd</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <!-- Select the first content that the stylesheet places
+       after the TOC -->
+  <xsl:variable name="first.book.content" 
+                select="ancestor::book/*[
+                          not(self::title or
+                              self::subtitle or
+                              self::titleabbrev or
+                              self::bookinfo or
+                              self::info or
+                              self::dedication or
+                              self::acknowledgements or
+                              self::preface or
+                              self::toc or
+                              self::lot)][1]"/>
+  <xsl:choose>
+    <!-- double-sided output -->
+    <xsl:when test="$double.sided != 0">
+      <xsl:choose>
+        <xsl:when test="$element = 'toc'"><xsl:value-of select="$first"/></xsl:when>
+        <xsl:when test="$element = 'book'"><xsl:value-of select="$first"/></xsl:when>
+        <!-- preface typically continues TOC roman numerals -->
+        <!-- If changed to 1 here, then change page.number.format too -->
+        <xsl:when test="$element = 'preface'"><xsl:value-of select="$first"/></xsl:when>
+        <xsl:when test="($element = 'dedication' or $element = 'article') 
+                    and not(preceding::chapter
+                            or preceding::preface
+                            or preceding::appendix
+                            or preceding::article
+                            or preceding::dedication
+                            or parent::part
+                            or parent::reference)">1</xsl:when>
+        <xsl:when test="generate-id($first.book.content) =
+                        generate-id(.)">1</xsl:when>
+        <xsl:otherwise><xsl:value-of select="$first"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
+    <!-- single-sided output -->
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$element = 'toc'">auto</xsl:when>
+        <xsl:when test="$element = 'book'">auto</xsl:when>
+        <xsl:when test="$element = 'preface'">auto</xsl:when>
+       <xsl:when test="($element = 'dedication' or $element = 'article') and
+                        not(preceding::chapter
+                            or preceding::preface
+                            or preceding::appendix
+                            or preceding::article
+                            or preceding::dedication
+                            or parent::part
+                            or parent::reference)">1</xsl:when>
+        <xsl:when test="generate-id($first.book.content) =
+                        generate-id(.)">1</xsl:when>
+        <xsl:otherwise>auto</xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="force.page.count">
+  <xsl:param name="element" select="local-name(.)"/>
+  <xsl:param name="master-reference" select="''"/>
+
+  <xsl:choose>
+    <!-- no automatic even blank pages at end of chapters -->
+    <xsl:when test="$force.blank.pages = 0">no-force</xsl:when>
+    <!-- double-sided output -->
+    <xsl:when test="$double.sided != 0">end-on-even</xsl:when>
+    <!-- single-sided output -->
+    <xsl:otherwise>no-force</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="set.flow.properties">
+  <xsl:param name="element" select="local-name(.)"/>
+  <xsl:param name="master-reference" select="''"/>
+
+  <!-- This template is called after each <fo:flow> starts. -->
+  <!-- Customize this template to set attributes on fo:flow -->
+
+  <!-- remove -draft from reference -->
+  <xsl:variable name="pageclass">
+    <xsl:choose>
+      <xsl:when test="contains($master-reference, '-draft')">
+        <xsl:value-of select="substring-before($master-reference, '-draft')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$master-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$fop.extensions != 0">
+      <!-- body.start.indent does not work well with these processors -->
+    </xsl:when>
+    <xsl:when test="starts-with($pageclass, 'body') or
+                    starts-with($pageclass, 'lot') or
+                    starts-with($pageclass, 'front') or
+                    $element = 'preface' or
+                    (starts-with($pageclass, 'back') and
+                    $element = 'appendix')">
+      <xsl:attribute name="start-indent">
+        <xsl:value-of select="$body.start.indent"/>
+      </xsl:attribute>
+      <xsl:attribute name="end-indent">
+        <xsl:value-of select="$body.end.indent"/>
+      </xsl:attribute>
+    </xsl:when>
+  </xsl:choose>
+
+</xsl:template>
+<!-- ==================================================================== -->
+
+<!-- Customize this template for custom side regions -->
+<xsl:template name="region.inner">
+  <xsl:param name="sequence">blank</xsl:param>
+  <xsl:param name="classname">blank</xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$sequence = 'first' or $sequence = 'odd'">
+      <fo:region-start xsl:use-attribute-sets="region.inner.properties">
+        <xsl:attribute name="region-name">
+          <xsl:text>xsl-region-inner-</xsl:text>
+          <xsl:value-of select="$sequence"/>
+        </xsl:attribute>
+        <xsl:attribute name="precedence">
+          <xsl:value-of select="$region.start.precedence"/>
+        </xsl:attribute>
+        <xsl:attribute name="extent">
+          <xsl:value-of select="$region.inner.extent"/>
+        </xsl:attribute>
+      </fo:region-start>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:region-end xsl:use-attribute-sets="region.inner.properties">
+        <xsl:attribute name="region-name">
+          <xsl:text>xsl-region-inner-</xsl:text>
+          <xsl:value-of select="$sequence"/>
+        </xsl:attribute>
+        <xsl:attribute name="precedence">
+          <xsl:value-of select="$region.end.precedence"/>
+        </xsl:attribute>
+        <xsl:attribute name="extent">
+          <xsl:value-of select="$region.inner.extent"/>
+        </xsl:attribute>
+      </fo:region-end>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- Customize this template for custom side regions -->
+<xsl:template name="region.outer">
+  <xsl:param name="sequence">blank</xsl:param>
+  <xsl:param name="classname">blank</xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$sequence = 'first' or $sequence = 'odd'">
+      <fo:region-end xsl:use-attribute-sets="region.outer.properties">
+        <xsl:attribute name="region-name">
+          <xsl:text>xsl-region-outer-</xsl:text>
+          <xsl:value-of select="$sequence"/>
+        </xsl:attribute>
+        <xsl:attribute name="precedence">
+          <xsl:value-of select="$region.start.precedence"/>
+        </xsl:attribute>
+        <xsl:attribute name="extent">
+          <xsl:value-of select="$region.outer.extent"/>
+        </xsl:attribute>
+      </fo:region-end>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:region-start xsl:use-attribute-sets="region.outer.properties">
+        <xsl:attribute name="region-name">
+          <xsl:text>xsl-region-outer-</xsl:text>
+          <xsl:value-of select="$sequence"/>
+        </xsl:attribute>
+        <xsl:attribute name="precedence">
+          <xsl:value-of select="$region.end.precedence"/>
+        </xsl:attribute>
+        <xsl:attribute name="extent">
+          <xsl:value-of select="$region.outer.extent"/>
+        </xsl:attribute>
+      </fo:region-start>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/param.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/param.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/fo/param.xsl	(revision 119)
@@ -0,0 +1,1048 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<!-- This file is generated from param.xweb -->
+
+<!-- ********************************************************************
+     $Id: param.xweb 9996 2015-10-01 16:35:10Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<xsl:attribute-set name="abstract.properties">
+  <xsl:attribute name="start-indent">0.0in</xsl:attribute>
+  <xsl:attribute name="end-indent">0.0in</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="abstract.title.properties">
+  <xsl:attribute name="font-family"><xsl:value-of select="$title.fontset"/></xsl:attribute>
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="space-before.optimum"><xsl:value-of select="concat($body.font.master, 'pt')"/></xsl:attribute>
+  <xsl:attribute name="space-before.minimum"><xsl:value-of select="concat(($body.font.master * 0.8), 'pt')"/></xsl:attribute>
+  <xsl:attribute name="space-before.maximum"><xsl:value-of select="concat(($body.font.master * 1.2), 'pt')"/></xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="text-align">center</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="activate.external.olinks" select="1"/>
+<xsl:param name="admon.graphics.extension">.png</xsl:param>
+<xsl:param name="admon.graphics" select="0"/>
+<xsl:param name="admon.graphics.path">images/</xsl:param>
+<xsl:param name="admon.textlabel" select="1"/>
+<xsl:attribute-set name="admonition.properties"/>
+<xsl:attribute-set name="admonition.title.properties">
+  <xsl:attribute name="font-size">14pt</xsl:attribute>
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="base.dir"/>
+<xsl:attribute-set name="graphical.admonition.properties">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">1.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="nongraphical.admonition.properties">
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="margin-{$direction.align.start}">0.25in</xsl:attribute>
+  <xsl:attribute name="margin-{$direction.align.end}">0.25in</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="alignment">justify</xsl:param>
+<xsl:param name="appendix.autolabel">A</xsl:param>
+<xsl:param name="arbortext.extensions" select="0"/>
+<xsl:attribute-set name="article.appendix.title.properties" use-attribute-sets="section.title.properties                          section.title.level1.properties">
+</xsl:attribute-set>
+<xsl:param name="author.othername.in.middle" select="1"/>
+<xsl:param name="autotoc.label.separator">. </xsl:param>
+<xsl:param name="axf.extensions" select="0"/>
+<xsl:param name="biblioentry.item.separator">. </xsl:param>
+<xsl:attribute-set name="biblioentry.properties" use-attribute-sets="normal.para.spacing">
+  <xsl:attribute name="start-indent">0.5in</xsl:attribute>
+  <xsl:attribute name="text-indent">-0.5in</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="bibliography.collection">http://docbook.sourceforge.net/release/bibliography/bibliography.xml</xsl:param>
+
+<xsl:param name="bibliography.numbered" select="0"/>
+<xsl:param name="bibliography.style">normal</xsl:param>
+<xsl:attribute-set name="blockquote.properties">
+<xsl:attribute name="margin-{$direction.align.start}">0.5in</xsl:attribute>
+<xsl:attribute name="margin-{$direction.align.end}">0.5in</xsl:attribute>
+<xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
+<xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+<xsl:attribute name="space-after.maximum">2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="body.font.family">serif</xsl:param>
+<xsl:param name="body.font.master">10</xsl:param>
+<xsl:param name="body.font.size">
+ <xsl:value-of select="$body.font.master"/><xsl:text>pt</xsl:text>
+</xsl:param>
+<xsl:param name="body.margin.bottom">0.5in</xsl:param>
+<xsl:param name="body.margin.top">0.5in</xsl:param>
+<xsl:param name="body.start.indent">
+  <xsl:choose>
+    <xsl:when test="$fop.extensions != 0">0pt</xsl:when>
+    <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+    <xsl:otherwise>4pc</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="body.end.indent">0pt</xsl:param>
+<xsl:param name="bookmarks.collapse" select="1"/>
+<xsl:param name="bridgehead.in.toc" select="0"/>
+<xsl:attribute-set name="calloutlist.properties">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="provisional-distance-between-starts">2.2em</xsl:attribute>
+  <xsl:attribute name="provisional-label-separation">0.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="callout.properties">
+</xsl:attribute-set>
+<xsl:param name="callout.defaultcolumn">60</xsl:param>
+
+<xsl:param name="callout.graphics.extension">.svg</xsl:param>
+<xsl:param name="callout.graphics" select="1"/>
+<xsl:param name="callout.icon.size">7pt</xsl:param>
+
+<xsl:param name="callout.graphics.number.limit">30</xsl:param>
+<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
+<xsl:param name="callout.unicode.font">ZapfDingbats</xsl:param>
+<xsl:param name="callout.unicode" select="0"/>
+<xsl:param name="callout.unicode.number.limit">10</xsl:param>
+<xsl:param name="callout.unicode.start.character">10102</xsl:param>
+<xsl:param name="callouts.extension" select="1"/>
+<xsl:param name="chapter.autolabel" select="1"/>
+<xsl:param name="chunk.quietly" select="0"/>
+<xsl:param name="collect.xref.targets">no</xsl:param>
+<xsl:param name="column.count.back" select="1"/>
+<xsl:param name="column.count.body" select="1"/>
+<xsl:param name="column.count.front" select="1"/>
+<xsl:param name="column.count.index">2</xsl:param>
+<xsl:param name="column.count.lot" select="1"/>
+<xsl:param name="column.count.titlepage" select="1"/>
+<xsl:param name="column.gap.back">12pt</xsl:param>
+<xsl:param name="column.gap.body">12pt</xsl:param>
+<xsl:param name="column.gap.front">12pt</xsl:param>
+<xsl:param name="column.gap.index">12pt</xsl:param>
+<xsl:param name="column.gap.lot">12pt</xsl:param>
+<xsl:param name="column.gap.titlepage">12pt</xsl:param>
+<xsl:attribute-set name="compact.list.item.spacing">
+  <xsl:attribute name="space-before.optimum">0em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">0.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="component.label.includes.part.label" select="0"/>
+<xsl:attribute-set name="component.title.properties">
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="space-before.optimum"><xsl:value-of select="concat($body.font.master, 'pt')"/></xsl:attribute>
+  <xsl:attribute name="space-before.minimum"><xsl:value-of select="concat($body.font.master*0.8, 'pt')"/></xsl:attribute>
+  <xsl:attribute name="space-before.maximum"><xsl:value-of select="concat($body.font.master*1.2, 'pt')"/></xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="text-align">
+    <xsl:choose>
+      <xsl:when test="((parent::article | parent::articleinfo | parent::info/parent::article) and not(ancestor::book) and not(self::bibliography))         or (parent::slides | parent::slidesinfo)">center</xsl:when>
+      <xsl:otherwise>start</xsl:otherwise>
+    </xsl:choose>
+  </xsl:attribute>
+  <xsl:attribute name="start-indent"><xsl:value-of select="$title.margin.left"/></xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="component.titlepage.properties">
+</xsl:attribute-set>
+<xsl:param name="crop.marks" select="0"/>
+<xsl:param name="crop.mark.width">0.5pt</xsl:param>
+<xsl:param name="crop.mark.offset">24pt</xsl:param>
+<xsl:param name="crop.mark.bleed">6pt</xsl:param>
+<xsl:param name="current.docid"/>
+<xsl:param name="default.float.class">
+  <xsl:choose>
+    <xsl:when test="contains($stylesheet.result.type,'html')">left</xsl:when>
+    <xsl:otherwise>before</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="default.image.width"/>
+<xsl:param name="default.table.width"/>
+<xsl:param name="default.table.frame">all</xsl:param>
+<xsl:param name="default.table.rules">none</xsl:param>
+<xsl:param name="default.units">pt</xsl:param>
+<xsl:param name="dingbat.font.family">serif</xsl:param>
+<xsl:param name="double.sided" select="0"/>
+<xsl:param name="draft.mode">no</xsl:param>
+<xsl:param name="draft.watermark.image">images/draft.png</xsl:param>
+
+<xsl:param name="ebnf.assignment">
+  <fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="{$monospace.font.family}">
+    <xsl:text>::=</xsl:text>
+  </fo:inline>
+</xsl:param>
+
+<xsl:param name="ebnf.statement.terminator"/>
+<xsl:param name="email.delimiters.enabled" select="1"/>
+<xsl:param name="email.mailto.enabled" select="0"/>
+<xsl:attribute-set name="equation.properties" use-attribute-sets="formal.object.properties"/>
+<xsl:attribute-set name="equation.number.properties">
+  <xsl:attribute name="text-align">end</xsl:attribute>
+  <xsl:attribute name="display-align">center</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="example.properties" use-attribute-sets="formal.object.properties">
+    <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="exsl.node.set.available"> 
+  <xsl:choose>
+    <xsl:when xmlns:exsl="http://exslt.org/common" exsl:foo="" test="function-available('exsl:node-set') or                        contains(system-property('xsl:vendor'),                          'Apache Software Foundation')">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:attribute-set name="figure.properties" use-attribute-sets="formal.object.properties"/>
+<xsl:param name="firstterm.only.link" select="0"/>
+<xsl:attribute-set name="footer.content.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$body.fontset"/>
+  </xsl:attribute>
+  <xsl:attribute name="margin-left">
+    <xsl:value-of select="$title.margin.left"/>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="footer.rule" select="1"/>
+<xsl:param name="footer.column.widths">1 1 1</xsl:param>
+<xsl:param name="footer.table.height">14pt</xsl:param>
+<xsl:attribute-set name="footer.table.properties">
+  <xsl:attribute name="table-layout">fixed</xsl:attribute>
+  <xsl:attribute name="width">100%</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="footers.on.blank.pages" select="1"/>
+<xsl:param name="footnote.font.size">
+ <xsl:value-of select="$body.font.master * 0.8"/><xsl:text>pt</xsl:text>
+</xsl:param>
+<xsl:param name="footnote.number.format">1</xsl:param>
+<xsl:param name="footnote.number.symbols"/>
+<xsl:attribute-set name="footnote.mark.properties">
+  <xsl:attribute name="font-family"><xsl:value-of select="$body.fontset"/></xsl:attribute>
+  <xsl:attribute name="font-size">75%</xsl:attribute>
+  <xsl:attribute name="font-weight">normal</xsl:attribute>
+  <xsl:attribute name="font-style">normal</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="footnote.properties">
+  <xsl:attribute name="font-family"><xsl:value-of select="$body.fontset"/></xsl:attribute>
+  <xsl:attribute name="font-size"><xsl:value-of select="$footnote.font.size"/></xsl:attribute>
+  <xsl:attribute name="font-weight">normal</xsl:attribute>
+  <xsl:attribute name="font-style">normal</xsl:attribute>
+  <xsl:attribute name="text-align"><xsl:value-of select="$alignment"/></xsl:attribute>
+  <xsl:attribute name="start-indent">0pt</xsl:attribute>
+  <xsl:attribute name="end-indent">0pt</xsl:attribute>
+  <xsl:attribute name="text-indent">0pt</xsl:attribute>
+  <xsl:attribute name="hyphenate"><xsl:value-of select="$hyphenate"/></xsl:attribute>
+  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
+  <xsl:attribute name="linefeed-treatment">treat-as-space</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="footnote.sep.leader.properties">
+  <xsl:attribute name="color">black</xsl:attribute>
+  <xsl:attribute name="leader-pattern">rule</xsl:attribute>
+  <xsl:attribute name="leader-length">1in</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="fop.extensions" select="0"/>
+<xsl:param name="fop1.extensions" select="0"/>
+<xsl:param name="force.blank.pages" select="1"/>
+<xsl:attribute-set name="formal.object.properties">
+  <xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">2em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">2em</xsl:attribute>
+  <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="formal.procedures" select="1"/>
+<xsl:param name="formal.title.placement">
+figure before
+example before
+equation before
+table before
+procedure before
+task before
+</xsl:param>
+<xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.2"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="funcsynopsis.decoration" select="1"/>
+<xsl:param name="funcsynopsis.style">kr</xsl:param>
+<xsl:param name="function.parens" select="0"/>
+<xsl:param name="generate.consistent.ids" select="0"/>
+<xsl:param name="generate.index" select="1"/>
+<xsl:param name="generate.section.toc.level" select="0"/>
+
+<xsl:param name="generate.toc">
+/appendix toc,title
+article/appendix  nop
+/article  toc,title
+book      toc,title,figure,table,example,equation
+/chapter  toc,title
+part      toc,title
+/preface  toc,title
+reference toc,title
+/sect1    toc
+/sect2    toc
+/sect3    toc
+/sect4    toc
+/sect5    toc
+/section  toc
+set       toc,title
+</xsl:param>
+<xsl:param name="glossary.as.blocks" select="0"/>
+<xsl:param name="glossary.collection"/>
+<xsl:param name="glossary.sort" select="0"/>
+<xsl:param name="glossentry.show.acronym">no</xsl:param>
+<xsl:param name="glosslist.as.blocks" select="0"/>
+<xsl:param name="glossterm.auto.link" select="0"/>
+<xsl:param name="glossterm.separation">0.25in</xsl:param>
+<xsl:param name="glossterm.width">2in</xsl:param>
+<xsl:attribute-set name="glossentry.list.item.properties">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="glossterm.list.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="glossterm.block.properties">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="glossdef.list.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="glossdef.block.properties">
+  <xsl:attribute name="margin-{$direction.align.start}">.25in</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="graphic.default.extension"/>
+<xsl:attribute-set name="header.content.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$body.fontset"/>
+  </xsl:attribute>
+  <xsl:attribute name="margin-left">
+    <xsl:value-of select="$title.margin.left"/>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="header.rule" select="1"/>
+<xsl:param name="header.column.widths">1 1 1</xsl:param>
+<xsl:param name="header.table.height">14pt</xsl:param>
+<xsl:attribute-set name="header.table.properties">
+  <xsl:attribute name="table-layout">fixed</xsl:attribute>
+  <xsl:attribute name="width">100%</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="headers.on.blank.pages" select="1"/>
+<xsl:param name="highlight.default.language"/>
+<xsl:param name="highlight.source" select="0"/>
+<xsl:param name="highlight.xslthl.config"/>
+<xsl:param name="hyphenate">true</xsl:param>
+<xsl:param name="hyphenate.verbatim" select="0"/>
+<xsl:param name="hyphenate.verbatim.characters"/>
+<xsl:param name="ignore.image.scaling" select="0"/>
+<xsl:param name="img.src.path"/>
+<xsl:param name="index.method">basic</xsl:param>
+<xsl:param name="index.on.role" select="0"/>
+<xsl:param name="index.on.type" select="0"/>
+<xsl:attribute-set name="index.page.number.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="informalequation.properties" use-attribute-sets="informal.object.properties"/>
+<xsl:attribute-set name="informalexample.properties" use-attribute-sets="informal.object.properties"/>
+<xsl:attribute-set name="informalfigure.properties" use-attribute-sets="informal.object.properties"/>
+<xsl:attribute-set name="informal.object.properties">
+  <xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">2em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="informaltable.properties" use-attribute-sets="informal.object.properties"/>
+<xsl:attribute-set name="index.preferred.page.properties">
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="index.div.title.properties">
+  <xsl:attribute name="margin-{$direction.align.start}">0pt</xsl:attribute>
+  <xsl:attribute name="font-size">14.4pt</xsl:attribute>
+  <xsl:attribute name="font-family"><xsl:value-of select="$title.fontset"/></xsl:attribute>
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="space-before.optimum"><xsl:value-of select="concat($body.font.master,'pt')"/></xsl:attribute>
+  <xsl:attribute name="space-before.minimum"><xsl:value-of select="concat(($body.font.master * 0.8),'pt')"/></xsl:attribute>
+  <xsl:attribute name="space-before.maximum"><xsl:value-of select="concat(($body.font.master * 1.2),'pt')"/></xsl:attribute>
+  <xsl:attribute name="start-indent">0pt</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="index.entry.properties">
+  <xsl:attribute name="start-indent">0pt</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="index.number.separator"/>
+<xsl:param name="index.range.separator"/>
+<xsl:param name="index.term.separator"/>
+<xsl:param name="insert.link.page.number">no</xsl:param>
+<xsl:param name="insert.xref.page.number">no</xsl:param>
+<xsl:param name="insert.xref.page.number.para">yes</xsl:param>
+<xsl:attribute-set name="itemizedlist.properties" use-attribute-sets="list.block.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="itemizedlist.label.properties">
+</xsl:attribute-set>
+    <xsl:param name="itemizedlist.label.width">1.0em</xsl:param>
+  
+
+<xsl:param name="keep.relative.image.uris" select="0"/>
+<xsl:param name="l10n.gentext.default.language">en</xsl:param>
+<xsl:param name="l10n.gentext.language"/>
+<xsl:param name="l10n.gentext.use.xref.language" select="0"/>
+<xsl:param name="l10n.lang.value.rfc.compliant" select="1"/>
+<xsl:param name="label.from.part" select="0"/>
+<xsl:param name="line-height">normal</xsl:param>
+<xsl:param name="linenumbering.everyNth">5</xsl:param>
+<xsl:param name="linenumbering.extension" select="1"/>
+<xsl:param name="linenumbering.separator"><xsl:text> </xsl:text></xsl:param>
+<xsl:param name="linenumbering.width">3</xsl:param>
+<xsl:attribute-set name="list.block.properties">
+  <xsl:attribute name="provisional-label-separation">0.2em</xsl:attribute>
+  <xsl:attribute name="provisional-distance-between-starts">1.5em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="list.block.spacing">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">1.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="list.item.spacing">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="make.index.markup" select="0"/>
+<xsl:param name="make.single.year.ranges" select="0"/>
+<xsl:param name="make.year.ranges" select="0"/>
+<xsl:attribute-set name="margin.note.properties">
+  <xsl:attribute name="font-size">90%</xsl:attribute>
+  <xsl:attribute name="text-align">start</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="margin.note.title.properties">
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="text-align">start</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="margin.note.float.type">none</xsl:param>
+<xsl:param name="margin.note.width">1in</xsl:param>
+<xsl:param name="marker.section.level">2</xsl:param>
+<xsl:param name="menuchoice.menu.separator"> → </xsl:param>
+<xsl:param name="menuchoice.separator">+</xsl:param>
+<xsl:param name="monospace.font.family">monospace</xsl:param>
+<xsl:attribute-set name="monospace.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$monospace.font.family"/>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="monospace.verbatim.properties" use-attribute-sets="verbatim.properties monospace.properties">
+  <xsl:attribute name="text-align">start</xsl:attribute>
+  <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="monospace.verbatim.font.width">0.60em</xsl:param>
+<xsl:param name="nominal.table.width">6in</xsl:param>
+<xsl:attribute-set name="normal.para.spacing">
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="olink.doctitle">no</xsl:param> 
+<xsl:param name="olink.base.uri"/>
+<xsl:param name="olink.debug" select="0"/>
+<xsl:attribute-set name="olink.properties">
+  <xsl:attribute name="show-destination">replace</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="olink.lang.fallback.sequence"/>
+<xsl:attribute-set name="orderedlist.properties" use-attribute-sets="list.block.properties">
+  <xsl:attribute name="provisional-distance-between-starts">2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="orderedlist.label.properties">
+</xsl:attribute-set>
+<xsl:param name="orderedlist.label.width">1.2em</xsl:param>
+<xsl:param name="prefer.internal.olink" select="0"/>
+<xsl:param name="insert.olink.page.number">no</xsl:param>
+<xsl:param name="insert.olink.pdf.frag" select="0"/>
+<xsl:param name="page.height">
+  <xsl:choose>
+    <xsl:when test="$page.orientation = 'portrait'">
+      <xsl:value-of select="$page.height.portrait"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$page.width.portrait"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="page.height.portrait">
+  <xsl:choose>
+    <xsl:when test="$paper.type = 'A4landscape'">210mm</xsl:when>
+    <xsl:when test="$paper.type = 'USletter'">11in</xsl:when>
+    <xsl:when test="$paper.type = 'USlandscape'">8.5in</xsl:when>
+    <xsl:when test="$paper.type = 'USlegal'">14in</xsl:when>
+    <xsl:when test="$paper.type = 'USlegallandscape'">8.5in</xsl:when>
+    <xsl:when test="$paper.type = '4A0'">2378mm</xsl:when>
+    <xsl:when test="$paper.type = '2A0'">1682mm</xsl:when>
+    <xsl:when test="$paper.type = 'A0'">1189mm</xsl:when>
+    <xsl:when test="$paper.type = 'A1'">841mm</xsl:when>
+    <xsl:when test="$paper.type = 'A2'">594mm</xsl:when>
+    <xsl:when test="$paper.type = 'A3'">420mm</xsl:when>
+    <xsl:when test="$paper.type = 'A4'">297mm</xsl:when>
+    <xsl:when test="$paper.type = 'A5'">210mm</xsl:when>
+    <xsl:when test="$paper.type = 'A6'">148mm</xsl:when>
+    <xsl:when test="$paper.type = 'A7'">105mm</xsl:when>
+    <xsl:when test="$paper.type = 'A8'">74mm</xsl:when>
+    <xsl:when test="$paper.type = 'A9'">52mm</xsl:when>
+    <xsl:when test="$paper.type = 'A10'">37mm</xsl:when>
+    <xsl:when test="$paper.type = 'B0'">1414mm</xsl:when>
+    <xsl:when test="$paper.type = 'B1'">1000mm</xsl:when>
+    <xsl:when test="$paper.type = 'B2'">707mm</xsl:when>
+    <xsl:when test="$paper.type = 'B3'">500mm</xsl:when>
+    <xsl:when test="$paper.type = 'B4'">353mm</xsl:when>
+    <xsl:when test="$paper.type = 'B5'">250mm</xsl:when>
+    <xsl:when test="$paper.type = 'B6'">176mm</xsl:when>
+    <xsl:when test="$paper.type = 'B7'">125mm</xsl:when>
+    <xsl:when test="$paper.type = 'B8'">88mm</xsl:when>
+    <xsl:when test="$paper.type = 'B9'">62mm</xsl:when>
+    <xsl:when test="$paper.type = 'B10'">44mm</xsl:when>
+    <xsl:when test="$paper.type = 'C0'">1297mm</xsl:when>
+    <xsl:when test="$paper.type = 'C1'">917mm</xsl:when>
+    <xsl:when test="$paper.type = 'C2'">648mm</xsl:when>
+    <xsl:when test="$paper.type = 'C3'">458mm</xsl:when>
+    <xsl:when test="$paper.type = 'C4'">324mm</xsl:when>
+    <xsl:when test="$paper.type = 'C5'">229mm</xsl:when>
+    <xsl:when test="$paper.type = 'C6'">162mm</xsl:when>
+    <xsl:when test="$paper.type = 'C7'">114mm</xsl:when>
+    <xsl:when test="$paper.type = 'C8'">81mm</xsl:when>
+    <xsl:when test="$paper.type = 'C9'">57mm</xsl:when>
+    <xsl:when test="$paper.type = 'C10'">40mm</xsl:when>
+    <xsl:otherwise>11in</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="page.margin.bottom">0.5in</xsl:param>
+<xsl:param name="page.margin.inner">
+  <xsl:choose>
+    <xsl:when test="$double.sided != 0">1.25in</xsl:when>
+    <xsl:otherwise>1in</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="page.margin.outer">
+  <xsl:choose>
+    <xsl:when test="$double.sided != 0">0.75in</xsl:when>
+    <xsl:otherwise>1in</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="page.margin.top">0.5in</xsl:param>
+<xsl:param name="page.orientation">portrait</xsl:param>
+<xsl:param name="page.width">
+  <xsl:choose>
+    <xsl:when test="$page.orientation = 'portrait'">
+      <xsl:value-of select="$page.width.portrait"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$page.height.portrait"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="page.width.portrait">
+  <xsl:choose>
+    <xsl:when test="$paper.type = 'USletter'">8.5in</xsl:when>
+    <xsl:when test="$paper.type = 'USlandscape'">11in</xsl:when>
+    <xsl:when test="$paper.type = 'USlegal'">8.5in</xsl:when>
+    <xsl:when test="$paper.type = 'USlegallandscape'">14in</xsl:when>
+    <xsl:when test="$paper.type = '4A0'">1682mm</xsl:when>
+    <xsl:when test="$paper.type = '2A0'">1189mm</xsl:when>
+    <xsl:when test="$paper.type = 'A0'">841mm</xsl:when>
+    <xsl:when test="$paper.type = 'A1'">594mm</xsl:when>
+    <xsl:when test="$paper.type = 'A2'">420mm</xsl:when>
+    <xsl:when test="$paper.type = 'A3'">297mm</xsl:when>
+    <xsl:when test="$paper.type = 'A4'">210mm</xsl:when>
+    <xsl:when test="$paper.type = 'A5'">148mm</xsl:when>
+    <xsl:when test="$paper.type = 'A6'">105mm</xsl:when>
+    <xsl:when test="$paper.type = 'A7'">74mm</xsl:when>
+    <xsl:when test="$paper.type = 'A8'">52mm</xsl:when>
+    <xsl:when test="$paper.type = 'A9'">37mm</xsl:when>
+    <xsl:when test="$paper.type = 'A10'">26mm</xsl:when>
+    <xsl:when test="$paper.type = 'B0'">1000mm</xsl:when>
+    <xsl:when test="$paper.type = 'B1'">707mm</xsl:when>
+    <xsl:when test="$paper.type = 'B2'">500mm</xsl:when>
+    <xsl:when test="$paper.type = 'B3'">353mm</xsl:when>
+    <xsl:when test="$paper.type = 'B4'">250mm</xsl:when>
+    <xsl:when test="$paper.type = 'B5'">176mm</xsl:when>
+    <xsl:when test="$paper.type = 'B6'">125mm</xsl:when>
+    <xsl:when test="$paper.type = 'B7'">88mm</xsl:when>
+    <xsl:when test="$paper.type = 'B8'">62mm</xsl:when>
+    <xsl:when test="$paper.type = 'B9'">44mm</xsl:when>
+    <xsl:when test="$paper.type = 'B10'">31mm</xsl:when>
+    <xsl:when test="$paper.type = 'C0'">917mm</xsl:when>
+    <xsl:when test="$paper.type = 'C1'">648mm</xsl:when>
+    <xsl:when test="$paper.type = 'C2'">458mm</xsl:when>
+    <xsl:when test="$paper.type = 'C3'">324mm</xsl:when>
+    <xsl:when test="$paper.type = 'C4'">229mm</xsl:when>
+    <xsl:when test="$paper.type = 'C5'">162mm</xsl:when>
+    <xsl:when test="$paper.type = 'C6'">114mm</xsl:when>
+    <xsl:when test="$paper.type = 'C7'">81mm</xsl:when>
+    <xsl:when test="$paper.type = 'C8'">57mm</xsl:when>
+    <xsl:when test="$paper.type = 'C9'">40mm</xsl:when>
+    <xsl:when test="$paper.type = 'C10'">28mm</xsl:when>
+    <xsl:otherwise>8.5in</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="paper.type">USletter</xsl:param>
+<xsl:param name="part.autolabel">I</xsl:param>
+<xsl:param name="passivetex.extensions" select="0"/>
+<xsl:attribute-set name="pgwide.properties">
+  <xsl:attribute name="start-indent">0pt</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="preface.autolabel" select="0"/>
+<xsl:param name="preferred.mediaobject.role"/>
+<xsl:attribute-set name="procedure.properties" use-attribute-sets="formal.object.properties">
+  <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="process.empty.source.toc" select="0"/>
+<xsl:param name="process.source.toc" select="0"/>
+<xsl:param name="profile.arch"/>
+<xsl:param name="profile.audience"/>
+<xsl:param name="profile.attribute"/>
+<xsl:param name="profile.condition"/>
+<xsl:param name="profile.conformance"/>
+<xsl:param name="profile.lang"/>
+<xsl:param name="profile.os"/>
+<xsl:param name="profile.outputformat"/>
+<xsl:param name="profile.revision"/>
+<xsl:param name="profile.revisionflag"/>
+<xsl:param name="profile.role"/>
+<xsl:param name="profile.security"/>
+<xsl:param name="profile.separator">;</xsl:param>
+<xsl:param name="profile.status"/>
+<xsl:param name="profile.userlevel"/>
+<xsl:param name="profile.value"/>
+<xsl:param name="profile.vendor"/>
+<xsl:param name="profile.wordsize"/>
+<xsl:param name="punct.honorific">.</xsl:param>
+<xsl:param name="qanda.defaultlabel">number</xsl:param>
+<xsl:param name="qanda.in.toc" select="0"/>
+<xsl:param name="qanda.nested.in.toc" select="0"/>
+<xsl:param name="qanda.inherit.numeration" select="1"/>
+<xsl:param name="qandadiv.autolabel" select="1"/>
+<xsl:attribute-set name="qanda.title.level1.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 2.0736"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="qanda.title.level2.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.728"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="qanda.title.level3.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.44"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="qanda.title.level4.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.2"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="qanda.title.level5.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="qanda.title.level6.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="qanda.title.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$title.fontset"/>
+  </xsl:attribute>
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <!-- font size is calculated dynamically by qanda.heading template -->
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1.0em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="refentry.generate.name" select="1"/>
+<xsl:param name="refentry.generate.title" select="0"/>
+<xsl:param name="refentry.pagebreak" select="1"/>
+<xsl:attribute-set name="refentry.title.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$title.fontset"/>
+  </xsl:attribute>
+  <xsl:attribute name="font-size">18pt</xsl:attribute>
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="space-after">1em</xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1.0em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
+  <xsl:attribute name="start-indent"><xsl:value-of select="$title.margin.left"/></xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="refentry.xref.manvolnum" select="1"/>
+  <xsl:param name="reference.autolabel">I</xsl:param>
+<xsl:param name="refclass.suppress" select="0"/>
+<xsl:param name="region.after.extent">0.4in</xsl:param>
+<xsl:param name="region.before.extent">0.4in</xsl:param>
+<xsl:attribute-set name="revhistory.table.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="revhistory.table.cell.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="revhistory.title.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="root.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$body.fontset"/>
+  </xsl:attribute>
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.size"/>
+  </xsl:attribute>
+  <xsl:attribute name="text-align">
+    <xsl:value-of select="$alignment"/>
+  </xsl:attribute>
+  <xsl:attribute name="line-height">
+    <xsl:value-of select="$line-height"/>
+  </xsl:attribute>
+  <xsl:attribute name="font-selection-strategy">character-by-character</xsl:attribute>
+  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
+  <xsl:attribute name="writing-mode">
+    <xsl:value-of select="$direction.mode"/>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="rootid"/>
+<xsl:param name="runinhead.default.title.end.punct">.</xsl:param>
+<xsl:param name="runinhead.title.end.punct">.!?:</xsl:param>
+<xsl:param name="sans.font.family">sans-serif</xsl:param>
+<xsl:param name="section.autolabel" select="0"/>
+<xsl:param name="section.autolabel.max.depth">8</xsl:param>
+<xsl:param name="section.container.element">block</xsl:param>
+<xsl:param name="section.label.includes.component.label" select="0"/>
+<xsl:attribute-set name="section.title.level1.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 2.0736"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.title.level2.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.728"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.title.level3.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.44"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.title.level4.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master * 1.2"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.title.level5.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.title.level6.properties">
+  <xsl:attribute name="font-size">
+    <xsl:value-of select="$body.font.master"/>
+    <xsl:text>pt</xsl:text>
+  </xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.title.properties">
+  <xsl:attribute name="font-family">
+    <xsl:value-of select="$title.fontset"/>
+  </xsl:attribute>
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <!-- font size is calculated dynamically by section.heading template -->
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1.0em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="text-align">start</xsl:attribute>
+  <xsl:attribute name="start-indent"><xsl:value-of select="$title.margin.left"/></xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="section.level1.properties" use-attribute-sets="section.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="section.level2.properties" use-attribute-sets="section.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="section.level3.properties" use-attribute-sets="section.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="section.level4.properties" use-attribute-sets="section.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="section.level5.properties" use-attribute-sets="section.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="section.level6.properties" use-attribute-sets="section.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="section.properties">
+</xsl:attribute-set>
+<xsl:param name="segmentedlist.as.table" select="0"/>
+<xsl:param name="shade.verbatim" select="0"/>
+
+<xsl:attribute-set name="shade.verbatim.style">
+  <xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="show.comments" select="1"/>
+<xsl:attribute-set name="sidebar.properties" use-attribute-sets="formal.object.properties">
+  <xsl:attribute name="border-style">solid</xsl:attribute>
+  <xsl:attribute name="border-width">1pt</xsl:attribute>
+  <xsl:attribute name="border-color">black</xsl:attribute>
+  <xsl:attribute name="background-color">#DDDDDD</xsl:attribute>
+  <xsl:attribute name="padding-start">12pt</xsl:attribute>
+  <xsl:attribute name="padding-end">12pt</xsl:attribute>
+  <xsl:attribute name="padding-top">6pt</xsl:attribute>
+  <xsl:attribute name="padding-bottom">6pt</xsl:attribute>
+  <xsl:attribute name="margin-{$direction.align.start}">0pt</xsl:attribute>
+  <xsl:attribute name="margin-{$direction.align.end}">0pt</xsl:attribute>
+<!--
+  <xsl:attribute name="margin-top">6pt</xsl:attribute>
+  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
+-->
+</xsl:attribute-set>
+<xsl:attribute-set name="sidebar.title.properties">
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="text-align">start</xsl:attribute>
+  <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="sidebar.float.type">none</xsl:param>
+<xsl:param name="sidebar.float.width">1in</xsl:param>
+<xsl:param name="simplesect.in.toc" select="0"/>
+<xsl:attribute-set name="subscript.properties">
+  <xsl:attribute name="font-size">75%</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="superscript.properties">
+  <xsl:attribute name="font-size">75%</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="symbol.font.family">Symbol,ZapfDingbats</xsl:param>
+
+<xsl:param name="table.cell.border.color">black</xsl:param>
+<xsl:param name="table.cell.border.style">solid</xsl:param>
+<xsl:param name="table.cell.border.thickness">
+  <xsl:choose>
+    <xsl:when test="contains($stylesheet.result.type,'html')">1px</xsl:when>
+    <xsl:otherwise>0.5pt</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:attribute-set name="table.cell.padding">
+  <xsl:attribute name="padding-start">2pt</xsl:attribute>
+  <xsl:attribute name="padding-end">2pt</xsl:attribute>
+  <xsl:attribute name="padding-top">2pt</xsl:attribute>
+  <xsl:attribute name="padding-bottom">2pt</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="table.footnote.number.format">a</xsl:param>
+<xsl:param name="table.footnote.number.symbols"/>
+<xsl:attribute-set name="table.footnote.properties">
+  <xsl:attribute name="font-family"><xsl:value-of select="$body.fontset"/></xsl:attribute>
+  <xsl:attribute name="font-size"><xsl:value-of select="$footnote.font.size"/></xsl:attribute>
+  <xsl:attribute name="font-weight">normal</xsl:attribute>
+  <xsl:attribute name="font-style">normal</xsl:attribute>
+  <xsl:attribute name="space-before">2pt</xsl:attribute>
+  <xsl:attribute name="text-align"><xsl:value-of select="$alignment"/></xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="table.frame.border.color">black</xsl:param>
+<xsl:param name="table.frame.border.style">solid</xsl:param>
+<xsl:param name="table.frame.border.thickness">
+  <xsl:choose>
+    <xsl:when test="contains($stylesheet.result.type,'html')">1px</xsl:when>
+    <xsl:otherwise>0.5pt</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:attribute-set name="table.properties" use-attribute-sets="formal.object.properties">
+  <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="tablecolumns.extension" select="1"/>
+<xsl:attribute-set name="table.table.properties">
+  <xsl:attribute name="border-before-width.conditionality">retain</xsl:attribute>
+  <xsl:attribute name="border-collapse">collapse</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="table.caption.properties">
+  <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+ <xsl:param name="target.database.document">olinkdb.xml</xsl:param>
+<xsl:param name="targets.filename">target.db</xsl:param>
+<xsl:attribute-set name="task.properties" use-attribute-sets="formal.object.properties">
+    <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="textdata.default.encoding"/>
+<xsl:param name="tex.math.delims" select="1"/>
+<xsl:param name="tex.math.in.alt"/>
+  <xsl:param name="textinsert.extension" select="1"/>
+<xsl:param name="title.font.family">sans-serif</xsl:param>
+<xsl:param name="title.margin.left">
+  <xsl:choose>
+    <xsl:when test="$fop.extensions != 0">-4pc</xsl:when>
+    <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+    <xsl:otherwise>0pt</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="toc.indent.width">24</xsl:param>
+<!-- inconsistant point specification? -->
+<xsl:attribute-set name="toc.line.properties">
+  <xsl:attribute name="text-align-last">justify</xsl:attribute>
+  <xsl:attribute name="text-align">start</xsl:attribute>
+  <xsl:attribute name="end-indent"><xsl:value-of select="concat($toc.indent.width, 'pt')"/></xsl:attribute>
+  <xsl:attribute name="last-line-end-indent"><xsl:value-of select="concat('-', $toc.indent.width, 'pt')"/></xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="toc.leader.properties">
+  <xsl:attribute name="leader-pattern">dots</xsl:attribute>
+  <xsl:attribute name="leader-pattern-width">3pt</xsl:attribute>
+  <xsl:attribute name="leader-alignment">reference-area</xsl:attribute>
+  <xsl:attribute name="padding-left">3pt</xsl:attribute>
+  <xsl:attribute name="padding-right">3pt</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="toc.margin.properties">
+  <xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">2em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">2em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="toc.max.depth">8</xsl:param>
+<xsl:param name="toc.section.depth">2</xsl:param>
+<xsl:param name="ulink.footnotes" select="0"/>
+<xsl:param name="ulink.hyphenate"/>
+<xsl:param name="ulink.hyphenate.chars">/</xsl:param>
+<xsl:param name="ulink.show" select="1"/>
+<xsl:param name="use.extensions" select="0"/>
+<xsl:param name="use.local.olink.style" select="0"/> 
+<xsl:param name="use.role.as.xrefstyle" select="1"/>
+<xsl:param name="use.role.for.mediaobject" select="1"/>
+<xsl:param name="use.svg" select="1"/>
+<xsl:param name="variablelist.as.blocks" select="0"/>
+<xsl:param name="variablelist.max.termlength">24</xsl:param>
+<xsl:param name="variablelist.term.separator">, </xsl:param>
+<xsl:attribute-set name="variablelist.term.properties">
+</xsl:attribute-set>
+<xsl:param name="variablelist.term.break.after">0</xsl:param>
+<xsl:attribute-set name="verbatim.properties">
+  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="space-after.minimum">0.8em</xsl:attribute>
+  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+  <xsl:attribute name="space-after.maximum">1.2em</xsl:attribute>
+  <xsl:attribute name="hyphenate">false</xsl:attribute>
+  <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
+  <xsl:attribute name="white-space-collapse">false</xsl:attribute>
+  <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
+  <xsl:attribute name="linefeed-treatment">preserve</xsl:attribute>
+  <xsl:attribute name="text-align">start</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="writing.mode">
+  <xsl:call-template name="gentext">
+    <xsl:with-param name="key">writing-mode</xsl:with-param>
+    <xsl:with-param name="lang">
+      <xsl:call-template name="l10n.language">
+        <xsl:with-param name="target" select="/*[1]"/>
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:param>
+<xsl:param name="xep.extensions" select="0"/>
+<xsl:attribute-set name="xep.index.item.properties" use-attribute-sets="index.page.number.properties">
+  <xsl:attribute name="merge-subsequent-page-numbers">true</xsl:attribute>
+  <xsl:attribute name="link-back">true</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="xref.label-page.separator"><xsl:text> </xsl:text></xsl:param>
+<xsl:param name="xref.label-title.separator">: </xsl:param>
+<xsl:attribute-set name="xref.properties">
+</xsl:attribute-set>
+<xsl:param name="xref.title-page.separator"><xsl:text> </xsl:text></xsl:param>
+<xsl:param name="xref.with.number.and.title" select="1"/>
+<xsl:param name="region.inner.extent">0in</xsl:param>
+<xsl:param name="region.outer.extent">0in</xsl:param>
+<xsl:param name="body.margin.inner">0in</xsl:param>
+<xsl:param name="body.margin.outer">0in</xsl:param>
+<xsl:param name="side.region.precedence">false</xsl:param>
+<xsl:attribute-set name="inner.region.content.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="outer.region.content.properties">
+</xsl:attribute-set>
+<xsl:attribute-set name="region.inner.properties">
+  <xsl:attribute name="border-width">0</xsl:attribute>
+  <xsl:attribute name="padding">0</xsl:attribute>
+  <xsl:attribute name="reference-orientation">90</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="region.outer.properties">
+  <xsl:attribute name="border-width">0</xsl:attribute>
+  <xsl:attribute name="padding">0</xsl:attribute>
+  <xsl:attribute name="reference-orientation">90</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="para.properties" use-attribute-sets="normal.para.spacing">
+</xsl:attribute-set>
+    <xsl:param name="mark.optional.procedure.steps">1</xsl:param>
+  
+<xsl:param name="xsl1.1.bookmarks">
+  <xsl:choose>
+    <xsl:when test="$fop1.extensions != 0">1</xsl:when>
+    <xsl:when test="$xep.extensions != 0">1</xsl:when>
+    <xsl:when test="$axf.extensions != 0">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose></xsl:param>
+<xsl:param name="show.bookmarks" select="1"/>
+<xsl:param name="autolink.index.see" select="1"/>
+<xsl:attribute-set name="publishers.properties">
+  <xsl:attribute name="space-before">1em</xsl:attribute>
+  <xsl:attribute name="space-after">1em</xsl:attribute>
+  <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="drama.properties" use-attribute-sets="publishers.properties"/>
+<xsl:attribute-set name="poetry.properties" use-attribute-sets="publishers.properties"/>
+<xsl:attribute-set name="stagedir.properties">
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="font-style">italic</xsl:attribute>
+  <xsl:attribute name="space-before">1em</xsl:attribute>
+  <xsl:attribute name="space-after">1em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="linegroup.properties">
+  <xsl:attribute name="provisional-distance-between-starts">20%</xsl:attribute>
+  <xsl:attribute name="provisional-label-separation">.3em</xsl:attribute>
+  <xsl:attribute name="space-before">.5em</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="speaker.properties"/>
+<xsl:attribute-set name="line.properties"/>
+<xsl:attribute-set name="inlinestagedir.properties">
+  <xsl:attribute name="font-weight">bold</xsl:attribute>
+  <xsl:attribute name="font-style">italic</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="dialogue.properties" use-attribute-sets="publishers.properties"/>
+
+</xsl:stylesheet>
+
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/autoidx.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/autoidx.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/autoidx.xsl	(revision 119)
@@ -0,0 +1,902 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY % common.entities SYSTEM "../common/entities.ent">
+%common.entities;
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exslt="http://exslt.org/common"
+                xmlns:xlink='http://www.w3.org/1999/xlink'
+                extension-element-prefixes="exslt"
+                exclude-result-prefixes="exslt"
+                version="1.0">
+
+<!-- ********************************************************************
+     $Id: autoidx.xsl 9853 2014-01-19 22:49:20Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+<!-- The "basic" method derived from Jeni Tennison's work. -->
+<!-- The "kosek" method contributed by Jirka Kosek. -->
+<!-- The "kimber" method contributed by Eliot Kimber of Innodata Isogen. -->
+
+<xsl:variable name="kimber.imported" select="0"/>
+<xsl:variable name="kosek.imported" select="0"/>
+
+<xsl:key name="letter"
+         match="indexterm"
+         use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
+
+<xsl:key name="primary"
+         match="indexterm"
+         use="&primary;"/>
+
+<xsl:key name="secondary"
+         match="indexterm"
+         use="concat(&primary;, &sep;, &secondary;)"/>
+
+<xsl:key name="tertiary"
+         match="indexterm"
+         use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+
+<!-- this key used for automatic links from see and seealso to primary -->
+<xsl:key name="primaryonly"
+         match="indexterm"
+         use="normalize-space(primary)"/>
+
+<xsl:key name="endofrange"
+         match="indexterm[@class='endofrange']"
+         use="@startref"/>
+
+<xsl:key name="primary-section"
+         match="indexterm[not(secondary) and not(see)]"
+         use="concat(&primary;, &sep;, &section.id;)"/>
+
+<xsl:key name="secondary-section"
+         match="indexterm[not(tertiary) and not(see)]"
+         use="concat(&primary;, &sep;, &secondary;, &sep;, &section.id;)"/>
+
+<xsl:key name="tertiary-section"
+         match="indexterm[not(see)]"
+         use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, &section.id;)"/>
+
+<xsl:key name="see-also"
+         match="indexterm[seealso]"
+         use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso)"/>
+
+<xsl:key name="see"
+         match="indexterm[see]"
+         use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see)"/>
+
+<xsl:key name="sections" match="*[@id or @xml:id]" use="@id|@xml:id"/>
+
+
+<xsl:template name="generate-index">
+  <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+
+  <xsl:choose>
+    <xsl:when test="$index.method = 'kosek'">
+      <xsl:call-template name="generate-kosek-index">
+        <xsl:with-param name="scope" select="$scope"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$index.method = 'kimber'">
+      <xsl:call-template name="generate-kimber-index">
+        <xsl:with-param name="scope" select="$scope"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:call-template name="generate-basic-index">
+        <xsl:with-param name="scope" select="$scope"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+      
+<xsl:template name="generate-basic-index">
+  <xsl:param name="scope" select="NOTANODE"/>
+
+  <xsl:variable name="role">
+    <xsl:if test="$index.on.role != 0">
+      <xsl:value-of select="@role"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="type">
+    <xsl:if test="$index.on.type != 0">
+      <xsl:value-of select="@type"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="terms"
+                select="//indexterm
+                        [count(.|key('letter',
+                          translate(substring(&primary;, 1, 1),
+                             &lowercase;,
+                             &uppercase;))
+                          [&scope;][1]) = 1
+                          and not(@class = 'endofrange')]"/>
+
+  <xsl:variable name="alphabetical"
+                select="$terms[contains(concat(&lowercase;, &uppercase;),
+                                        substring(&primary;, 1, 1))]"/>
+
+  <xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
+                                                 &uppercase;),
+                                             substring(&primary;, 1, 1)))]"/>
+  <div class="index">
+    <xsl:if test="$others">
+      <xsl:choose>
+        <xsl:when test="normalize-space($type) != '' and 
+                        $others[@type = $type][count(.|key('primary', &primary;)[&scope;][1]) = 1]">
+          <div class="indexdiv">
+            <h3>
+              <xsl:call-template name="gentext">
+                <xsl:with-param name="key" select="'index symbols'"/>
+              </xsl:call-template>
+            </h3>
+            <dl>
+              <xsl:apply-templates select="$others[count(.|key('primary', &primary;)[&scope;][1]) = 1]"
+                                   mode="index-symbol-div">
+                <xsl:with-param name="position" select="position()"/>                                
+                <xsl:with-param name="scope" select="$scope"/>
+                <xsl:with-param name="role" select="$role"/>
+                <xsl:with-param name="type" select="$type"/>
+                <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+              </xsl:apply-templates>
+            </dl>
+          </div>
+        </xsl:when>
+        <xsl:when test="normalize-space($type) != ''"> 
+          <!-- Output nothing, as there isn't a match for $other using this $type -->
+        </xsl:when>  
+        <xsl:otherwise>
+          <div class="indexdiv">
+            <h3>
+              <xsl:call-template name="gentext">
+                <xsl:with-param name="key" select="'index symbols'"/>
+              </xsl:call-template>
+            </h3>
+            <dl>
+              <xsl:apply-templates select="$others[count(.|key('primary',
+                                          &primary;)[&scope;][1]) = 1]"
+                                  mode="index-symbol-div">
+                <xsl:with-param name="position" select="position()"/>                                
+                <xsl:with-param name="scope" select="$scope"/>
+                <xsl:with-param name="role" select="$role"/>
+                <xsl:with-param name="type" select="$type"/>
+                <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+              </xsl:apply-templates>
+            </dl>
+          </div>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:apply-templates select="$alphabetical[count(.|key('letter',
+                                 translate(substring(&primary;, 1, 1),
+                                           &lowercase;,&uppercase;))[&scope;][1]) = 1]"
+                         mode="index-div-basic">
+      <xsl:with-param name="position" select="position()"/>
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+    </xsl:apply-templates>
+  </div>
+</xsl:template>
+
+<!-- This template not used if html/autoidx-kosek.xsl is imported -->
+<xsl:template name="generate-kosek-index">
+  <xsl:param name="scope" select="NOTANODE"/>
+
+  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
+  <xsl:if test="contains($vendor, 'libxslt')">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
+      <xsl:text>work with the xsltproc XSLT processor.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+
+  <xsl:if test="$exsl.node.set.available = 0">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
+      <xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
+      <xsl:text>has it, or use a different index method.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:if test="$kosek.imported = 0">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kosek' index method requires the&#xA;</xsl:text>
+      <xsl:text>kosek index extensions be imported:&#xA;</xsl:text>
+      <xsl:text>  xsl:import href="html/autoidx-kosek.xsl"</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+</xsl:template>
+
+<!-- This template not used if html/autoidx-kimber.xsl is imported -->
+<xsl:template name="generate-kimber-index">
+  <xsl:param name="scope" select="NOTANODE"/>
+
+  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
+  <xsl:if test="not(contains($vendor, 'SAXON '))">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kimber' index method requires the </xsl:text>
+      <xsl:text>Saxon version 6 or 8 XSLT processor.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:if test="$kimber.imported = 0">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the 'kimber' index method requires the&#xA;</xsl:text>
+      <xsl:text>kimber index extensions be imported:&#xA;</xsl:text>
+      <xsl:text>  xsl:import href="html/autoidx-kimber.xsl"</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-div-basic">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key"
+                select="translate(substring(&primary;, 1, 1),
+                         &lowercase;,&uppercase;)"/>
+
+  <xsl:if test="key('letter', $key)[&scope;]
+                [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
+    <div class="indexdiv">
+      <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
+        <h3>
+          <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
+        </h3>
+      </xsl:if>
+      <dl>
+        <xsl:apply-templates select="key('letter', $key)[&scope;]
+                                     [count(.|key('primary', &primary;)
+                                     [&scope;][1])=1]"
+                             mode="index-primary">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+        </xsl:apply-templates>
+      </dl>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-symbol-div">
+  <xsl:param name="scope" select="/"/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),
+                                             &lowercase;,&uppercase;)"/>
+
+  <xsl:apply-templates select="key('letter', $key)
+                               [&scope;][count(.|key('primary', &primary;)[1]) = 1]"
+                       mode="index-primary">
+    <xsl:with-param name="position" select="position()"/>
+    <xsl:with-param name="scope" select="$scope"/>
+    <xsl:with-param name="role" select="$role"/>
+    <xsl:with-param name="type" select="$type"/>
+    <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-primary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="&primary;"/>
+  <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
+  <dt>
+    <xsl:if test="$autolink.index.see != 0">
+      <!-- add internal id attribute to form see and seealso links -->
+      <xsl:attribute name="id">
+        <xsl:text>ientry-</xsl:text>
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:for-each select="$refs/primary">
+      <xsl:if test="@id or @xml:id">
+        <xsl:choose>
+          <xsl:when test="$generate.id.attributes = 0">
+            <a name="{(@id|@xml:id)[1]}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <span>
+              <xsl:call-template name="id.attribute"/>
+            </span>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:value-of select="primary"/>
+    <xsl:choose>
+      <xsl:when test="$index.links.to.section = 1">
+        <xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('primary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$refs[not(see) 
+                              and not(secondary)][&scope;]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs[not(secondary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <xsl:choose>
+    <xsl:when test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
+      <dd>
+        <dl>
+          <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
+                               mode="index-seealso">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+            <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+          </xsl:apply-templates>
+          <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" 
+                               mode="index-secondary">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+            <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
+          </xsl:apply-templates>
+        </dl>
+      </dd>
+    </xsl:when>
+    <!-- HTML5 requires dd for each dt -->
+    <xsl:when test="$div.element = 'section'">
+      <dd></dd>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-secondary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
+  <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
+  <dt>
+    <xsl:for-each select="$refs/secondary">
+      <xsl:if test="@id or @xml:id">
+        <xsl:choose>
+          <xsl:when test="$generate.id.attributes = 0">
+            <a name="{(@id|@xml:id)[1]}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <span>
+              <xsl:call-template name="id.attribute"/>
+            </span>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:value-of select="secondary"/>
+    <xsl:choose>
+      <xsl:when test="$index.links.to.section = 1">
+        <xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('secondary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$refs[not(see) 
+                                and not(tertiary)][&scope;]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs[not(tertiary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <xsl:choose>
+    <xsl:when test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
+      <dd>
+        <dl>
+          <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
+                               mode="index-seealso">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+            <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+          </xsl:apply-templates>
+          <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]" 
+                               mode="index-tertiary">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+            <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
+          </xsl:apply-templates>
+        </dl>
+      </dd>
+    </xsl:when>
+    <!-- HTML5 requires dd for each dt -->
+    <xsl:when test="$div.element = 'section'">
+      <dd></dd>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-tertiary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+  <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
+  <dt>
+    <xsl:for-each select="$refs/tertiary">
+      <xsl:if test="@id or @xml:id">
+        <xsl:choose>
+          <xsl:when test="$generate.id.attributes = 0">
+            <a name="{(@id|@xml:id)[1]}"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <span>
+              <xsl:call-template name="id.attribute"/>
+            </span>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:value-of select="tertiary"/>
+    <xsl:choose>
+      <xsl:when test="$index.links.to.section = 1">
+        <xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('tertiary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$refs[not(see)][&scope;]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs/see">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <xsl:choose>
+    <xsl:when test="$refs/seealso">
+      <dd>
+        <dl>
+          <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
+                               mode="index-seealso">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+            <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+          </xsl:apply-templates>
+        </dl>
+      </dd>
+    </xsl:when>
+    <!-- HTML5 requires dd for each dt -->
+    <xsl:when test="$div.element = 'section'">
+      <dd></dd>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="reference">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="position"/>
+  <xsl:param name="separator" select="''"/>
+  
+  <xsl:variable name="term.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.term.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="number.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.number.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="range.separator">
+    <xsl:call-template name="index.separator">
+      <xsl:with-param name="key" select="'index.range.separator'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$separator != ''">
+      <xsl:value-of select="$separator"/>
+    </xsl:when>
+    <xsl:when test="$position = 1">
+      <xsl:value-of select="$term.separator"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$number.separator"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:choose>
+    <xsl:when test="@zone and string(@zone)">
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="normalize-space(@zone)"/>
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <a>
+        <xsl:apply-templates select="." mode="class.attribute"/>
+        <xsl:variable name="title">
+          <xsl:choose>
+            <xsl:when test="$index.prefer.titleabbrev != 0">
+              <xsl:apply-templates select="&section;" mode="titleabbrev.markup"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates select="&section;" mode="title.markup"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+
+        <xsl:attribute name="href">
+          <xsl:choose>
+            <xsl:when test="$index.links.to.section = 1">
+              <xsl:call-template name="href.target">
+                <xsl:with-param name="object" select="&section;"/>
+                <xsl:with-param name="context" 
+                                select="(//index[&scope;] | //setindex[&scope;])[1]"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="href.target">
+                <xsl:with-param name="object" select="."/>
+                <xsl:with-param name="context" 
+                                select="(//index[&scope;] | //setindex[&scope;])[1]"/>
+              </xsl:call-template>
+            </xsl:otherwise>
+          </xsl:choose>
+
+        </xsl:attribute>
+
+        <xsl:value-of select="$title"/> <!-- text only -->
+      </a>
+
+      <xsl:variable name="id" select="(@id|@xml:id)[1]"/>
+      <xsl:if test="key('endofrange', $id)[&scope;]">
+        <xsl:apply-templates select="key('endofrange', $id)[&scope;][last()]"
+                             mode="reference">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:with-param name="separator" select="$range.separator"/>
+        </xsl:apply-templates>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="reference">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="zones"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($zones, ' ')">
+      <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
+      <xsl:variable name="target" select="key('sections', $zone)"/>
+
+      <a>
+        <xsl:apply-templates select="." mode="class.attribute"/>
+        <xsl:call-template name="id.attribute"/>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target[1]"/>
+            <xsl:with-param name="context" select="//index[&scope;][1]"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
+      </a>
+      <xsl:text>, </xsl:text>
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="zone" select="$zones"/>
+      <xsl:variable name="target" select="key('sections', $zone)"/>
+
+      <a>
+        <xsl:apply-templates select="." mode="class.attribute"/>
+        <xsl:call-template name="id.attribute"/>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target[1]"/>
+            <xsl:with-param name="context" select="//index[&scope;][1]"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
+      </a>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-see">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="see" select="normalize-space(see)"/>
+
+  <!-- can only link to primary, which should appear before comma
+  in see "primary, secondary" entry -->
+  <xsl:variable name="seeprimary">
+    <xsl:choose>
+      <xsl:when test="contains($see, ',')">
+        <xsl:value-of select="substring-before($see, ',')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$see"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable> 
+
+  <xsl:variable name="seetarget" select="key('primaryonly', $seeprimary)[1]"/>
+
+  <xsl:variable name="linkend">
+    <xsl:if test="$seetarget">
+      <xsl:text>#ientry-</xsl:text>
+      <xsl:call-template name="object.id">
+        <xsl:with-param name="object" select="$seetarget"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:text> (</xsl:text>
+  <xsl:call-template name="gentext">
+    <xsl:with-param name="key" select="'see'"/>
+  </xsl:call-template>
+  <xsl:text> </xsl:text>
+  <xsl:choose>
+    <!-- manual links have precedence -->
+    <xsl:when test="see/@linkend or see/@xlink:href">
+      <xsl:call-template name="simple.xlink">
+        <xsl:with-param name="node" select="see"/>
+        <xsl:with-param name="content" select="$see"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$autolink.index.see = 0">
+      <xsl:value-of select="$see"/>
+    </xsl:when>
+    <xsl:when test="$seetarget">
+      <a href="{$linkend}">
+        <xsl:value-of select="$see"/>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$see"/>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:text>)</xsl:text>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-seealso">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:for-each select="seealso">
+    <xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
+
+    <xsl:variable name="seealso" select="normalize-space(.)"/>
+
+    <!-- can only link to primary, which should appear before comma
+    in seealso "primary, secondary" entry -->
+    <xsl:variable name="seealsoprimary">
+      <xsl:choose>
+        <xsl:when test="contains($seealso, ',')">
+          <xsl:value-of select="substring-before($seealso, ',')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$seealso"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable> 
+
+    <xsl:variable name="seealsotarget" select="key('primaryonly', $seealsoprimary)[1]"/>
+
+    <xsl:variable name="linkend">
+      <xsl:if test="$seealsotarget">
+        <xsl:text>#ientry-</xsl:text>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="$seealsotarget"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+
+    <dt>
+      <xsl:text>(</xsl:text>
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'seealso'"/>
+      </xsl:call-template>
+      <xsl:text> </xsl:text>
+      <xsl:choose>
+        <!-- manual links have precedence -->
+        <xsl:when test="@linkend or @xlink:href">
+          <xsl:call-template name="simple.xlink">
+            <xsl:with-param name="node" select="."/>
+            <xsl:with-param name="content" select="$seealso"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$autolink.index.see = 0">
+          <xsl:value-of select="$seealso"/>
+        </xsl:when>
+        <xsl:when test="$seealsotarget">
+          <a href="{$linkend}">
+            <xsl:value-of select="$seealso"/>
+          </a>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$seealso"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>)</xsl:text>
+    </dt>
+
+    <xsl:if test="$div.element = 'section'">
+      <dd></dd>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*" mode="index-title-content">
+  <xsl:variable name="title">
+    <xsl:apply-templates select="&section;" mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:value-of select="$title"/>
+</xsl:template>
+
+<xsl:template name="index.separator">
+  <xsl:param name="key" select="''"/>
+  <xsl:param name="lang">
+    <xsl:call-template name="l10n.language"/>
+  </xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$key = 'index.term.separator'">
+      <xsl:choose>
+        <!-- Use the override if not blank -->
+        <xsl:when test="$index.term.separator != ''">
+          <xsl:copy-of select="$index.term.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="context">index</xsl:with-param>
+            <xsl:with-param name="name">term-separator</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$key = 'index.number.separator'">
+      <xsl:choose>
+        <!-- Use the override if not blank -->
+        <xsl:when test="$index.number.separator != ''">
+          <xsl:copy-of select="$index.number.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="context">index</xsl:with-param>
+            <xsl:with-param name="name">number-separator</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$key = 'index.range.separator'">
+      <xsl:choose>
+        <!-- Use the override if not blank -->
+        <xsl:when test="$index.range.separator != ''">
+          <xsl:copy-of select="$index.range.separator"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="context">index</xsl:with-param>
+            <xsl:with-param name="name">range-separator</xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/docbook.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/docbook.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/docbook.xsl	(revision 119)
@@ -0,0 +1,561 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exsl="http://exslt.org/common"
+                exclude-result-prefixes="exsl"
+                version='1.0'>
+
+<xsl:output method="html"
+            encoding="ISO-8859-1"
+            indent="no"/>
+
+<!-- ********************************************************************
+     $Id: docbook.xsl 9983 2015-09-16 20:58:50Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:include href="../VERSION.xsl"/>
+<xsl:include href="param.xsl"/>
+<xsl:include href="../lib/lib.xsl"/>
+<xsl:include href="../lib/dumpfragment.xsl"/>
+<xsl:include href="../common/l10n.xsl"/>
+<xsl:include href="../common/common.xsl"/>
+<xsl:include href="../common/utility.xsl"/>
+<xsl:include href="../common/labels.xsl"/>
+<xsl:include href="../common/titles.xsl"/>
+<xsl:include href="../common/subtitles.xsl"/>
+<xsl:include href="../common/gentext.xsl"/>
+<xsl:include href="../common/targets.xsl"/>
+<xsl:include href="../common/olink.xsl"/>
+<xsl:include href="../common/pi.xsl"/>
+<xsl:include href="autotoc.xsl"/>
+<xsl:include href="autoidx.xsl"/>
+<xsl:include href="lists.xsl"/>
+<xsl:include href="callout.xsl"/>
+<xsl:include href="verbatim.xsl"/>
+<xsl:include href="graphics.xsl"/>
+<xsl:include href="xref.xsl"/>
+<xsl:include href="formal.xsl"/>
+<xsl:include href="dtbl.xsl"/>
+<xsl:include href="table.xsl"/>
+<xsl:include href="htmltbl.xsl"/>
+<xsl:include href="sections.xsl"/>
+<xsl:include href="inline.xsl"/>
+<xsl:include href="footnote.xsl"/>
+<xsl:include href="html.xsl"/>
+<xsl:include href="its.xsl"/>
+<xsl:include href="info.xsl"/>
+<xsl:include href="keywords.xsl"/>
+<xsl:include href="division.xsl"/>
+<xsl:include href="toc.xsl"/>
+<xsl:include href="index.xsl"/>
+<xsl:include href="refentry.xsl"/>
+<xsl:include href="math.xsl"/>
+<xsl:include href="admon.xsl"/>
+<xsl:include href="component.xsl"/>
+<xsl:include href="biblio.xsl"/>
+<xsl:include href="biblio-iso690.xsl"/>
+<xsl:include href="glossary.xsl"/>
+<xsl:include href="block.xsl"/>
+<xsl:include href="task.xsl"/>
+<xsl:include href="qandaset.xsl"/>
+<xsl:include href="synop.xsl"/>
+<xsl:include href="titlepage.xsl"/>
+<xsl:include href="titlepage.templates.xsl"/>
+<xsl:include href="pi.xsl"/>
+<xsl:include href="ebnf.xsl"/>
+<xsl:include href="chunker.xsl"/>
+<xsl:include href="html-rtf.xsl"/>
+<xsl:include href="annotations.xsl"/>
+<xsl:include href="../common/stripns.xsl"/>
+<xsl:include href="publishers.xsl"/>
+
+<xsl:param name="stylesheet.result.type" select="'html'"/>
+<xsl:param name="htmlhelp.output" select="0"/>
+
+<!-- ==================================================================== -->
+
+<xsl:key name="id" match="*" use="@id|@xml:id"/>
+<xsl:key name="gid" match="*" use="generate-id()"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*">
+  <xsl:message>
+    <xsl:text>Element </xsl:text>
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:text> in namespace '</xsl:text>
+    <xsl:value-of select="namespace-uri(.)"/>
+    <xsl:text>' encountered</xsl:text>
+    <xsl:if test="parent::*">
+      <xsl:text> in </xsl:text>
+      <xsl:value-of select="name(parent::*)"/>
+    </xsl:if>
+    <xsl:text>, but no template matches.</xsl:text>
+  </xsl:message>
+
+  <span style="color: red">
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&lt;/</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+  </span>
+</xsl:template>
+
+<xsl:template match="text()">
+  <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="body.attributes">
+  <xsl:attribute name="bgcolor">white</xsl:attribute>
+  <xsl:attribute name="text">black</xsl:attribute>
+  <xsl:attribute name="link">#0000FF</xsl:attribute>
+  <xsl:attribute name="vlink">#840084</xsl:attribute>
+  <xsl:attribute name="alink">#0000FF</xsl:attribute>
+  <xsl:if test="starts-with($writing.mode, 'rl')">
+    <xsl:attribute name="dir">rtl</xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="head.content.base">
+  <xsl:param name="node" select="."/>
+  <base href="{$html.base}"/>
+</xsl:template>
+
+<xsl:template name="head.content.abstract">
+  <xsl:param name="node" select="."/>
+  <xsl:variable name="info" select="(articleinfo
+    |bookinfo
+    |prefaceinfo
+    |chapterinfo
+    |appendixinfo
+    |sectioninfo
+    |sect1info
+    |sect2info
+    |sect3info
+    |sect4info
+    |sect5info
+    |referenceinfo
+    |refentryinfo
+    |partinfo
+    |info
+    |docinfo)[1]"/>
+  <xsl:if test="$info and $info/abstract">
+    <meta name="description">
+      <xsl:attribute name="content">
+        <xsl:for-each select="$info/abstract[1]/*">
+          <xsl:value-of select="normalize-space(.)"/>
+          <xsl:if test="position() &lt; last()">
+            <xsl:text> </xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:attribute>
+    </meta>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="head.content.link.made">
+  <xsl:param name="node" select="."/>
+  
+  <link rev="made" href="{$link.mailto.url}"/>
+</xsl:template>
+
+<xsl:template name="head.content.generator">
+  <xsl:param name="node" select="."/>
+  <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
+</xsl:template>
+
+<xsl:template name="head.content.style">
+  <xsl:param name="node" select="."/>
+  <style type="text/css"><xsl:text>
+body { background-image: url('</xsl:text>
+<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
+       background-repeat: no-repeat;
+       background-position: top left;
+       /* The following properties make the watermark "fixed" on the page. */
+       /* I think that's just a bit too distracting for the reader... */
+       /* background-attachment: fixed; */
+       /* background-position: center center; */
+     }</xsl:text>
+    </style>
+</xsl:template>
+
+<xsl:template name="head.content">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="title">
+    <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+  </xsl:param>
+
+  <xsl:call-template name="user.head.title">
+    <xsl:with-param name="title" select="$title"/>
+    <xsl:with-param name="node" select="$node"/>
+  </xsl:call-template>
+
+  <xsl:if test="$html.base != ''">
+    <xsl:call-template name="head.content.base">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <!-- Insert links to CSS files or insert literal style elements -->
+  <xsl:call-template name="generate.css"/>
+
+  <xsl:if test="$html.stylesheet != ''">
+    <xsl:call-template name="output.html.stylesheets">
+      <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="$html.script != ''">
+    <xsl:call-template name="output.html.scripts">
+      <xsl:with-param name="scripts" select="normalize-space($html.script)"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="$link.mailto.url != ''">
+    <xsl:call-template name="head.content.link.made">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:call-template name="head.content.generator">
+    <xsl:with-param name="node" select="$node"/>
+  </xsl:call-template>
+
+  <xsl:if test="$generate.meta.abstract != 0">
+    <xsl:call-template name="head.content.abstract">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="($draft.mode = 'yes' or
+                ($draft.mode = 'maybe' and
+                ancestor-or-self::*[@status][1]/@status = 'draft'))
+                and $draft.watermark.image != ''">
+    <xsl:call-template name="head.content.style">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:if>
+  <xsl:apply-templates select="." mode="head.keywords.content"/>
+</xsl:template>
+
+<xsl:template name="output.html.stylesheets">
+  <xsl:param name="stylesheets" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($stylesheets, ' ')">
+      <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
+
+      <xsl:call-template name="make.css.link">
+        <xsl:with-param name="css.filename" select="$css.filename"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="output.html.stylesheets">
+        <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$stylesheets != ''">
+      <xsl:call-template name="make.css.link">
+        <xsl:with-param name="css.filename" select="$stylesheets"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="output.html.scripts">
+  <xsl:param name="scripts" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($scripts, ' ')">
+      <xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/>
+
+      <xsl:call-template name="make.script.link">
+        <xsl:with-param name="script.filename" select="$script.filename"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="output.html.scripts">
+        <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$scripts != ''">
+      <xsl:call-template name="make.script.link">
+        <xsl:with-param name="script.filename" select="$scripts"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template match="*" mode="head.keywords.content">
+  <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="info/keywordset" mode="html.header"/>
+
+  <xsl:if test="$inherit.keywords != 0
+                and parent::*">
+    <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="system.head.content">
+  <xsl:param name="node" select="."/>
+
+  <!-- FIXME: When chunking, only the annotations actually used
+              in this chunk should be referenced. I don't think it
+              does any harm to reference them all, but it adds
+              unnecessary bloat to each chunk. -->
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <xsl:call-template name="add.annotation.links"/>
+    <script type="text/javascript">
+      <xsl:text>&#10;// Create PopupWindow objects</xsl:text>
+      <xsl:for-each select="//annotation">
+        <xsl:text>&#10;var popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text> = new PopupWindow("popup-</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>");&#10;</xsl:text>
+        <xsl:text>popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>.offsetY = 15;&#10;</xsl:text>
+        <xsl:text>popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>.autoHide();&#10;</xsl:text>
+      </xsl:for-each>
+    </script>
+
+    <style type="text/css">
+      <xsl:value-of select="$annotation.css"/>
+    </style>
+  </xsl:if>
+
+  <!-- system.head.content is like user.head.content, except that
+       it is called before head.content. This is important because it
+       means, for example, that <style> elements output by system.head.content
+       have a lower CSS precedence than the users stylesheet. -->
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="user.preroot">
+  <!-- Pre-root output, can be used to output comments and PIs. -->
+  <!-- This must not output any element content! -->
+</xsl:template>
+
+<xsl:template name="user.head.title">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="title"/>
+
+  <title>
+    <xsl:copy-of select="$title"/>
+  </title>
+</xsl:template>
+
+<xsl:template name="user.head.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.navigation">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+</xsl:template>
+
+<xsl:template name="user.header.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.navigation">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+</xsl:template>
+
+<!-- To use the same namespace-adjusted nodeset everywhere, it should
+be created as a global variable here.
+Used by docbook.xsl, chunk-common.xsl, chunktoc.xsl, and
+chunk-code.xsl; and in $chunk.hierarchy used in chunkfast.xsl -->
+<xsl:variable name="no.namespace">
+  <xsl:if test="$exsl.node.set.available != 0 and 
+                namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
+      <xsl:apply-templates select="/*" mode="stripNS"/>
+  </xsl:if>
+</xsl:variable>
+
+<xsl:template match="/">
+  <!-- * Get a title for current doc so that we let the user -->
+  <!-- * know what document we are processing at this point. -->
+  <xsl:variable name="doc.title">
+    <xsl:call-template name="get.doc.title"/>
+  </xsl:variable>
+  <xsl:choose>
+    <!-- fix namespace if necessary -->
+    <xsl:when test="$exsl.node.set.available != 0 and 
+                  namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
+      <xsl:call-template name="log.message">
+        <xsl:with-param name="level">Note</xsl:with-param>
+        <xsl:with-param name="source" select="$doc.title"/>
+        <xsl:with-param name="context-desc">
+          <xsl:text>namesp. cut</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="message">
+          <xsl:text>stripped namespace before processing</xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+      <!-- DEBUG: uncomment to save namespace-fixed document.
+      <xsl:message>Saving namespace-fixed document.</xsl:message>
+      <xsl:call-template name="write.chunk">
+        <xsl:with-param name="filename" select="'namespace-fixed.debug.xml'"/>
+        <xsl:with-param name="method" select="'xml'"/>
+        <xsl:with-param name="content">
+          <xsl:copy-of select="exsl:node-set($no.namespace)"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      -->
+      <xsl:apply-templates select="exsl:node-set($no.namespace)"/>
+    </xsl:when>
+    <!-- Can't process unless namespace fixed with exsl node-set()-->
+    <xsl:when test="namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
+      <xsl:message terminate="yes">
+        <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
+        <xsl:text> cannot proceed.</xsl:text>
+      </xsl:message>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$rootid != ''">
+          <xsl:choose>
+            <xsl:when test="count(key('id',$rootid)) = 0">
+              <xsl:message terminate="yes">
+                <xsl:text>ID '</xsl:text>
+                <xsl:value-of select="$rootid"/>
+                <xsl:text>' not found in document.</xsl:text>
+              </xsl:message>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:if test="$collect.xref.targets = 'yes' or
+                            $collect.xref.targets = 'only'">
+                <xsl:apply-templates select="key('id', $rootid)"
+                                     mode="collect.targets"/>
+              </xsl:if>
+              <xsl:if test="$collect.xref.targets != 'only'">
+                <xsl:apply-templates select="key('id',$rootid)"
+                                     mode="process.root"/>
+                <xsl:if test="$tex.math.in.alt != ''">
+                  <xsl:apply-templates select="key('id',$rootid)"
+                                       mode="collect.tex.math"/>
+                </xsl:if>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$collect.xref.targets = 'yes' or
+                        $collect.xref.targets = 'only'">
+            <xsl:apply-templates select="/" mode="collect.targets"/>
+          </xsl:if>
+          <xsl:if test="$collect.xref.targets != 'only'">
+            <xsl:apply-templates select="/" mode="process.root"/>
+            <xsl:if test="$tex.math.in.alt != ''">
+              <xsl:apply-templates select="/" mode="collect.tex.math"/>
+            </xsl:if>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:variable name="doc" select="self::*"/>
+
+  <xsl:call-template name="user.preroot"/>
+  <xsl:call-template name="root.messages"/>
+
+  <html>
+    <xsl:call-template name="root.attributes"/>
+    <head>
+      <xsl:call-template name="system.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="user.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </head>
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="."/>
+      <xsl:call-template name="user.footer.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </body>
+  </html>
+  <xsl:value-of select="$html.append"/>
+  
+  <!-- Generate any css files only once, not once per chunk -->
+  <xsl:call-template name="generate.css.files"/>
+</xsl:template>
+
+<xsl:template name="root.attributes">
+  <!-- customize to add attributes to <html> element  -->
+</xsl:template>
+
+<xsl:template name="root.messages">
+  <!-- redefine this any way you'd like to output messages -->
+  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+
+  <!-- The default is that we are not chunking... -->
+  <xsl:text>0</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/dtbl.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/dtbl.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/dtbl.xsl	(revision 119)
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:func="http://exslt.org/functions"
+                xmlns:dtbl="http://docbook.sourceforge.net/dtbl"
+                extension-element-prefixes="func"
+                exclude-result-prefixes="exsl func dtbl"
+                version="1.0">
+
+<func:function name="dtbl:convertLength">
+  <xsl:param name="arbitrary.length"/>
+
+  <xsl:variable name="pixels.per.inch" select="96"/>
+
+  <xsl:variable name="unscaled.length"
+                select="translate($arbitrary.length, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ', '')"/>
+
+  <xsl:variable name="units"
+                select="translate($arbitrary.length,'+-0123456789. ', '')"/>
+
+  <xsl:variable name="scaled.length">
+    <xsl:choose>
+      <xsl:when test="$units='in'">
+        <xsl:value-of select="$unscaled.length * $pixels.per.inch"/>
+      </xsl:when>
+      <xsl:when test="$units='cm'">
+        <xsl:value-of select="$unscaled.length * ($pixels.per.inch div 2.54)"/>
+      </xsl:when>
+      <xsl:when test="$units='mm'">
+        <xsl:value-of select="$unscaled.length * ($pixels.per.inch div 25.4)"/>
+      </xsl:when>
+      <xsl:when test="$units='pc'">
+        <xsl:value-of select="$unscaled.length * (($pixels.per.inch div 72) * 12)"/>
+      </xsl:when>
+      <xsl:when test="$units='pt'">
+        <xsl:value-of select="$unscaled.length * ($pixels.per.inch div 72)"/>
+      </xsl:when>
+      <xsl:when test="$units='px' or $units=''">
+        <xsl:value-of select="$unscaled.length"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message terminate="no">
+          <xsl:text>"</xsl:text>
+          <xsl:value-of select="$units"/>
+          <xsl:text>" is not a known unit.  Applying scaling factor of 1 instead.</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$unscaled.length"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <func:result select="round($scaled.length)"/>
+</func:function>
+
+<func:function name="dtbl:adjustColumnWidths">
+  <xsl:param name="colgroup"/>
+
+  <xsl:if test="$adjustColumnWidths.debug">
+    <xsl:message>
+      <xsl:text>entering adjustColumnWidths(</xsl:text>
+      <xsl:call-template name="dump-fragment">
+        <xsl:with-param name="fragment" select="$colgroup"/>
+      </xsl:call-template>
+      <xsl:text>)</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:variable name="expanded.colgroup">
+    <xsl:apply-templates select="exsl:node-set($colgroup)/*" mode="dtbl-split-widths"/>
+  </xsl:variable>
+
+  <xsl:variable name="absolute.widths.total">
+    <xsl:value-of select="sum(exsl:node-set($expanded.colgroup)//col/@abswidth)"/>
+  </xsl:variable>
+
+  <xsl:variable name="relative.widths.total">
+    <xsl:value-of select="sum(exsl:node-set($expanded.colgroup)//col/@relwidth)"/>
+  </xsl:variable>
+
+  <xsl:if test="$adjustColumnWidths.debug">
+    <xsl:message>
+      <xsl:text>total relative widths = (</xsl:text>
+      <xsl:value-of select="$relative.widths.total"/>
+      <xsl:text>)</xsl:text>
+    </xsl:message>
+    <xsl:message>
+      <xsl:text>total absolute widths = (</xsl:text>
+      <xsl:value-of select="$absolute.widths.total"/>
+      <xsl:text>)</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:variable name="adjusted.colgroup">
+    <xsl:choose>
+      <xsl:when test="$relative.widths.total = 0">
+        <xsl:if test="$adjustColumnWidths.debug">
+          <xsl:message>all widths are absolute</xsl:message>
+        </xsl:if>
+        <xsl:apply-templates select="exsl:node-set($expanded.colgroup)/*"
+                             mode="dtbl-use-absolute-widths"/>
+      </xsl:when>
+      <xsl:when test="$absolute.widths.total = 0">
+        <xsl:if test="$adjustColumnWidths.debug">
+          <xsl:message>all widths are relative</xsl:message>
+        </xsl:if>
+        <xsl:apply-templates select="exsl:node-set($expanded.colgroup)/*"
+                             mode="dtbl-use-relative-widths">
+          <xsl:with-param name="relative.widths.total"
+                          select="$relative.widths.total"/>
+        </xsl:apply-templates>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="corrected.adjusted.colgroup">
+    <xsl:choose>
+      <xsl:when test="$relative.widths.total = 0">
+        <xsl:copy-of select="$adjusted.colgroup"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="widths.total"
+                      select="sum(exsl:node-set($adjusted.colgroup)//col/@width)"/>
+        <xsl:variable name="n.columns"
+                      select="count(exsl:node-set($adjusted.colgroup)//col)"/>
+        <xsl:variable name="error"
+                      select="100 - $widths.total"/>
+        <xsl:variable name="first.bad.column"
+                      select="($n.columns - $error) + 1"/>
+        <xsl:apply-templates select="exsl:node-set($adjusted.colgroup)/*"
+                             mode="dtbl-correct-rounding-error">
+          <xsl:with-param name="first.bad.column"
+                          select="$first.bad.column"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:if test="$adjustColumnWidths.debug">
+    <xsl:message>
+      <xsl:text>result = (</xsl:text>
+      <xsl:call-template name="dump-fragment">
+        <xsl:with-param name="fragment" select="$corrected.adjusted.colgroup"/>
+      </xsl:call-template>
+      <xsl:text>)</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <func:result select="$corrected.adjusted.colgroup"/>
+</func:function>
+
+<xsl:template match="colgroup" mode="dtbl-correct-rounding-error">
+  <xsl:param name="first.bad.column"/>
+
+  <xsl:if test="$adjustColumnWidths.debug">
+    <xsl:message>
+      <xsl:text>first.bad.column = (</xsl:text>
+      <xsl:value-of select="$first.bad.column"/>
+      <xsl:text>)</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <colgroup>
+    <xsl:for-each select="col[position() &lt; $first.bad.column]">
+      <xsl:element name="col">
+        <xsl:attribute name="width">
+          <xsl:value-of select="concat(@width, '%')"/>
+        </xsl:attribute>
+      </xsl:element>
+    </xsl:for-each>
+    <xsl:for-each select="col[position() >= $first.bad.column]">
+      <xsl:element name="col">
+        <xsl:attribute name="width">
+          <xsl:value-of select="concat(@width + 1, '%')"/>
+        </xsl:attribute>
+      </xsl:element>
+    </xsl:for-each>
+  </colgroup>
+</xsl:template>
+
+<xsl:template match="col" mode="dtbl-correct-rounding-error">
+  <xsl:param name="relative.widths.total"/>
+  <xsl:param name="error"/>
+
+  <xsl:element name="col">
+    <xsl:attribute name="width">
+      <xsl:value-of select="concat('', round((@relwidth div $relative.widths.total) * 100))"/>
+    </xsl:attribute>
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="colgroup" mode="dtbl-use-relative-widths">
+  <xsl:param name="relative.widths.total"/>
+
+  <colgroup>
+    <xsl:apply-templates mode="dtbl-use-relative-widths">
+      <xsl:with-param name="relative.widths.total"
+                      select="$relative.widths.total"/>
+    </xsl:apply-templates>
+  </colgroup>
+</xsl:template>
+
+<xsl:template match="col" mode="dtbl-use-relative-widths">
+  <xsl:param name="relative.widths.total"/>
+
+  <xsl:element name="col">
+    <xsl:attribute name="width">
+      <xsl:value-of select="round((@relwidth div $relative.widths.total) * 100)"/>
+    </xsl:attribute>
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="colgroup" mode="dtbl-use-absolute-widths">
+  <colgroup>
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
+  </colgroup>
+</xsl:template>
+
+<xsl:template match="col" mode="dtbl-use-absolute-widths">
+  <xsl:element name="col">
+    <xsl:attribute name="width">
+      <xsl:value-of select="@abswidth"/>
+    </xsl:attribute>
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="colgroup" mode="dtbl-split-widths">
+  <colgroup>
+    <xsl:apply-templates mode="dtbl-split-widths"/>
+  </colgroup>
+</xsl:template>
+
+<xsl:template match="col" mode="dtbl-split-widths">
+
+  <!-- width = @width ? @width : '1*' -->
+  <xsl:variable name="width">
+    <xsl:choose>
+      <xsl:when test="@width != ''">
+        <xsl:value-of select="@width"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>1*</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- absolute.width = contains($width,'*') ? substring-after($width, '*') : $width -->
+  <xsl:variable name="absolute.width">
+    <xsl:choose>
+      <xsl:when test="contains($width, '*')">
+        <xsl:value-of select="substring-after($width, '*')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="converted.absolute.width">
+    <xsl:choose>
+      <xsl:when test="$absolute.width != ''">
+        <xsl:value-of select="dtbl:convertLength($absolute.width)"/>
+      </xsl:when>
+     <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="relative.width">
+    <xsl:choose>
+      <xsl:when test="substring-before($width, '*') != ''">
+        <xsl:value-of select="substring-before($width, '*')"/>
+      </xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:element name="col">
+    <xsl:attribute name="width">
+      <xsl:value-of select="$width"/>
+    </xsl:attribute>
+    <xsl:attribute name="relwidth">
+      <xsl:value-of select="$relative.width"/>
+    </xsl:attribute>
+    <xsl:attribute name="abswidth">
+      <xsl:value-of select="$converted.absolute.width"/>
+    </xsl:attribute>
+    <xsl:apply-templates mode="dtbl-split-widths"/>
+  </xsl:element>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/param.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/param.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/param.xsl	(revision 119)
@@ -0,0 +1,458 @@
+<?xml version="1.0"?>
+<!-- This file is generated from param.xweb -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<!-- ********************************************************************
+     $Id: param.xweb 9995 2015-10-01 16:34:45Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<xsl:param name="abstract.notitle.enabled" select="0"/>
+<xsl:param name="activate.external.olinks" select="1"/>
+<xsl:param name="admon.graphics.extension">.png</xsl:param>
+<xsl:param name="admon.graphics" select="0"/>
+<xsl:param name="admon.graphics.path">images/</xsl:param>
+<xsl:param name="admon.style">
+  <xsl:value-of select="concat('margin-', $direction.align.start,            ': 0.5in; margin-', $direction.align.end, ': 0.5in;')"/>
+</xsl:param>
+<xsl:param name="admon.textlabel" select="1"/>
+<xsl:param name="annotate.toc" select="1"/>
+<xsl:param name="annotation.css">
+/* ======================================================================
+   Annotations
+*/
+
+div.annotation-list  { visibility: hidden;
+                     }
+
+div.annotation-nocss { position: absolute;
+                       visibility: hidden;
+                     }
+
+div.annotation-popup { position: absolute;
+                       z-index: 4;
+                       visibility: hidden;
+                       padding: 0px;
+                       margin: 2px;
+                       border-style: solid;
+                       border-width: 1px;
+                       width: 200px;
+		       background-color: white;
+                     }
+
+div.annotation-title { padding: 1px;
+                       font-weight: bold;
+                       border-bottom-style: solid;
+                       border-bottom-width: 1px;
+		       color: white;
+		       background-color: black;
+                     }
+
+div.annotation-body  { padding: 2px;
+                     }
+
+div.annotation-body p { margin-top: 0px;
+                        padding-top: 0px;
+                      }
+
+div.annotation-close { position: absolute;
+                       top: 2px;
+                       right: 2px;
+                     }
+</xsl:param>
+<xsl:param name="annotation.graphic.close">
+http://docbook.sourceforge.net/release/images/annot-close.png</xsl:param>
+<xsl:param name="annotation.graphic.open">http://docbook.sourceforge.net/release/images/annot-open.png</xsl:param>
+
+<xsl:param name="adjustColumnWidths.debug" select="false()"/>
+<xsl:param name="annotation.js">
+<xsl:text>http://docbook.sourceforge.net/release/script/AnchorPosition.js http://docbook.sourceforge.net/release/script/PopupWindow.js</xsl:text></xsl:param>
+
+<xsl:param name="annotation.support" select="0"/>
+<xsl:param name="appendix.autolabel">A</xsl:param>
+<xsl:param name="author.othername.in.middle" select="1"/>
+<xsl:param name="autotoc.label.in.hyperlink" select="1"/>
+<xsl:param name="autotoc.label.separator">. </xsl:param>
+<xsl:param name="autolink.index.see" select="1"/>
+<xsl:param name="base.dir"/>
+<xsl:param name="biblioentry.item.separator">. </xsl:param>
+<xsl:param name="bibliography.collection">http://docbook.sourceforge.net/release/bibliography/bibliography.xml</xsl:param>
+
+<xsl:param name="bibliography.numbered" select="0"/>
+<xsl:param name="bibliography.style">normal</xsl:param>
+<xsl:param name="blurb.on.titlepage.enabled" select="0"/>
+<xsl:param name="bridgehead.in.toc" select="0"/>
+<xsl:param name="callout.defaultcolumn">60</xsl:param>
+<xsl:param name="callout.graphics.extension">.png</xsl:param>
+
+<xsl:param name="callout.graphics" select="1"/>
+<xsl:param name="callout.graphics.number.limit">15</xsl:param>
+
+<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
+<xsl:param name="callout.list.table" select="1"/>
+<xsl:param name="callout.unicode" select="0"/>
+<xsl:param name="callout.unicode.number.limit">10</xsl:param>
+<xsl:param name="callout.unicode.start.character">10102</xsl:param>
+<xsl:param name="callouts.extension" select="1"/>
+<xsl:param name="chapter.autolabel" select="1"/>
+<xsl:param name="chunk.append"/>
+<xsl:param name="chunk.first.sections" select="0"/>
+<xsl:param name="chunk.quietly" select="0"/>
+<xsl:param name="chunk.section.depth" select="1"/>
+<xsl:param name="chunk.separate.lots" select="0"/>
+<xsl:param name="chunk.toc"/>
+<xsl:param name="chunk.tocs.and.lots" select="0"/>
+<xsl:param name="chunk.tocs.and.lots.has.title" select="1"/>
+<xsl:param name="chunked.filename.prefix"/>
+<xsl:param name="citerefentry.link" select="0"/>
+<xsl:param name="collect.xref.targets">no</xsl:param>
+<xsl:param name="component.label.includes.part.label" select="0"/>
+<xsl:param name="contrib.inline.enabled">1</xsl:param>
+<xsl:param name="css.decoration" select="1"/>
+<xsl:param name="current.docid"/>
+<xsl:param name="custom.css.source"/>
+<xsl:param name="default.float.class">
+  <xsl:choose>
+    <xsl:when test="contains($stylesheet.result.type,'html')">left</xsl:when>
+    <xsl:otherwise>before</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="default.image.width"/>
+<xsl:param name="default.table.frame">all</xsl:param>
+<xsl:param name="default.table.width"/>
+<xsl:param name="docbook.css.link" select="1"/>
+<xsl:param name="docbook.css.source">docbook.css.xml</xsl:param>
+<xsl:param name="draft.mode">no</xsl:param>
+<xsl:param name="draft.watermark.image">images/draft.png</xsl:param>
+<xsl:param name="ebnf.assignment">
+<code>::=</code>
+</xsl:param>
+
+<xsl:param name="ebnf.statement.terminator"/>
+
+<xsl:param name="ebnf.table.bgcolor">#F5DCB3</xsl:param>
+<xsl:param name="ebnf.table.border" select="1"/>
+<xsl:param name="eclipse.autolabel" select="0"/>
+<xsl:param name="eclipse.plugin.id">com.example.help</xsl:param>
+<xsl:param name="eclipse.plugin.name">DocBook Online Help Sample</xsl:param>
+<xsl:param name="eclipse.plugin.provider">Example provider</xsl:param>
+<xsl:param name="editedby.enabled">1</xsl:param>
+<xsl:param name="email.delimiters.enabled" select="1"/>
+<xsl:param name="emphasis.propagates.style" select="1"/>
+<xsl:param name="entry.propagates.style" select="1"/>
+<xsl:param name="exsl.node.set.available"> 
+  <xsl:choose>
+    <xsl:when xmlns:exsl="http://exslt.org/common" exsl:foo="" test="function-available('exsl:node-set') or                        contains(system-property('xsl:vendor'),                          'Apache Software Foundation')">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="firstterm.only.link" select="0"/>
+<xsl:param name="footer.rule" select="1"/>
+<xsl:param name="footnote.number.format">1</xsl:param>
+<xsl:param name="footnote.number.symbols"/>
+<xsl:param name="formal.procedures" select="1"/>
+<xsl:param name="formal.title.placement">
+figure before
+example before
+equation before
+table before
+procedure before
+task before
+</xsl:param>
+<xsl:param name="funcsynopsis.decoration" select="1"/>
+<xsl:param name="funcsynopsis.style">kr</xsl:param>
+<xsl:param name="function.parens" select="0"/>
+<xsl:param name="generate.consistent.ids" select="0"/>
+<xsl:param name="generate.css.header" select="0"/>
+<xsl:param name="generate.id.attributes" select="0"/>
+<xsl:param name="generate.index" select="1"/>
+<xsl:param name="generate.legalnotice.link" select="0"/>
+<xsl:param name="generate.manifest" select="0"/>
+<xsl:param name="generate.meta.abstract" select="1"/>
+<xsl:param name="generate.revhistory.link" select="0"/>
+<xsl:param name="generate.section.toc.level" select="0"/>
+<xsl:param name="generate.toc">
+appendix  toc,title
+article/appendix  nop
+article   toc,title
+book      toc,title,figure,table,example,equation
+chapter   toc,title
+part      toc,title
+preface   toc,title
+qandadiv  toc
+qandaset  toc
+reference toc,title
+sect1     toc
+sect2     toc
+sect3     toc
+sect4     toc
+sect5     toc
+section   toc
+set       toc,title
+</xsl:param>
+
+<xsl:param name="glossary.collection"/>
+<xsl:param name="glossary.sort" select="0"/>
+<xsl:param name="glossentry.show.acronym">no</xsl:param>
+<xsl:param name="glossterm.auto.link" select="0"/>
+<xsl:param name="graphic.default.extension"/>
+<xsl:param name="graphicsize.extension" select="1"/>
+<xsl:param name="graphicsize.use.img.src.path" select="0"/>
+<xsl:param name="header.rule" select="1"/>
+<xsl:param name="highlight.default.language"/>
+<xsl:param name="highlight.source" select="0"/>
+<xsl:param name="highlight.xslthl.config"/>
+<xsl:param name="html.append"/>
+<xsl:param name="html.base"/>
+<xsl:param name="html.cellpadding"/>
+<xsl:param name="html.cellspacing"/>
+<xsl:param name="html.cleanup" select="1"/>
+<xsl:param name="html.ext">.html</xsl:param>
+<xsl:param name="html.extra.head.links" select="0"/>
+<xsl:param name="html.head.legalnotice.link.multiple" select="1"/>
+<xsl:param name="html.head.legalnotice.link.types">copyright</xsl:param>
+<xsl:param name="html.longdesc" select="1"/>
+<xsl:param name="html.longdesc.link" select="$html.longdesc"/>
+<xsl:param name="html.script"/>
+<xsl:param name="html.script.type">text/javascript</xsl:param>
+<xsl:param name="html.stylesheet"/>
+<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+<xsl:param name="htmlhelp.alias.file">alias.h</xsl:param>
+<xsl:param name="htmlhelp.autolabel" select="0"/>
+<xsl:param name="htmlhelp.button.back" select="1"/>
+<xsl:param name="htmlhelp.button.forward" select="0"/>
+<xsl:param name="htmlhelp.button.hideshow" select="1"/>
+<xsl:param name="htmlhelp.button.home" select="0"/>
+<xsl:param name="htmlhelp.button.home.url"/>
+<xsl:param name="htmlhelp.button.jump1" select="0"/>
+<xsl:param name="htmlhelp.button.jump1.title">User1</xsl:param>
+<xsl:param name="htmlhelp.button.jump1.url"/>
+<xsl:param name="htmlhelp.button.jump2" select="0"/>
+<xsl:param name="htmlhelp.button.jump2.title">User2</xsl:param>
+<xsl:param name="htmlhelp.button.jump2.url"/>
+<xsl:param name="htmlhelp.button.locate" select="0"/>
+<xsl:param name="htmlhelp.button.next" select="1"/>
+<xsl:param name="htmlhelp.button.options" select="1"/>
+<xsl:param name="htmlhelp.button.prev" select="1"/>
+<xsl:param name="htmlhelp.button.print" select="1"/>
+<xsl:param name="htmlhelp.button.refresh" select="0"/>
+<xsl:param name="htmlhelp.button.stop" select="0"/>
+<xsl:param name="htmlhelp.button.zoom" select="0"/>
+<xsl:param name="htmlhelp.chm">htmlhelp.chm</xsl:param>
+<xsl:param name="htmlhelp.default.topic"/>
+<xsl:param name="htmlhelp.display.progress" select="1"/>
+<xsl:param name="htmlhelp.encoding">iso-8859-1</xsl:param>
+<xsl:param name="htmlhelp.enhanced.decompilation" select="0"/>
+<xsl:param name="htmlhelp.enumerate.images" select="0"/>
+<xsl:param name="htmlhelp.force.map.and.alias" select="0"/>
+<xsl:param name="htmlhelp.hhc.binary" select="1"/>
+<xsl:param name="htmlhelp.hhc.folders.instead.books" select="1"/>
+<xsl:param name="htmlhelp.hhc">toc.hhc</xsl:param>
+<xsl:param name="htmlhelp.hhc.section.depth">5</xsl:param>
+<xsl:param name="htmlhelp.hhc.show.root" select="1"/>
+<xsl:param name="htmlhelp.hhc.width"/>
+<xsl:param name="htmlhelp.hhk">index.hhk</xsl:param>
+<xsl:param name="htmlhelp.hhp">htmlhelp.hhp</xsl:param>
+<xsl:param name="htmlhelp.hhp.tail"/>
+<xsl:param name="htmlhelp.hhp.window">Main</xsl:param>
+<xsl:param name="htmlhelp.hhp.windows"/>
+<xsl:param name="htmlhelp.map.file">context.h</xsl:param>
+<xsl:param name="htmlhelp.only" select="0"/>
+<xsl:param name="htmlhelp.remember.window.position" select="0"/>
+<xsl:param name="htmlhelp.show.advanced.search" select="0"/>
+<xsl:param name="htmlhelp.show.favorities" select="0"/>
+<xsl:param name="htmlhelp.show.menu" select="0"/>
+<xsl:param name="htmlhelp.show.toolbar.text" select="1"/>
+<xsl:param name="htmlhelp.title"/>
+<xsl:param name="htmlhelp.use.hhk" select="0"/>
+<xsl:param name="htmlhelp.window.geometry"/>
+<xsl:param name="id.warnings" select="0"/>
+<xsl:param name="ignore.image.scaling" select="0"/>
+<xsl:param name="img.src.path"/>
+<xsl:param name="index.links.to.section" select="1"/>
+<xsl:param name="index.method">basic</xsl:param>
+<xsl:param name="index.number.separator"/>
+<xsl:param name="index.on.role" select="0"/>
+<xsl:param name="index.on.type" select="0"/>
+<xsl:param name="index.prefer.titleabbrev" select="0"/>
+<xsl:param name="index.range.separator"/>
+<xsl:param name="index.term.separator"/>
+<xsl:param name="inherit.keywords" select="1"/>
+<xsl:param name="insert.olink.page.number">no</xsl:param>
+<xsl:param name="insert.olink.pdf.frag" select="0"/>
+<xsl:param name="insert.xref.page.number">no</xsl:param>
+<xsl:param name="insert.xref.page.number.para">yes</xsl:param>
+<xsl:param name="javahelp.encoding">iso-8859-1</xsl:param>
+<xsl:param name="keep.relative.image.uris" select="1"/>
+
+<xsl:param name="l10n.gentext.default.language">en</xsl:param>
+<xsl:param name="l10n.gentext.language"/>
+<xsl:param name="l10n.gentext.use.xref.language" select="0"/>
+<xsl:param name="l10n.lang.value.rfc.compliant" select="1"/>
+<xsl:param name="label.from.part" select="0"/>
+<xsl:param name="linenumbering.everyNth">5</xsl:param>
+<xsl:param name="linenumbering.extension" select="1"/>
+<xsl:param name="linenumbering.separator"><xsl:text> </xsl:text></xsl:param>
+<xsl:param name="linenumbering.width">3</xsl:param>
+<xsl:param name="link.mailto.url"/>
+<xsl:param name="make.clean.html" select="0"/>
+<xsl:param name="make.graphic.viewport" select="1"/>
+<xsl:param name="make.single.year.ranges" select="0"/>
+<xsl:param name="make.valid.html" select="0"/>
+<xsl:param name="make.year.ranges" select="0"/>
+    <xsl:param name="manifest">HTML.manifest</xsl:param>
+    
+<xsl:param name="manifest.in.base.dir" select="0"/>
+<xsl:param name="manual.toc"/>
+<xsl:param name="menuchoice.menu.separator"> → </xsl:param>
+<xsl:param name="menuchoice.separator">+</xsl:param>
+<xsl:param name="navig.graphics.extension">.gif</xsl:param>
+<xsl:param name="navig.graphics" select="0"/>
+<xsl:param name="navig.graphics.path">images/</xsl:param>
+<xsl:param name="navig.showtitles">1</xsl:param>
+<xsl:param name="nominal.image.depth" select="4 * $pixels.per.inch"/>
+<xsl:param name="nominal.image.width" select="6 * $pixels.per.inch"/>
+<xsl:param name="nominal.table.width">6in</xsl:param>
+<xsl:param name="olink.base.uri"/>
+<xsl:param name="olink.debug" select="0"/>
+<xsl:param name="olink.doctitle">no</xsl:param> 
+<xsl:param name="olink.lang.fallback.sequence"/>
+<xsl:attribute-set name="olink.properties">
+  <xsl:attribute name="show-destination">replace</xsl:attribute>
+</xsl:attribute-set>
+<xsl:param name="othercredit.like.author.enabled">0</xsl:param>
+<xsl:param name="para.propagates.style" select="1"/>
+<xsl:param name="part.autolabel">I</xsl:param>
+<xsl:param name="phrase.propagates.style" select="1"/>
+<xsl:param name="pixels.per.inch">90</xsl:param>
+<xsl:param name="points.per.em">10</xsl:param>
+<xsl:param name="preface.autolabel" select="0"/>
+<xsl:param name="prefer.internal.olink" select="0"/>
+<xsl:param name="preferred.mediaobject.role"/>
+<xsl:param name="process.empty.source.toc" select="0"/>
+<xsl:param name="process.source.toc" select="0"/>
+<xsl:param name="profile.arch"/>
+<xsl:param name="profile.attribute"/>
+<xsl:param name="profile.audience"/>
+<xsl:param name="profile.condition"/>
+<xsl:param name="profile.conformance"/>
+<xsl:param name="profile.lang"/>
+<xsl:param name="profile.os"/>
+<xsl:param name="profile.outputformat"/>
+<xsl:param name="profile.revision"/>
+<xsl:param name="profile.revisionflag"/>
+<xsl:param name="profile.role"/>
+<xsl:param name="profile.security"/>
+<xsl:param name="profile.separator">;</xsl:param>
+<xsl:param name="profile.status"/>
+<xsl:param name="profile.userlevel"/>
+<xsl:param name="profile.value"/>
+<xsl:param name="profile.vendor"/>
+<xsl:param name="profile.wordsize"/>
+<xsl:param name="punct.honorific">.</xsl:param>
+<xsl:param name="qanda.defaultlabel">number</xsl:param>
+<xsl:param name="qanda.in.toc" select="0"/>
+<xsl:param name="qanda.inherit.numeration" select="1"/>
+<xsl:param name="qanda.nested.in.toc" select="0"/>
+<xsl:param name="qandadiv.autolabel" select="1"/>
+<xsl:param name="refclass.suppress" select="0"/>
+<xsl:param name="refentry.generate.name" select="1"/>
+<xsl:param name="refentry.generate.title" select="0"/>
+<xsl:param name="refentry.separator" select="1"/>
+<xsl:param name="refentry.xref.manvolnum" select="1"/>
+  <xsl:param name="reference.autolabel">I</xsl:param>
+<xsl:param name="root.filename">index</xsl:param>
+<xsl:param name="rootid"/>
+<xsl:param name="runinhead.default.title.end.punct">.</xsl:param>
+<xsl:param name="runinhead.title.end.punct">.!?:</xsl:param>
+<xsl:param name="section.autolabel" select="0"/>
+<xsl:param name="section.autolabel.max.depth">8</xsl:param>
+<xsl:param name="section.label.includes.component.label" select="0"/>
+<xsl:param name="segmentedlist.as.table" select="0"/>
+<xsl:param name="shade.verbatim" select="0"/>
+<xsl:attribute-set name="shade.verbatim.style">
+  <xsl:attribute name="border">0</xsl:attribute>
+  <xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="show.comments" select="1"/>
+<xsl:param name="show.revisionflag" select="0"/>
+<xsl:param name="simplesect.in.toc" select="0"/>
+<xsl:param name="spacing.paras" select="0"/>
+<xsl:param name="suppress.footer.navigation">0</xsl:param>
+<xsl:param name="suppress.header.navigation" select="0"/>
+<xsl:param name="suppress.navigation" select="0"/>
+<xsl:param name="table.borders.with.css" select="0"/>
+<xsl:param name="table.cell.border.color"/>
+
+<xsl:param name="table.cell.border.style">solid</xsl:param>
+<xsl:param name="table.cell.border.thickness">
+  <xsl:choose>
+    <xsl:when test="contains($stylesheet.result.type,'html')">1px</xsl:when>
+    <xsl:otherwise>0.5pt</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="table.footnote.number.format">a</xsl:param>
+<xsl:param name="table.footnote.number.symbols"/>
+<xsl:param name="table.frame.border.color"/>
+
+<xsl:param name="table.frame.border.style">solid</xsl:param>
+<xsl:param name="table.frame.border.thickness">
+  <xsl:choose>
+    <xsl:when test="contains($stylesheet.result.type,'html')">1px</xsl:when>
+    <xsl:otherwise>0.5pt</xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+<xsl:param name="tablecolumns.extension" select="1"/>
+ <xsl:param name="target.database.document">olinkdb.xml</xsl:param>
+<xsl:param name="targets.filename">target.db</xsl:param>
+<xsl:param name="tex.math.delims" select="1"/>
+<xsl:param name="tex.math.file">tex-math-equations.tex</xsl:param>
+<xsl:param name="tex.math.in.alt"/>
+<xsl:param name="textdata.default.encoding"/>
+  <xsl:param name="textinsert.extension" select="1"/>
+<xsl:param name="toc.list.type">dl</xsl:param>
+<xsl:param name="toc.max.depth">8</xsl:param>
+<xsl:param name="toc.section.depth">2</xsl:param>
+<xsl:param name="ulink.target">_top</xsl:param>
+<xsl:param name="use.embed.for.svg" select="0"/>
+<xsl:param name="use.extensions" select="0"/>
+<xsl:param name="use.id.as.filename" select="0"/>
+<xsl:param name="use.local.olink.style" select="0"/> 
+<xsl:param name="use.role.as.xrefstyle" select="1"/>
+<xsl:param name="use.role.for.mediaobject" select="1"/>
+<xsl:param name="use.svg" select="1"/>
+<xsl:param name="variablelist.as.table" select="0"/>
+<xsl:param name="variablelist.term.break.after">0</xsl:param>
+<xsl:param name="variablelist.term.separator">, </xsl:param>
+<xsl:param name="webhelp.autolabel">0</xsl:param>
+<xsl:param name="webhelp.base.dir">docs</xsl:param>
+<xsl:param name="webhelp.common.dir">../common/</xsl:param>
+<xsl:param name="webhelp.default.topic">index.html</xsl:param>
+<xsl:param name="webhelp.include.search.tab">1</xsl:param>
+<xsl:param name="webhelp.indexer.language">en</xsl:param>
+<xsl:param name="webhelp.start.filename">index.html</xsl:param>
+<xsl:param name="webhelp.tree.cookie.id" select="concat( 'treeview-', count(//node()) )"/>
+<xsl:param name="writing.mode">
+  <xsl:call-template name="gentext">
+    <xsl:with-param name="key">writing-mode</xsl:with-param>
+    <xsl:with-param name="lang">
+      <xsl:call-template name="l10n.language">
+        <xsl:with-param name="target" select="/*[1]"/>
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:param>
+<xsl:param name="xref.label-page.separator"><xsl:text> </xsl:text></xsl:param>
+<xsl:param name="xref.label-title.separator">: </xsl:param>
+<xsl:param name="xref.title-page.separator"><xsl:text> </xsl:text></xsl:param>
+<xsl:param name="xref.with.number.and.title" select="1"/>
+<xsl:param name="link.to.self.for.mediaobject" select="0"/>
+
+</xsl:stylesheet>
+
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/table.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/table.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/html/table.xsl	(revision 119)
@@ -0,0 +1,1220 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
+                xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
+                xmlns:xtbl="xalan://com.nwalsh.xalan.Table"
+                xmlns:lxslt="http://xml.apache.org/xslt"
+                xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
+                xmlns:dtbl="http://docbook.sourceforge.net/dtbl"
+                exclude-result-prefixes="doc stbl xtbl lxslt ptbl dtbl"
+                version='1.0'>
+
+<xsl:include href="../common/table.xsl"/>
+
+<!-- ********************************************************************
+     $Id: table.xsl 9978 2015-07-31 23:47:28Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<lxslt:component prefix="xtbl"
+                 functions="adjustColumnWidths"/>
+
+<xsl:template name="empty.table.cell">
+  <xsl:param name="colnum" select="0"/>
+
+  <xsl:variable name="rowsep">
+    <xsl:choose>
+      <!-- If this is the last row, rowsep never applies. -->
+      <xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row
+                          or ancestor-or-self::thead/following-sibling::tbody
+                          or ancestor-or-self::tbody/preceding-sibling::tfoot)">
+        <xsl:value-of select="0"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+          <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
+          <xsl:with-param name="colnum" select="$colnum"/>
+          <xsl:with-param name="attribute" select="'rowsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="colsep">
+    <xsl:choose>
+      <!-- If this is the last column, colsep never applies. -->
+      <xsl:when test="number($colnum) &gt;= ancestor::tgroup/@cols">0</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+          <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
+          <xsl:with-param name="colnum" select="$colnum"/>
+          <xsl:with-param name="attribute" select="'colsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <td class="auto-generated">
+    <xsl:if test="$table.borders.with.css != 0">
+      <xsl:attribute name="style">
+        <xsl:if test="$colsep &gt; 0">
+          <xsl:call-template name="border">
+            <xsl:with-param name="side" select="'right'"/>
+          </xsl:call-template>
+        </xsl:if>
+        <xsl:if test="$rowsep &gt; 0">
+          <xsl:call-template name="border">
+            <xsl:with-param name="side" select="'bottom'"/>
+          </xsl:call-template>
+        </xsl:if>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:text>&#160;</xsl:text>
+  </td>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="border">
+  <xsl:param name="side" select="'left'"/>
+  <xsl:param name="padding" select="0"/>
+  <xsl:param name="style" select="$table.cell.border.style"/>
+  <xsl:param name="color" select="$table.cell.border.color"/>
+  <xsl:param name="thickness" select="$table.cell.border.thickness"/>
+
+  <!-- Note: Some browsers (mozilla) require at least a width and style. -->
+
+  <xsl:choose>
+    <xsl:when test="($thickness != ''
+                     and $style != ''
+                     and $color != '')
+                    or ($thickness != ''
+                        and $style != '')
+                    or ($thickness != '')">
+      <!-- use the compound property if we can: -->
+      <!-- it saves space and probably works more reliably -->
+      <xsl:text>border-</xsl:text>
+      <xsl:value-of select="$side"/>
+      <xsl:text>: </xsl:text>
+      <xsl:value-of select="$thickness"/>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="$style"/>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="$color"/>
+      <xsl:text>; </xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- we need to specify the styles individually -->
+      <xsl:if test="$thickness != ''">
+        <xsl:text>border-</xsl:text>
+        <xsl:value-of select="$side"/>
+        <xsl:text>-width: </xsl:text>
+        <xsl:value-of select="$thickness"/>
+        <xsl:text>; </xsl:text>
+      </xsl:if>
+
+      <xsl:if test="$style != ''">
+        <xsl:text>border-</xsl:text>
+        <xsl:value-of select="$side"/>
+        <xsl:text>-style: </xsl:text>
+        <xsl:value-of select="$style"/>
+        <xsl:text>; </xsl:text>
+      </xsl:if>
+
+      <xsl:if test="$color != ''">
+        <xsl:text>border-</xsl:text>
+        <xsl:value-of select="$side"/>
+        <xsl:text>-color: </xsl:text>
+        <xsl:value-of select="$color"/>
+        <xsl:text>; </xsl:text>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="tgroup" name="tgroup">
+  <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
+    <xsl:message terminate="yes">
+      <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:variable name="summary">
+    <xsl:call-template name="pi.dbhtml_table-summary"/>
+  </xsl:variable>
+
+  <xsl:variable name="cellspacing">
+    <xsl:call-template name="pi.dbhtml_cellspacing"/>
+  </xsl:variable>
+
+  <xsl:variable name="cellpadding">
+    <xsl:call-template name="pi.dbhtml_cellpadding"/>
+  </xsl:variable>
+
+  <table>
+    <!-- common attributes should come from parent table, not tgroup -->
+    <xsl:apply-templates select=".." mode="common.html.attributes"/>
+
+    <xsl:choose>
+      <!-- If there's a textobject/phrase for the table summary, use it -->
+      <xsl:when test="../textobject/phrase">
+        <xsl:attribute name="summary">
+          <xsl:value-of select="../textobject/phrase"/>
+        </xsl:attribute>
+      </xsl:when>
+
+      <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
+           the HTML table summary attribute -->
+      <xsl:when test="$summary != ''">
+        <xsl:attribute name="summary">
+          <xsl:value-of select="$summary"/>
+        </xsl:attribute>
+      </xsl:when>
+
+      <!-- Otherwise, if there's a title, use that -->
+      <xsl:when test="../title">
+        <xsl:attribute name="summary">
+          <!-- This screws up on inline markup and footnotes, oh well... -->
+          <xsl:value-of select="string(../title)"/>
+        </xsl:attribute>
+      </xsl:when>
+
+      <!-- Otherwise, forget the whole idea -->
+      <xsl:otherwise><!-- nevermind --></xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
+      <xsl:attribute name="cellspacing">
+        <xsl:choose>
+          <xsl:when test="$cellspacing != ''">
+            <xsl:value-of select="$cellspacing"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$html.cellspacing"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
+      <xsl:attribute name="cellpadding">
+        <xsl:choose>
+          <xsl:when test="$cellpadding != ''">
+            <xsl:value-of select="$cellpadding"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$html.cellpadding"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
+      <xsl:attribute name="width">100%</xsl:attribute>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="$table.borders.with.css != 0">
+        <xsl:choose>
+          <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
+            <xsl:attribute name="style">
+              <xsl:text>border-collapse: collapse;</xsl:text>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'top'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'bottom'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'left'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'right'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
+            <xsl:attribute name="style">
+              <xsl:text>border-collapse: collapse;</xsl:text>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'top'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'bottom'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
+            <xsl:attribute name="style">
+              <xsl:text>border-collapse: collapse;</xsl:text>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'top'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
+            <xsl:attribute name="style">
+              <xsl:text>border-collapse: collapse;</xsl:text>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'bottom'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
+            <xsl:attribute name="style">
+              <xsl:text>border-collapse: collapse;</xsl:text>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'left'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'right'"/>
+                <xsl:with-param name="style" select="$table.frame.border.style"/>
+                <xsl:with-param name="color" select="$table.frame.border.color"/>
+                <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:when test="../@frame='none'">
+            <xsl:attribute name="style">
+              <xsl:text>border: none;</xsl:text>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="style">
+              <xsl:text>border-collapse: collapse;</xsl:text>
+            </xsl:attribute>
+          </xsl:otherwise>
+        </xsl:choose>
+
+      </xsl:when>
+      <xsl:when test="../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
+        <xsl:attribute name="border">0</xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="border">1</xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:variable name="colgroup">
+      <colgroup>
+        <xsl:call-template name="generate.colgroup">
+          <xsl:with-param name="cols" select="@cols"/>
+        </xsl:call-template>
+      </colgroup>
+    </xsl:variable>
+
+    <xsl:variable name="explicit.table.width">
+      <xsl:call-template name="pi.dbhtml_table-width">
+        <xsl:with-param name="node" select=".."/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="table.width">
+      <xsl:choose>
+        <xsl:when test="$explicit.table.width != ''">
+          <xsl:value-of select="$explicit.table.width"/>
+        </xsl:when>
+        <xsl:when test="$default.table.width = ''">
+          <xsl:text>100%</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$default.table.width"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:if test="$default.table.width != ''
+                  or $explicit.table.width != ''">
+      <xsl:attribute name="width">
+        <xsl:choose>
+          <xsl:when test="contains($table.width, '%')">
+            <xsl:value-of select="$table.width"/>
+          </xsl:when>
+          <xsl:when test="$use.extensions != 0
+                          and $tablecolumns.extension != 0">
+            <xsl:choose>
+              <xsl:when test="function-available('dtbl:convertLength')">
+                <xsl:value-of select="dtbl:convertLength($table.width)"/>
+              </xsl:when>
+              <xsl:when test="function-available('stbl:convertLength')">
+                <xsl:value-of select="stbl:convertLength($table.width)"/>
+              </xsl:when>
+              <xsl:when test="function-available('xtbl:convertLength')">
+                <xsl:value-of select="xtbl:convertLength($table.width)"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:message terminate="yes">
+                  <xsl:text>No convertLength function available.</xsl:text>
+                </xsl:message>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$table.width"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="$use.extensions != 0
+                      and $tablecolumns.extension != 0">
+        <xsl:choose>
+          <xsl:when test="function-available('dtbl:adjustColumnWidths')">
+            <xsl:copy-of select="dtbl:adjustColumnWidths($colgroup)"/>
+          </xsl:when>
+          <xsl:when test="function-available('stbl:adjustColumnWidths')">
+            <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
+          </xsl:when>
+          <xsl:when test="function-available('xtbl:adjustColumnWidths')">
+            <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
+          </xsl:when>
+          <xsl:when test="function-available('ptbl:adjustColumnWidths')">
+            <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:message terminate="yes">
+              <xsl:text>No adjustColumnWidths function available.</xsl:text>
+            </xsl:message>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$colgroup"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:apply-templates select="thead"/>
+    <xsl:apply-templates select="tfoot"/>
+    <xsl:apply-templates select="tbody"/>
+
+    <xsl:if test=".//footnote|../title//footnote">
+      <tbody class="footnotes">
+        <tr>
+          <td colspan="{@cols}">
+            <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
+          </td>
+        </tr>
+      </tbody>
+    </xsl:if>
+  </table>
+</xsl:template>
+
+<xsl:template match="tgroup/processing-instruction('dbhtml')">
+  <xsl:variable name="summary">
+    <xsl:call-template name="pi.dbhtml_table-summary"/>
+  </xsl:variable>
+
+  <!-- Suppress the table-summary PI -->
+  <xsl:if test="$summary = ''">
+    <xsl:processing-instruction name="dbhtml">
+      <xsl:value-of select="."/>
+    </xsl:processing-instruction>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="colspec"></xsl:template>
+
+<xsl:template match="spanspec"></xsl:template>
+
+<xsl:template match="thead|tfoot">
+  <xsl:element name="{local-name(.)}">
+    <xsl:if test="@align">
+      <xsl:attribute name="align">
+        <xsl:value-of select="@align"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@char">
+      <xsl:attribute name="char">
+        <xsl:value-of select="@char"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@charoff">
+      <xsl:attribute name="charoff">
+        <xsl:value-of select="@charoff"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@valign">
+      <xsl:attribute name="valign">
+        <xsl:value-of select="@valign"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:choose>
+      <!-- recurse on rows only if @morerows is present -->
+      <xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
+        <xsl:apply-templates select="row[1]">
+          <xsl:with-param name="spans">
+            <xsl:call-template name="blank.spans">
+              <xsl:with-param name="cols" select="../@cols"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="browserows" select="'recurse'"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="row">
+          <xsl:with-param name="spans">
+            <xsl:call-template name="blank.spans">
+              <xsl:with-param name="cols" select="../@cols"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="browserows" select="'loop'" />
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="tbody">
+  <tbody>
+    <xsl:if test="@align">
+      <xsl:attribute name="align">
+        <xsl:value-of select="@align"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@char">
+      <xsl:attribute name="char">
+        <xsl:value-of select="@char"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@charoff">
+      <xsl:attribute name="charoff">
+        <xsl:value-of select="@charoff"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@valign">
+      <xsl:attribute name="valign">
+        <xsl:value-of select="@valign"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
+        <xsl:apply-templates select="row[1]">
+          <xsl:with-param name="spans">
+            <xsl:call-template name="blank.spans">
+              <xsl:with-param name="cols" select="../@cols"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="browserows" select="'recurse'"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="row">
+          <xsl:with-param name="spans">
+            <xsl:call-template name="blank.spans">
+              <xsl:with-param name="cols" select="../@cols"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="browserows" select="'loop'" />
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+
+  </tbody>
+</xsl:template>
+
+<xsl:template match="row">
+  <xsl:param name="spans"/>
+  <xsl:param name="browserows"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($spans, '0')">
+      <xsl:call-template name="normal-row">
+        <xsl:with-param name="spans" select="$spans"/>
+        <xsl:with-param name="browserows" select="$browserows"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <!--
+      <xsl:message>
+        <xsl:text>Ignoring row: </xsl:text>
+        <xsl:value-of select="$spans"/>
+        <xsl:text> = </xsl:text>
+        <xsl:call-template name="consume-row">
+          <xsl:with-param name="spans" select="$spans"/>
+        </xsl:call-template>
+      </xsl:message>
+      -->
+
+      <xsl:if test="normalize-space(.//text()) != ''">
+        <xsl:message>Warning: overlapped row contains content!</xsl:message>
+      </xsl:if>
+
+      <tr><xsl:comment> This row intentionally left blank </xsl:comment></tr>
+
+      <xsl:if test="$browserows = 'recurse'">
+        <xsl:apply-templates select="following-sibling::row[1]">
+          <xsl:with-param name="spans">
+            <xsl:call-template name="consume-row">
+              <xsl:with-param name="spans" select="$spans"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="browserows" select="$browserows"/>
+        </xsl:apply-templates>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="normal-row">
+  <xsl:param name="spans"/>
+  <xsl:param name="browserows"/>
+
+  <xsl:variable name="row-height">
+    <xsl:if test="processing-instruction('dbhtml')">
+      <xsl:call-template name="pi.dbhtml_row-height"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="bgcolor">
+    <xsl:if test="processing-instruction('dbhtml')">
+      <xsl:call-template name="pi.dbhtml_bgcolor"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="class">
+    <xsl:if test="processing-instruction('dbhtml')">
+      <xsl:call-template name="pi.dbhtml_class"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <tr>
+    <xsl:call-template name="id.attribute"/>
+    <xsl:call-template name="tr.attributes">
+      <xsl:with-param name="rownum">
+        <xsl:number from="tgroup" count="row"/>
+      </xsl:with-param>
+    </xsl:call-template>
+
+    <xsl:if test="$row-height != ''">
+      <xsl:attribute name="height">
+        <xsl:value-of select="$row-height"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:if test="$bgcolor != ''">
+      <xsl:attribute name="bgcolor">
+        <xsl:value-of select="$bgcolor"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:if test="$class != ''">
+      <xsl:attribute name="class">
+        <xsl:value-of select="$class"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:if test="$table.borders.with.css != 0">
+      <xsl:if test="@rowsep = 1 and following-sibling::row">
+        <xsl:attribute name="style">
+          <xsl:call-template name="border">
+            <xsl:with-param name="side" select="'bottom'"/>
+          </xsl:call-template>
+        </xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="@align">
+      <xsl:attribute name="align">
+        <xsl:value-of select="@align"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@char">
+      <xsl:attribute name="char">
+        <xsl:value-of select="@char"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@charoff">
+      <xsl:attribute name="charoff">
+        <xsl:value-of select="@charoff"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@valign">
+      <xsl:attribute name="valign">
+        <xsl:value-of select="@valign"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:apply-templates select="(entry|entrytbl)[1]">
+      <xsl:with-param name="spans" select="$spans"/>
+    </xsl:apply-templates>
+  </tr>
+
+  <xsl:if test="$browserows = 'recurse'">
+    <xsl:if test="following-sibling::row">
+      <xsl:variable name="nextspans">
+        <xsl:apply-templates select="(entry|entrytbl)[1]" mode="span">
+          <xsl:with-param name="spans" select="$spans"/>
+        </xsl:apply-templates>
+      </xsl:variable>
+  
+      <xsl:apply-templates select="following-sibling::row[1]">
+        <xsl:with-param name="spans" select="$nextspans"/>
+        <xsl:with-param name="browserows" select="$browserows"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="entry|entrytbl" name="entry">
+  <xsl:param name="col">
+    <xsl:choose>
+      <xsl:when test="@revisionflag">
+        <xsl:number from="row"/>
+      </xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:param>
+
+  <xsl:param name="spans"/>
+
+  <xsl:variable name="empty.cell" select="count(node()) = 0"/>
+
+  <xsl:variable name="named.colnum">
+    <xsl:call-template name="entry.colnum"/>
+  </xsl:variable>
+
+  <xsl:variable name="entry.colnum">
+    <xsl:choose>
+      <xsl:when test="$named.colnum &gt; 0">
+        <xsl:value-of select="$named.colnum"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$col"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="entry.colspan">
+    <xsl:choose>
+      <xsl:when test="@spanname or @namest">
+        <xsl:call-template name="calculate.colspan"/>
+      </xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="following.spans">
+    <xsl:call-template name="calculate.following.spans">
+      <xsl:with-param name="colspan" select="$entry.colspan"/>
+      <xsl:with-param name="spans" select="$spans"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="cellgi">
+    <xsl:choose>
+      <xsl:when test="ancestor::thead">th</xsl:when>
+      <xsl:when test="ancestor::tfoot">th</xsl:when>
+      <xsl:when test="ancestor::tbody and 
+                      (ancestor::table[@rowheader = 'firstcol'] or
+                      ancestor::informaltable[@rowheader = 'firstcol']) and
+                      $entry.colnum = 1">
+        <xsl:text>th</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>td</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="rowsep">
+    <xsl:choose>
+      <!-- If this is the last row, rowsep never applies. -->
+      <xsl:when test="ancestor::entrytbl
+                      and not (ancestor-or-self::row[1]/following-sibling::row)
+                      and not (ancestor::thead)">
+        <xsl:value-of select="0"/>
+      </xsl:when>
+      <xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row
+                          or ancestor-or-self::thead/following-sibling::tbody
+                          or ancestor-or-self::tbody/preceding-sibling::tfoot)">
+        <xsl:value-of select="0"/>
+      </xsl:when>
+      <!-- not last row with @morerows (thead is not last row) -->
+      <xsl:when test="not(ancestor::thead) and @morerows and not(@morerows &lt; 
+                 count(ancestor-or-self::row[1]/following-sibling::row))">
+        <xsl:value-of select="0"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="."/>
+          <xsl:with-param name="colnum" select="$entry.colnum"/>
+          <xsl:with-param name="attribute" select="'rowsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="colsep">
+    <xsl:choose>
+      <!-- If this is the last column, colsep never applies. -->
+      <xsl:when test="$following.spans = ''">0</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="."/>
+          <xsl:with-param name="colnum" select="$entry.colnum"/>
+          <xsl:with-param name="attribute" select="'colsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="valign">
+    <xsl:call-template name="inherited.table.attribute">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+      <xsl:with-param name="attribute" select="'valign'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="align">
+    <xsl:call-template name="inherited.table.attribute">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+      <xsl:with-param name="attribute" select="'align'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="char">
+    <xsl:call-template name="inherited.table.attribute">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+      <xsl:with-param name="attribute" select="'char'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="charoff">
+    <xsl:call-template name="inherited.table.attribute">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+      <xsl:with-param name="attribute" select="'charoff'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
+      <xsl:call-template name="entry">
+        <xsl:with-param name="col" select="$col+1"/>
+        <xsl:with-param name="spans" select="substring-after($spans,':')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="number($entry.colnum) &gt; $col">
+      <xsl:call-template name="empty.table.cell"/>
+      <xsl:call-template name="entry">
+        <xsl:with-param name="col" select="$col+1"/>
+        <xsl:with-param name="spans" select="substring-after($spans,':')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:variable name="bgcolor">
+        <xsl:if test="processing-instruction('dbhtml')">
+          <xsl:call-template name="pi.dbhtml_bgcolor"/>
+        </xsl:if>
+      </xsl:variable>
+
+      <xsl:element name="{$cellgi}">
+        <xsl:call-template name="id.attribute"/>
+        <xsl:if test="$bgcolor != ''">
+          <xsl:attribute name="bgcolor">
+            <xsl:value-of select="$bgcolor"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:call-template name="locale.html.attributes"/>
+        <xsl:choose>
+          <xsl:when test="$entry.propagates.style != 0 and @role">
+            <xsl:apply-templates select="." mode="class.attribute">
+              <xsl:with-param name="class" select="@role"/>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="." mode="class.attribute">
+              <xsl:with-param name="class" select="''"/>
+            </xsl:apply-templates>
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:if test="$show.revisionflag and @revisionflag">
+          <xsl:attribute name="class">
+            <xsl:value-of select="@revisionflag"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="$table.borders.with.css != 0">
+          <xsl:attribute name="style">
+            <xsl:if test="$colsep &gt; 0">
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'right'"/>
+              </xsl:call-template>
+            </xsl:if>
+            <xsl:if test="$rowsep &gt; 0">
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'bottom'"/>
+              </xsl:call-template>
+            </xsl:if>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="@morerows &gt; 0">
+          <xsl:attribute name="rowspan">
+            <xsl:value-of select="1+@morerows"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="$entry.colspan &gt; 1">
+          <xsl:attribute name="colspan">
+            <xsl:value-of select="$entry.colspan"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="$align != ''">
+          <xsl:attribute name="align">
+            <xsl:value-of select="$align"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="$valign != ''">
+          <xsl:attribute name="valign">
+            <xsl:value-of select="$valign"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="$char != ''">
+          <xsl:attribute name="char">
+            <xsl:value-of select="$char"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="$charoff != ''">
+          <xsl:attribute name="charoff">
+            <xsl:value-of select="$charoff"/>
+          </xsl:attribute>
+        </xsl:if>
+
+        <xsl:if test="not(preceding-sibling::*) and 
+                    (ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
+          <xsl:call-template name="anchor">
+            <xsl:with-param name="node" select="ancestor::row[1]"/>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:call-template name="anchor"/>
+
+        <xsl:choose>
+          <xsl:when test="$empty.cell">
+            <xsl:text>&#160;</xsl:text>
+          </xsl:when>
+          <xsl:when test="self::entrytbl">
+            <xsl:call-template name="tgroup"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:element>
+
+      <xsl:choose>
+        <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
+          <xsl:apply-templates select="(following-sibling::entry
+                                       |following-sibling::entrytbl)[1]">
+            <xsl:with-param name="col" select="$col+$entry.colspan"/>
+            <xsl:with-param name="spans" select="$following.spans"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="finaltd">
+            <xsl:with-param name="spans" select="$following.spans"/>
+            <xsl:with-param name="col" select="$col+$entry.colspan"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="entry|entrytbl" name="sentry" mode="span">
+  <xsl:param name="col" select="1"/>
+  <xsl:param name="spans"/>
+
+  <xsl:variable name="entry.colnum">
+    <xsl:call-template name="entry.colnum"/>
+  </xsl:variable>
+
+  <xsl:variable name="entry.colspan">
+    <xsl:choose>
+      <xsl:when test="@spanname or @namest">
+        <xsl:call-template name="calculate.colspan"/>
+      </xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="following.spans">
+    <xsl:call-template name="calculate.following.spans">
+      <xsl:with-param name="colspan" select="$entry.colspan"/>
+      <xsl:with-param name="spans" select="$spans"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
+      <xsl:value-of select="substring-before($spans,':')-1"/>
+      <xsl:text>:</xsl:text>
+      <xsl:call-template name="sentry">
+        <xsl:with-param name="col" select="$col+1"/>
+        <xsl:with-param name="spans" select="substring-after($spans,':')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="number($entry.colnum) &gt; $col">
+      <xsl:text>0:</xsl:text>
+      <xsl:call-template name="sentry">
+        <xsl:with-param name="col" select="$col + 1"/>
+        <xsl:with-param name="spans" select="substring-after($spans,':')"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:call-template name="copy-string">
+        <xsl:with-param name="count" select="$entry.colspan"/>
+        <xsl:with-param name="string">
+          <xsl:choose>
+            <xsl:when test="@morerows">
+              <xsl:value-of select="@morerows"/>
+            </xsl:when>
+            <xsl:otherwise>0</xsl:otherwise>
+          </xsl:choose>
+          <xsl:text>:</xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+
+      <xsl:choose>
+        <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
+          <xsl:apply-templates select="(following-sibling::entry
+                                        |following-sibling::entrytbl)[1]"
+                               mode="span">
+            <xsl:with-param name="col" select="$col+$entry.colspan"/>
+            <xsl:with-param name="spans" select="$following.spans"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="sfinaltd">
+            <xsl:with-param name="spans" select="$following.spans"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="generate.colgroup">
+  <xsl:param name="cols" select="1"/>
+  <xsl:param name="count" select="1"/>
+  <xsl:choose>
+    <xsl:when test="$count &gt; $cols"></xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="generate.col">
+        <xsl:with-param name="countcol" select="$count"/>
+      </xsl:call-template>
+      <xsl:call-template name="generate.colgroup">
+        <xsl:with-param name="cols" select="$cols"/>
+        <xsl:with-param name="count" select="$count+1"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="generate.col">
+  <xsl:param name="countcol">1</xsl:param>
+  <xsl:param name="colspecs" select="./colspec"/>
+  <xsl:param name="count">1</xsl:param>
+  <xsl:param name="colnum">1</xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$count>count($colspecs)">
+      <col/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
+      <xsl:variable name="colspec.colnum">
+        <xsl:choose>
+          <xsl:when test="$colspec/@colnum">
+            <xsl:value-of select="$colspec/@colnum"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$colnum"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+        <xsl:when test="$colspec.colnum=$countcol">
+          <col>
+            <xsl:choose>
+              <xsl:when test="$colspec/@colwidth
+                            and $use.extensions != 0
+                            and $tablecolumns.extension != 0">
+                <xsl:attribute name="width">
+                  <xsl:choose>
+                    <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
+                      <xsl:value-of select="'1*'"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <xsl:value-of select="$colspec/@colwidth"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+              </xsl:when>
+              <!-- pass through to HTML if no * in colspecs -->
+              <xsl:when test="$colspec/@colwidth and
+                             not($colspec/parent::*/colspec/@colwidth[contains(.,'*')])">
+                <xsl:attribute name="width">
+                  <xsl:choose>
+                    <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
+                      <xsl:value-of select="'1*'"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <xsl:value-of select="$colspec/@colwidth"/>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:attribute>
+              </xsl:when>
+            </xsl:choose>
+
+            <xsl:choose>
+              <xsl:when test="$colspec/@align">
+                <xsl:attribute name="align">
+                  <xsl:value-of select="$colspec/@align"/>
+                </xsl:attribute>
+              </xsl:when>
+              <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
+              <xsl:when test="$colspecs/ancestor::tgroup/@align">
+                <xsl:attribute name="align">
+                  <xsl:value-of select="$colspecs/ancestor::tgroup/@align"/>
+                </xsl:attribute>
+              </xsl:when>
+            </xsl:choose>
+
+            <xsl:if test="$colspec/@char">
+              <xsl:attribute name="char">
+                <xsl:value-of select="$colspec/@char"/>
+              </xsl:attribute>
+            </xsl:if>
+            
+            <xsl:if test="$colspec/@charoff">
+              <xsl:attribute name="charoff">
+                <xsl:value-of select="$colspec/@charoff"/>
+              </xsl:attribute>
+            </xsl:if>
+
+            <xsl:if test="$colspec/@colname">
+              <xsl:attribute name="class">
+                <xsl:value-of select="$colspec/@colname"/>
+              </xsl:attribute>
+            </xsl:if>
+          </col>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="generate.col">
+            <xsl:with-param name="countcol" select="$countcol"/>
+            <xsl:with-param name="colspecs" select="$colspecs"/>
+            <xsl:with-param name="count" select="$count+1"/>
+            <xsl:with-param name="colnum">
+              <xsl:choose>
+                <xsl:when test="$colspec/@colnum">
+                  <xsl:value-of select="$colspec/@colnum + 1"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="$colnum + 1"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+           </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="colspec.colwidth">
+  <!-- when this macro is called, the current context must be an entry -->
+  <xsl:param name="colname"></xsl:param>
+  <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
+  <xsl:param name="colspecs" select="../../../../tgroup/colspec"/>
+  <xsl:param name="count">1</xsl:param>
+  <xsl:choose>
+    <xsl:when test="$count>count($colspecs)"></xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
+      <xsl:choose>
+        <xsl:when test="$colspec/@colname=$colname">
+          <xsl:value-of select="$colspec/@colwidth"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="colspec.colwidth">
+            <xsl:with-param name="colname" select="$colname"/>
+            <xsl:with-param name="colspecs" select="$colspecs"/>
+            <xsl:with-param name="count" select="$count+1"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ====================================================================== -->
+
+<xsl:template name="tr.attributes">
+  <xsl:param name="row" select="."/>
+  <xsl:param name="rownum" select="0"/>
+
+  <!-- by default, do nothing. But you might want to say:
+
+  <xsl:if test="$rownum mod 2 = 0">
+    <xsl:attribute name="class">oddrow</xsl:attribute>
+  </xsl:if>
+
+  -->
+</xsl:template>
+
+</xsl:stylesheet>
+
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/lib/dumpfragment.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/lib/dumpfragment.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/lib/dumpfragment.xsl	(revision 119)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<xsl:stylesheet version="1.0"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://www.w3.org/1999/xhtml"
+                exclude-result-prefixes="exsl">
+
+<xsl:template name="dump-fragment">
+  <xsl:param name="fragment"/>
+  <xsl:apply-templates select="exsl:node-set($fragment)/*" mode="dump-fragment"/>
+</xsl:template>
+
+<xsl:template match="@*" mode="dump-fragment">
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="local-name(.)"/>
+  <xsl:text>="</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>"</xsl:text>
+</xsl:template>
+
+<xsl:template match="*" mode="dump-fragment">
+  <xsl:text>&lt;</xsl:text><xsl:value-of select="local-name(.)"/>
+  <xsl:apply-templates select="@*" mode="dump-fragment"/>
+  <xsl:text>></xsl:text>
+  <xsl:apply-templates mode="dump-fragment"/>
+  <xsl:text>&lt;/</xsl:text><xsl:value-of select="local-name(.)"/>
+  <xsl:text>></xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/lib/lib.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/lib/lib.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/lib/lib.xsl	(revision 119)
@@ -0,0 +1,537 @@
+<?xml version="1.0"?>
+<!-- ********************************************************************
+     $Id: lib.xweb 9040 2011-08-19 21:51:47Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     This module implements DTD-independent functions
+
+     ******************************************************************** -->
+<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 -->
+  <xsl:param name="string"/>
+  <xsl:param name="count" select="0"/>
+  <xsl:choose>
+    <xsl:when test="contains($string, '.')">
+      <xsl:call-template name="dot.count">
+        <xsl:with-param name="string" select="substring-after($string, '.')"/>
+        <xsl:with-param name="count" select="$count+1"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$count"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="copy-string">
+  <!-- returns 'count' copies of 'string' -->
+  <xsl:param name="string"/>
+  <xsl:param name="count" select="0"/>
+  <xsl:param name="result"/>
+
+  <xsl:choose>
+    <xsl:when test="$count&gt;0">
+      <xsl:call-template name="copy-string">
+        <xsl:with-param name="string" select="$string"/>
+        <xsl:with-param name="count" select="$count - 1"/>
+        <xsl:with-param name="result">
+          <xsl:value-of select="$result"/>
+          <xsl:value-of select="$string"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$result"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="string.subst">
+  <xsl:param name="string"/>
+  <xsl:param name="target"/>
+  <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">
+          <xsl:with-param name="string" select="substring-after($string, $target)"/>
+          <xsl:with-param name="target" select="$target"/>
+          <xsl:with-param name="replacement" select="$replacement"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:value-of select="concat(substring-before($string, $target),                                    $replacement,                                    $rest)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$string"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="xpointer.idref">
+  <xsl:param name="xpointer">http://...</xsl:param>
+  <xsl:choose>
+    <xsl:when test="starts-with($xpointer, '#xpointer(id(')">
+      <xsl:variable name="rest" select="substring-after($xpointer, '#xpointer(id(')"/>
+      <xsl:variable name="quote" select="substring($rest, 1, 1)"/>
+      <xsl:value-of select="substring-before(substring-after($xpointer, $quote), $quote)"/>
+    </xsl:when>
+    <xsl:when test="starts-with($xpointer, '#')">
+      <xsl:value-of select="substring-after($xpointer, '#')"/>
+    </xsl:when>
+    <!-- otherwise it's a pointer to some other document -->
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="length-magnitude">
+  <xsl:param name="length" select="'0pt'"/>
+
+  <xsl:choose>
+    <xsl:when test="string-length($length) = 0"/>
+    <xsl:when test="substring($length,1,1) = '0'                     or substring($length,1,1) = '1'                     or substring($length,1,1) = '2'                     or substring($length,1,1) = '3'                     or substring($length,1,1) = '4'                     or substring($length,1,1) = '5'                     or substring($length,1,1) = '6'                     or substring($length,1,1) = '7'                     or substring($length,1,1) = '8'                     or substring($length,1,1) = '9'                     or substring($length,1,1) = '.'">
+      <xsl:value-of select="substring($length,1,1)"/>
+      <xsl:call-template name="length-magnitude">
+        <xsl:with-param name="length" select="substring($length,2)"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="length-units">
+  <xsl:param name="length" select="'0pt'"/>
+  <xsl:param name="default.units" select="'px'"/>
+  <xsl:variable name="magnitude">
+    <xsl:call-template name="length-magnitude">
+      <xsl:with-param name="length" select="$length"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="units">
+    <xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$units = ''">
+      <xsl:value-of select="$default.units"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$units"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="length-spec">
+  <xsl:param name="length" select="'0pt'"/>
+  <xsl:param name="default.units" select="'px'"/>
+
+  <xsl:variable name="magnitude">
+    <xsl:call-template name="length-magnitude">
+      <xsl:with-param name="length" select="$length"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="units">
+    <xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
+  </xsl:variable>
+
+  <xsl:value-of select="$magnitude"/>
+  <xsl:choose>
+    <xsl:when test="$units='cm'                     or $units='mm'                     or $units='in'                     or $units='pt'                     or $units='pc'                     or $units='px'                     or $units='em'">
+      <xsl:value-of select="$units"/>
+    </xsl:when>
+    <xsl:when test="$units = ''">
+      <xsl:value-of select="$default.units"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>
+        <xsl:text>Unrecognized unit of measure: </xsl:text>
+        <xsl:value-of select="$units"/>
+        <xsl:text>.</xsl:text>
+      </xsl:message>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="length-in-points">
+  <xsl:param name="length" select="'0pt'"/>
+  <xsl:param name="em.size" select="10"/>
+  <xsl:param name="pixels.per.inch" select="90"/>
+
+  <xsl:variable name="magnitude">
+    <xsl:call-template name="length-magnitude">
+      <xsl:with-param name="length" select="$length"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="units">
+    <xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$units = 'pt'">
+      <xsl:value-of select="$magnitude"/>
+    </xsl:when>
+    <xsl:when test="$units = 'cm'">
+      <xsl:value-of select="$magnitude div 2.54 * 72.0"/>
+    </xsl:when>
+    <xsl:when test="$units = 'mm'">
+      <xsl:value-of select="$magnitude div 25.4 * 72.0"/>
+    </xsl:when>
+    <xsl:when test="$units = 'in'">
+      <xsl:value-of select="$magnitude * 72.0"/>
+    </xsl:when>
+    <xsl:when test="$units = 'pc'">
+      <xsl:value-of select="$magnitude * 12.0"/>
+    </xsl:when>
+    <xsl:when test="$units = 'px'">
+      <xsl:value-of select="$magnitude div $pixels.per.inch * 72.0"/>
+    </xsl:when>
+    <xsl:when test="$units = 'em'">
+      <xsl:value-of select="$magnitude * $em.size"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>
+        <xsl:text>Unrecognized unit of measure: </xsl:text>
+        <xsl:value-of select="$units"/>
+        <xsl:text>.</xsl:text>
+      </xsl:message>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="pi-attribute">
+  <xsl:param name="pis" select="processing-instruction('BOGUS_PI')"/>
+  <xsl:param name="attribute">filename</xsl:param>
+  <xsl:param name="count">1</xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$count&gt;count($pis)">
+      <!-- not found -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="pi">
+        <xsl:value-of select="$pis[$count]"/>
+      </xsl:variable>
+      <xsl:variable name="pivalue">
+        <xsl:value-of select="concat(' ', normalize-space($pi))"/>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="contains($pivalue,concat(' ', $attribute, '='))">
+          <xsl:variable name="rest" select="substring-after($pivalue,concat(' ', $attribute,'='))"/>
+          <xsl:variable name="quote" select="substring($rest,1,1)"/>
+          <xsl:value-of select="substring-before(substring($rest,2),$quote)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="pi-attribute">
+            <xsl:with-param name="pis" select="$pis"/>
+            <xsl:with-param name="attribute" select="$attribute"/>
+            <xsl:with-param name="count" select="$count + 1"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="lookup.key">
+  <xsl:param name="key" select="''"/>
+  <xsl:param name="table" select="''"/>
+
+  <xsl:if test="contains($table, ' ')">
+    <xsl:choose>
+      <xsl:when test="substring-before($table, ' ') = $key">
+        <xsl:variable name="rest" select="substring-after($table, ' ')"/>
+        <xsl:choose>
+          <xsl:when test="contains($rest, ' ')">
+            <xsl:value-of select="substring-before($rest, ' ')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$rest"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="lookup.key">
+          <xsl:with-param name="key" select="$key"/>
+          <xsl:with-param name="table" select="substring-after(substring-after($table,' '), ' ')"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:template>
+<xsl:template name="xpath.location">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="path" select="''"/>
+
+  <xsl:variable name="next.path">
+    <xsl:value-of select="local-name($node)"/>
+    <xsl:if test="$path != ''">/</xsl:if>
+    <xsl:value-of select="$path"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$node/parent::*">
+      <xsl:call-template name="xpath.location">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+        <xsl:with-param name="path" select="$next.path"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>/</xsl:text>
+      <xsl:value-of select="$next.path"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="comment-escape-string">
+  <xsl:param name="string" select="''"/>
+
+  <xsl:if test="starts-with($string, '-')">
+    <xsl:text> </xsl:text>
+  </xsl:if>
+
+  <xsl:call-template name="comment-escape-string.recursive">
+    <xsl:with-param name="string" select="$string"/>
+  </xsl:call-template>
+
+  <xsl:if test="substring($string, string-length($string), 1) = '-'">
+    <xsl:text> </xsl:text>
+  </xsl:if>
+</xsl:template>
+<xsl:template name="comment-escape-string.recursive">
+  <xsl:param name="string" select="''"/>
+  <xsl:choose>
+    <xsl:when test="contains($string, '--')">
+      <xsl:value-of select="substring-before($string, '--')"/>
+      <xsl:value-of select="'- -'"/>
+      <xsl:call-template name="comment-escape-string.recursive">
+        <xsl:with-param name="string" select="substring-after($string, '--')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$string"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+  <xsl:template name="str.tokenize.keep.delimiters">
+    <xsl:param name="string" select="''"/>
+    <xsl:param name="delimiters" select="' '"/>
+    <xsl:choose>
+      <xsl:when test="not($string)"/>
+      <xsl:when test="not($delimiters)">
+        <xsl:call-template name="str.tokenize.keep.delimiters-characters">
+          <xsl:with-param name="string" select="$string"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
+          <xsl:with-param name="string" select="$string"/>
+          <xsl:with-param name="delimiters" select="$delimiters"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template name="str.tokenize.keep.delimiters-characters">
+    <xsl:param name="string"/>
+    <xsl:if test="$string">
+      <ssb:token xmlns:ssb="http://sideshowbarker.net/ns"><xsl:value-of select="substring($string, 1, 1)"/></ssb:token>
+      <xsl:call-template name="str.tokenize.keep.delimiters-characters">
+        <xsl:with-param name="string" select="substring($string, 2)"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template name="str.tokenize.keep.delimiters-delimiters">
+    <xsl:param name="string"/>
+    <xsl:param name="delimiters"/>
+    <xsl:variable name="delimiter" select="substring($delimiters, 1, 1)"/>
+    <xsl:choose>
+      <xsl:when test="not($delimiter)">
+        <ssb:token xmlns:ssb="http://sideshowbarker.net/ns"><xsl:value-of select="$string"/></ssb:token>
+      </xsl:when>
+      <xsl:when test="contains($string, $delimiter)">
+        <xsl:if test="not(starts-with($string, $delimiter))">
+          <xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
+            <xsl:with-param name="string" select="substring-before($string, $delimiter)"/>
+            <xsl:with-param name="delimiters" select="substring($delimiters, 2)"/>
+          </xsl:call-template>
+        </xsl:if>
+        <!-- output each delimiter -->
+        <xsl:value-of select="$delimiter"/>
+        <xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
+          <xsl:with-param name="string" select="substring-after($string, $delimiter)"/>
+          <xsl:with-param name="delimiters" select="$delimiters"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
+          <xsl:with-param name="string" select="$string"/>
+          <xsl:with-param name="delimiters" select="substring($delimiters, 2)"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+    <xsl:template name="apply-string-subst-map">
+      <xsl:param name="content"/>
+      <xsl:param name="map.contents"/>
+      <xsl:variable name="replaced_text">
+        <xsl:call-template name="string.subst">
+          <xsl:with-param name="string" select="$content"/>
+          <xsl:with-param name="target" select="$map.contents[1]/@oldstring"/>
+          <xsl:with-param name="replacement" select="$map.contents[1]/@newstring"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$map.contents[2]">
+          <xsl:call-template name="apply-string-subst-map">
+            <xsl:with-param name="content" select="$replaced_text"/>
+            <xsl:with-param name="map.contents" select="$map.contents[position() &gt; 1]"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$replaced_text"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+  
+<xsl:template name="count.uri.path.depth">
+  <xsl:param name="filename" select="''"/>
+  <xsl:param name="count" select="0"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($filename, '/')">
+      <xsl:call-template name="count.uri.path.depth">
+        <xsl:with-param name="filename" select="substring-after($filename, '/')"/>
+        <xsl:with-param name="count" select="$count + 1"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$count"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="trim.common.uri.paths">
+  <xsl:param name="uriA" select="''"/>
+  <xsl:param name="uriB" select="''"/>
+  <xsl:param name="return" select="'A'"/>
+
+  <!-- Resolve any ../ in the path -->
+  <xsl:variable name="trimmed.uriA">
+    <xsl:call-template name="resolve.path">
+      <xsl:with-param name="filename" select="$uriA"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="trimmed.uriB">
+    <xsl:call-template name="resolve.path">
+      <xsl:with-param name="filename" select="$uriB"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="contains($trimmed.uriA, '/') and contains($trimmed.uriB, '/')                     and substring-before($trimmed.uriA, '/') = substring-before($trimmed.uriB, '/')">
+      <xsl:call-template name="trim.common.uri.paths">
+        <xsl:with-param name="uriA" select="substring-after($trimmed.uriA, '/')"/>
+        <xsl:with-param name="uriB" select="substring-after($trimmed.uriB, '/')"/>
+        <xsl:with-param name="return" select="$return"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$return = 'A'">
+          <xsl:value-of select="$trimmed.uriA"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$trimmed.uriB"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+<xsl:template name="resolve.path">
+  <xsl:param name="filename" select="''"/>
+  <xsl:choose>
+    <!-- Leading .. are not eliminated -->
+    <xsl:when test="starts-with($filename, '../')">
+      <xsl:value-of select="'../'"/>
+      <xsl:call-template name="resolve.path">
+        <xsl:with-param name="filename" select="substring-after($filename, '../')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="contains($filename, '/../')">
+      <xsl:call-template name="resolve.path">
+        <xsl:with-param name="filename">
+          <xsl:call-template name="dirname">
+            <xsl:with-param name="filename" select="substring-before($filename, '/../')"/>
+          </xsl:call-template>
+          <xsl:value-of select="substring-after($filename, '/../')"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$filename"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="dirname">
+  <xsl:param name="filename" select="''"/>
+  <xsl:if test="contains($filename, '/')">
+    <xsl:value-of select="substring-before($filename, '/')"/>
+    <xsl:text>/</xsl:text>
+    <xsl:call-template name="dirname">
+      <xsl:with-param name="filename" select="substring-after($filename, '/')"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+
+  <xsl:template name="trim.text">
+    <xsl:param name="contents" select="."/>
+    <xsl:variable name="contents-left-trimmed">
+      <xsl:call-template name="trim-left">
+        <xsl:with-param name="contents" select="$contents"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="contents-trimmed">
+      <xsl:call-template name="trim-right">
+        <xsl:with-param name="contents" select="$contents-left-trimmed"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:value-of select="$contents-trimmed"/>
+  </xsl:template>
+
+  <xsl:template name="trim-left">
+    <xsl:param name="contents"/>
+    <xsl:choose>
+      <xsl:when test="starts-with($contents,'&#10;') or                       starts-with($contents,'&#13;') or                       starts-with($contents,' ') or                       starts-with($contents,'&#9;')">
+        <xsl:call-template name="trim-left">
+          <xsl:with-param name="contents" select="substring($contents, 2)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$contents"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="trim-right">
+    <xsl:param name="contents"/>
+    <xsl:variable name="last-char">
+      <xsl:value-of select="substring($contents, string-length($contents), 1)"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="($last-char = '&#10;') or                       ($last-char = '&#13;') or                       ($last-char = ' ') or                       ($last-char = '&#9;')">
+        <xsl:call-template name="trim-right">
+          <xsl:with-param name="contents" select="substring($contents, 1, string-length($contents) - 1)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$contents"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
+
Index: docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/manpages/other.xsl
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/manpages/other.xsl	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/docbook-xsl-1.79.1-new/manpages/other.xsl	(revision 119)
@@ -0,0 +1,871 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:ng="http://docbook.org/docbook-ng"
+                xmlns:db="http://docbook.org/ns/docbook"
+                xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
+                exclude-result-prefixes="exsl"
+                version='1.0'>
+
+<!-- ********************************************************************
+     $Id: other.xsl 9950 2014-11-20 22:30:41Z bobstayton $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- * This file contains named templates related to things other than -->
+<!-- * just assembling the actual text of the main text flow of each man -->
+<!-- * page. This "other" stuff currently amounts to these steps: -->
+<!-- * -->
+<!-- *  - get contents of the "map" used to convert special characters -->
+<!-- *  - output boilerplate messages -->
+<!-- *  - escape backslash, dot, dash, and apostrophe characters -->
+<!-- *  - convert non-breaking spaces -->
+<!-- *  - add a comment to top part of roff source of each page -->
+<!-- *  - make a .TH title line (for controlling page header/footer) -->
+<!-- *  - set hyphenation, alignment, indent & line-breaking defaults -->
+<!-- *  - "prepare" the complete man page contents for final output -->
+<!-- *  - write the actual man file to the filesystem -->
+<!-- *  - write any "stub" pages to the filesystem -->
+<!-- * -->
+<!-- * The templates in this file are actually called only once per -->
+<!-- * each Refentry; they are just in a separate file for the purpose -->
+<!-- * of keeping things modular. -->
+
+<!-- ==================================================================== -->
+
+<!-- ==================================================================== -->
+<!-- * Get character map contents -->
+<!-- ==================================================================== -->
+
+  <xsl:variable name="man.charmap.contents">
+    <xsl:if test="$man.charmap.enabled != 0">
+      <xsl:variable name="lang">
+        <xsl:call-template name="l10n.language">
+          <xsl:with-param name="target" select="//refentry[1]"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:call-template name="read-character-map">
+        <xsl:with-param name="use.subset" select="$man.charmap.use.subset"/>
+        <xsl:with-param name="subset.profile">
+          <xsl:choose>
+            <xsl:when test="$lang = 'en'">
+              <xsl:value-of select="$man.charmap.subset.profile.english"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$man.charmap.subset.profile"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+        <xsl:with-param name="uri">
+          <xsl:choose>
+            <xsl:when test="$man.charmap.uri != ''">
+              <xsl:value-of select="$man.charmap.uri"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="'../manpages/charmap.groff.xsl'"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="root.messages">
+  <xsl:param name="refname"/>
+  <!-- redefine this any way you'd like to output messages -->
+  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
+  <!-- Example:
+  <xsl:if test="//foo">
+    <xsl:call-template name="log.message">
+      <xsl:with-param name="level">Warn</xsl:with-param>
+      <xsl:with-param name="source" select="$refname"/>
+      <xsl:with-param name="context-desc">
+        <xsl:text>limitation</xsl:text>
+      </xsl:with-param>
+      <xsl:with-param name="message">
+        <xsl:text>Output for foo element is not yet supported.</xsl:text>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:if>
+  -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+<!-- * Escape roff special chars -->
+<!-- ==================================================================== -->
+
+<!-- ******************************************************************** -->
+<!-- *  -->
+<!-- * The backslash, dot, dash, and apostrophe (\, ., -, ') characters -->
+<!-- * have special meaning for roff, so before we do any other -->
+<!-- * processing, we must escape those characters where they appear in -->
+<!-- * the source content. -->
+<!-- *  -->
+<!-- * Here we also deal with replacing U+00a0 (non-breaking space) with -->
+<!-- * its roff equivalent -->
+<!-- *  -->
+<!-- ******************************************************************** -->
+
+<xsl:template match="//refentry//text()">
+  <xsl:call-template name="escape.roff.specials">
+    <xsl:with-param name="content">
+      <xsl:value-of select="."/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="//refentry//text()" mode="no.anchor.mode">
+  <xsl:call-template name="escape.roff.specials">
+    <xsl:with-param name="content">
+      <xsl:value-of select="."/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="escape.roff.specials">
+  <xsl:param name="content"/>
+  <xsl:call-template name="convert.nobreak-space">
+    <xsl:with-param name="content">
+      <xsl:call-template name="escape.apostrophe">
+        <xsl:with-param name="content">
+          <xsl:call-template name="escape.dash">
+            <xsl:with-param name="content">
+              <xsl:call-template name="escape.dot">
+                <xsl:with-param name="content">
+                  <xsl:call-template name="escape.backslash">
+                    <xsl:with-param name="content" select="$content"/>
+                  </xsl:call-template>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="escape.backslash">
+  <xsl:param name="content"/>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="$content"/>
+    <xsl:with-param name="target">\</xsl:with-param>
+    <!-- * we use "\e" instead of "\\" because the groff docs say -->
+    <!-- * that's the correct thing to do; also because testing -->
+    <!-- * shows that "\\" doesn't always work as expected; for -->
+    <!-- * example, "\\" within a table seems to mess things up -->
+    <xsl:with-param name="replacement">\e</xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="escape.dot">
+  <xsl:param name="content"/>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="$content"/>
+    <xsl:with-param name="target">.</xsl:with-param>
+    <xsl:with-param name="replacement">\&amp;.</xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="escape.dash">
+  <xsl:param name="content"/>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="$content"/>
+    <xsl:with-param name="target">-</xsl:with-param>
+    <xsl:with-param name="replacement">\-</xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="escape.apostrophe">
+  <xsl:param name="content"/>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="$content"/>
+    <xsl:with-param name="target">'</xsl:with-param>
+    <xsl:with-param name="replacement">\*(Aq</xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="convert.nobreak-space">
+  <xsl:param name="content"/>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="$content"/>
+    <xsl:with-param name="target">&#x00a0;</xsl:with-param>
+    <!-- * A no-break space can be written two ways in roff; the -->
+    <!-- * difference, according to the "Page Motions" node in the -->
+    <!-- * groff info page, is: -->
+    <!-- *  -->
+    <!-- *   "\ " = -->
+    <!-- *   An unbreakable and unpaddable (i.e. not expanded -->
+    <!-- *   during filling) space. -->
+    <!-- *  -->
+    <!-- *   "\~" = -->
+    <!-- *   An unbreakable space that stretches like a normal -->
+    <!-- *   inter-word space when a line is adjusted."  -->
+    <!-- *  -->
+    <!-- * Unfortunately, roff seems to do some weird things with -->
+    <!-- * long lines that only have words separated by "\~" -->
+    <!-- * spaces, so it's safer just to stick with the "\ " space -->
+    <!-- *  -->
+    <!-- * We append a "\&" to handle the case of a no-break space that -->
+    <!-- * appears at the end of a line - because later processing will -->
+    <!-- * cause that space to get eaten otherwise. -->
+    <xsl:with-param name="replacement">\ \&amp;</xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- * top.comment generates a comment containing metadata for the man -->
+<!-- * page; for example, Author, Generator, and Date information -->
+
+  <xsl:template name="top.comment">
+    <xsl:param name="info"/>
+    <xsl:param name="date"/>
+    <xsl:param name="title"/>
+    <xsl:param name="manual"/>
+    <xsl:param name="source"/>
+    <xsl:param name="refname"/>
+    <xsl:text>.\"     Title: </xsl:text>
+    <xsl:call-template name="replace.dots.and.dashes">
+      <xsl:with-param name="content" select="$title"/>
+    </xsl:call-template>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\"    Author: </xsl:text>
+    <xsl:call-template name="replace.dots.and.dashes">
+      <xsl:with-param name="content">
+        <xsl:call-template name="make.roff.metadata.author">
+          <xsl:with-param name="info" select="$info"/>
+          <xsl:with-param name="refname" select="$refname"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\" Generator: DocBook </xsl:text>
+    <xsl:value-of select="$DistroTitle"/>
+    <xsl:text> v</xsl:text>
+    <xsl:call-template name="replace.dots.and.dashes">
+      <xsl:with-param name="content" select="$VERSION"/>
+    </xsl:call-template>
+    <xsl:text> &lt;http://docbook.sf.net/></xsl:text>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\"      Date: </xsl:text>
+    <xsl:call-template name="replace.dots.and.dashes">
+      <xsl:with-param name="content" select="$date"/>
+    </xsl:call-template>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\"    Manual: </xsl:text>
+    <xsl:call-template name="replace.dots.and.dashes">
+      <xsl:with-param name="content" select="$manual"/>
+    </xsl:call-template>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\"    Source: </xsl:text>
+    <xsl:call-template name="replace.dots.and.dashes">
+      <xsl:with-param name="content" select="$source"/>
+    </xsl:call-template>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\"  Language: </xsl:text>
+    <xsl:call-template name="l10n.language.name"/>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.\"</xsl:text>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+<!-- ==================================================================== -->
+
+  <xsl:template name="TH.title.line">
+
+    <!-- * The exact way that .TH contents are displayed is system- -->
+    <!-- * dependent; it varies somewhat between OSes and roff -->
+    <!-- * versions. Below is a description of how Linux systems with -->
+    <!-- * a modern groff seem to render .TH contents. -->
+    <!-- * -->
+    <!-- *   title(section)  extra3  title(section)  <- page header -->
+    <!-- *   extra2          extra1  title(section)  <- page footer-->
+    <!-- * -->
+    <!-- * Or, using the names with which the man(7) man page refers -->
+    <!-- * to the various fields: -->
+    <!-- * -->
+    <!-- *   title(section)  manual  title(section)  <- page header -->
+    <!-- *   source          date    title(section)  <- page footer-->
+    <!-- * -->
+    <!-- * Note that while extra1, extra2, and extra3 are all (nominally) -->
+    <!-- * optional, in practice almost all pages include an "extra1" -->
+    <!-- * field, which is, universally, a date (in some form), and it is -->
+    <!-- * always rendered in the same place (the middle footer position) -->
+    <!-- * -->
+    <!-- * Here are a couple of examples of real-world man pages that -->
+    <!-- * have somewhat useful page headers/footers: -->
+    <!-- * -->
+    <!-- *   gtk-options(7)    GTK+ User's Manual   gtk-options(7) -->
+    <!-- *   GTK+ 1.2              2003-10-20       gtk-options(7) -->
+    <!-- * -->
+    <!-- *   svgalib(7)       Svgalib User Manual       svgalib(7) -->
+    <!-- *   Svgalib 1.4.1      16 December 1999        svgalib(7) -->
+    <!-- * -->
+    <xsl:param name="title"/>
+    <xsl:param name="section"/>
+    <xsl:param name="extra1"/>
+    <xsl:param name="extra2"/>
+    <xsl:param name="extra3"/>
+
+    <xsl:call-template name="mark.subheading"/>
+    <!-- * Note that we generate quotes around _every_ field in the -->
+    <!-- * .TH title line, including the "title" and "section" -->
+    <!-- * fields. That is because we use the contents of those "as -->
+    <!-- * is", unchanged from the DocBook source; and DTD-based -->
+    <!-- * validation does not provide a way to constrain them to be -->
+    <!-- * "space free" -->
+    <xsl:text>.TH "</xsl:text>
+    <xsl:call-template name="string.upper">
+      <xsl:with-param name="string">
+        <xsl:choose>
+          <xsl:when test="$man.th.title.max.length != ''">
+            <xsl:value-of
+                select="normalize-space(substring($title, 1, $man.th.title.max.length))"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="normalize-space($title)"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>" "</xsl:text>
+    <xsl:value-of select="normalize-space($section)"/>
+    <xsl:text>" "</xsl:text>
+    <xsl:if test="$man.th.extra1.suppress = 0">
+      <!-- * there is no max.length for the extra1 field; the reason -->
+      <!-- * is, it is almost always a date, and it is not possible -->
+      <!-- * to truncate dates without changing their meaning -->
+      <xsl:value-of select="normalize-space($extra1)"/>
+    </xsl:if>
+    <xsl:text>" "</xsl:text>
+    <xsl:if test="$man.th.extra2.suppress = 0">
+      <xsl:choose>
+        <!-- * if max.length is non-empty, use value to truncate field -->
+        <xsl:when test="$man.th.extra2.max.length != ''">
+          <xsl:value-of
+              select="normalize-space(substring($extra2, 1, $man.th.extra2.max.length))"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="normalize-space($extra2)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:text>" "</xsl:text>
+    <xsl:if test="$man.th.extra3.suppress = 0">
+      <xsl:choose>
+        <!-- * if max.length is non-empty, use value to truncate field -->
+        <xsl:when test="$man.th.extra3.max.length != ''">
+          <xsl:value-of
+              select="normalize-space(substring($extra3, 1, $man.th.extra3.max.length))"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="normalize-space($extra3)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:text>"&#10;</xsl:text>
+    <xsl:call-template name="mark.subheading"/>
+  </xsl:template>
+
+  <!-- ============================================================== -->
+
+  <xsl:template name="set.default.formatting">
+    <!-- * Set default hyphenation, justification, indentation and -->
+    <!-- * line-breaking -->
+    <!-- * -->
+    <!-- * If the value of man.hypenate is zero (the default), then -->
+    <!-- * disable hyphenation (".nh" = "no hyphenation") -->
+    <xsl:text>.\" -----------------------------------------------------------------&#10;</xsl:text>
+    <xsl:text>.\" * set default formatting&#10;</xsl:text>
+    <xsl:text>.\" -----------------------------------------------------------------&#10;</xsl:text>
+    <xsl:if test="$man.hyphenate = 0">
+      <xsl:text>.\" disable hyphenation&#10;</xsl:text>
+      <xsl:text>.nh&#10;</xsl:text>
+    </xsl:if>
+    <!-- * If the value of man.justify is zero (the default), then -->
+    <!-- * disable justification (".ad l" means "adjust to left only") -->
+    <xsl:if test="$man.justify = 0">
+      <xsl:text>.\" disable justification</xsl:text>
+      <xsl:text> (adjust text to left margin only)&#10;</xsl:text>
+      <xsl:text>.ad l&#10;</xsl:text>
+    </xsl:if>
+    <xsl:if test="not($man.indent.refsect = 0)">
+      <xsl:text>.\" store initial "default indentation value"&#10;</xsl:text>
+      <xsl:text>.nr zq \n(IN&#10;</xsl:text>
+      <xsl:text>.\" adjust default indentation&#10;</xsl:text>
+      <xsl:text>.nr IN </xsl:text>
+      <xsl:value-of select="$man.indent.width"/>
+      <xsl:text>&#10;</xsl:text>
+      <xsl:text>.\" adjust indentation of SS headings&#10;</xsl:text>
+      <xsl:text>.nr SN \n(IN&#10;</xsl:text>
+    </xsl:if>
+    <!-- * Unless the value of man.break.after.slash is zero (the -->
+    <!-- * default), tell groff that it is OK to break a line -->
+    <!-- * after a slash when needed. -->
+    <xsl:if test="$man.break.after.slash != 0">
+      <xsl:text>.\" enable line breaks after slashes&#10;</xsl:text>
+      <xsl:text>.cflags 4 /&#10;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ================================================================== -->
+
+  <!-- * The prepare.manpage.contents template is called after all -->
+  <!-- * other processing has been done, before serializing the -->
+  <!-- * result of all the other processing. It basically works on -->
+  <!-- * the result as one big string. -->
+  <xsl:template name="prepare.manpage.contents">
+    <xsl:param name="content" select="''"/>
+
+    <!-- * If user has provided a "local" string-substitution map to -->
+    <!-- * be applied /before/ the standard string-substitution map, -->
+    <!-- * apply it. -->
+    <xsl:variable name="pre.adjusted.content">
+      <xsl:choose>
+        <xsl:when test="$man.string.subst.map.local.pre">
+          <!-- * normalized value of man.string.subst.map.local.pre -->
+          <!-- * is non-empty, so get contents of map and apply them -->
+          <xsl:call-template name="apply-string-subst-map">
+            <xsl:with-param name="content" select="$content"/>
+            <xsl:with-param name="map.contents"
+                            select="exsl:node-set($man.string.subst.map.local.pre)/*"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- * value of man.string.subst.map.local.pre is empty, -->
+          <!-- * so just copy original contents -->
+          <xsl:value-of select="$content"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- * Apply standard string-substitution map. The main purpose -->
+    <!-- * of this map is to escape certain characters that have -->
+    <!-- * special meaning in roff, and to replace certain characters -->
+    <!-- * used within the stylesheet internally to represent roff -->
+    <!-- * markup characters. -->
+    <xsl:variable name="adjusted.content">
+      <xsl:call-template name="apply-string-subst-map">
+        <xsl:with-param name="content" select="$pre.adjusted.content"/>
+        <xsl:with-param name="map.contents"
+                        select="exsl:node-set($man.string.subst.map)/*"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <!-- * If user has provided a "local" string-substitution map to -->
+    <!-- * be applied /after/ the standard string-substitution map, -->
+    <!-- * apply it. -->
+    <xsl:variable name="post.adjusted.content">
+      <xsl:choose>
+        <xsl:when test="$man.string.subst.map.local.post">
+          <!-- * normalized value of man.string.subst.map.local.post -->
+          <!-- * is non-empty, so get contents of map and apply them -->
+          <xsl:call-template name="apply-string-subst-map">
+            <xsl:with-param name="content" select="$adjusted.content"/>
+            <xsl:with-param name="map.contents"
+                            select="exsl:node-set($man.string.subst.map.local.post)/*"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- * value of man.string.subst.map.local.post is empty, -->
+          <!-- * so just copy original contents -->
+          <xsl:value-of select="$adjusted.content"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- * Optionally, apply a character map to replace Unicode -->
+    <!-- * symbols and special characters. -->
+    <xsl:choose>
+      <xsl:when test="$man.charmap.enabled != 0">
+        <xsl:call-template name="apply-character-map">
+          <xsl:with-param name="content" select="$post.adjusted.content"/>
+          <xsl:with-param name="map.contents"
+                          select="exsl:node-set($man.charmap.contents)/*"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- * if we reach here, value of $man.charmap.enabled is zero, -->
+        <!-- * so we just pass the adjusted contents through "as is" -->
+        <xsl:value-of select="$adjusted.content"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- ================================================================== -->
+  
+  <xsl:template name="write.man.file">
+    <xsl:param name="name"/>
+    <xsl:param name="section"/>
+    <xsl:param name="lang"/>
+    <xsl:param name="content"/>
+    <xsl:param name="filename">
+      <xsl:call-template name="make.adjusted.man.filename">
+        <xsl:with-param name="name" select="$name"/>
+        <xsl:with-param name="section" select="$section"/>
+        <xsl:with-param name="lang" select="$lang"/>
+      </xsl:call-template>
+    </xsl:param>
+    <xsl:call-template name="write.text.chunk">
+      <xsl:with-param name="filename" select="$filename"/>
+      <xsl:with-param name="suppress-context-node-name" select="1"/>
+      <xsl:with-param name="quiet" select="$man.output.quietly"/>
+      <xsl:with-param
+          name="message-prolog"
+          >Note: </xsl:with-param>
+      <xsl:with-param name="encoding" select="$man.output.encoding"/>
+      <xsl:with-param name="content" select="$content"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ============================================================== -->
+
+  <!-- * A "stub" is sort of alias for another file, intended to be read -->
+  <!-- * and expanded by soelim(1); it's simply a file whose complete -->
+  <!-- * contents are just a single line of the following form: -->
+  <!-- * -->
+  <!-- *  .so manX/realname.X -->
+  <!-- * -->
+  <!-- * "realname" is a name of another man-page file. That .so line is -->
+  <!-- * basically a roff "include" statement.  When the man command finds -->
+  <!-- * it, it calls soelim(1) and includes and displays the contents of -->
+  <!-- * the manX/realqname.X file. -->
+  <!-- * -->
+  <!-- * If a refentry has multiple refnames, we generate a "stub" page for -->
+  <!-- * each refname found, except for the first one. -->
+  <xsl:template name="write.stubs">
+    <xsl:param name="first.refname"/>
+    <xsl:param name="section"/>
+    <xsl:param name="lang"/>
+    <xsl:for-each select="refnamediv/refname">
+      <xsl:if test=". != $first.refname">
+        <xsl:call-template name="write.text.chunk">
+          <xsl:with-param name="filename">
+            <xsl:call-template name="make.adjusted.man.filename">
+              <xsl:with-param name="name" select="."/>
+              <xsl:with-param name="section" select="$section"/>
+              <xsl:with-param name="lang" select="$lang"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="quiet" select="$man.output.quietly"/>
+          <xsl:with-param name="suppress-context-node-name" select="1"/>
+          <xsl:with-param name="message-prolog">Note: </xsl:with-param>
+          <xsl:with-param name="message-epilog"> (soelim stub)</xsl:with-param>
+          <xsl:with-param name="content">
+            <xsl:choose>
+              <xsl:when test="$man.output.in.separate.dir = 0">
+              <xsl:value-of select="concat('.so man', $section, '/')"/>
+              </xsl:when>
+              <xsl:otherwise>
+              <xsl:value-of select="'.so '"/> <!-- added case -->
+              </xsl:otherwise>
+              </xsl:choose>
+            <xsl:variable name="full.filename">
+              <xsl:call-template name="make.adjusted.man.filename">
+                <xsl:with-param name="name" select="$first.refname"/>
+                <xsl:with-param name="section" select="$section"/>
+                <xsl:with-param name="lang" select="$lang"/>
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+              <xsl:when test="starts-with($full.filename, $man.output.base.dir)">
+                <xsl:value-of 
+                   select="substring-after($full.filename,$man.output.base.dir)"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="$full.filename"/>
+              </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>&#10;</xsl:text>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+
+  <!-- ============================================================== -->
+
+  <!-- *  A manifest file is useful for doing "make clean" during -->
+  <!-- *  builds and for other purposes. When we make the manifest -->
+  <!-- *  file, we need to include in it a filename for each man-page -->
+  <!-- *  generated, including any "stub" pages. -->
+  <xsl:template name="generate.manifest">
+    <xsl:variable name="filelist">
+      <xsl:for-each select="//refentry">
+        <!-- * all refname instances in a Refentry inherit their section -->
+        <!-- * numbers from the parent Refentry; so we only need to get -->
+        <!-- * the section once per Refentry, not once per Refname -->
+        <xsl:variable name="section">
+          <xsl:call-template name="get.refentry.section">
+            <xsl:with-param name="quiet" select="1"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable name="lang">
+          <xsl:call-template name="l10n.language"/>
+        </xsl:variable>
+        <xsl:for-each select="refnamediv/refname">
+          <xsl:call-template name="make.adjusted.man.filename">
+            <xsl:with-param name="name" select="."/>
+            <xsl:with-param name="section" select="$section"/>
+            <xsl:with-param name="lang" select="$lang"/>
+          </xsl:call-template>
+          <xsl:text>&#10;</xsl:text>
+        </xsl:for-each>
+      </xsl:for-each>
+    </xsl:variable>
+
+    <!-- * we write the manifest file once per document, not once per -->
+    <!-- * Refentry -->
+    <xsl:call-template name="write.text.chunk">
+      <xsl:with-param name="filename">
+        <xsl:value-of select="$man.output.manifest.filename"/>
+      </xsl:with-param>
+      <xsl:with-param name="quiet" select="1"/>
+      <xsl:with-param name="message-prolog">Note: </xsl:with-param>
+      <xsl:with-param name="message-epilog"> (manifest file)</xsl:with-param>
+      <xsl:with-param name="content">
+        <xsl:value-of select="$filelist"/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:if test="$man.output.quietly = 0">
+      <xsl:message><xsl:text>&#10;</xsl:text></xsl:message>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ============================================================== -->
+
+  <!-- There is some stuff, that is not portable between groff/troff. -->
+  <xsl:template name="define.portability.macros">
+    <xsl:text>.\" -----------------------------------------------------------------&#10;</xsl:text>
+    <xsl:text>.\" * Define some portability stuff&#10;</xsl:text>
+    <xsl:text>.\" -----------------------------------------------------------------&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" http://bugs.debian.org/507673&#10;</xsl:text>
+    <xsl:text>.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.ie \n(.g .ds Aq \(aq</xsl:text>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.el       .ds Aq '</xsl:text>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <!-- ============================================================== -->
+
+  <xsl:template name="define.macros">
+    <xsl:text>.\" -----------------------------------------------------------------&#10;</xsl:text>
+    <xsl:text>.\" * (re)Define some macros&#10;</xsl:text>
+    <xsl:text>.\" -----------------------------------------------------------------&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" toupper - uppercase a string (locale-aware)&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.de toupper&#10;</xsl:text>
+    <xsl:text>.tr</xsl:text>
+    <xsl:text> </xsl:text>
+    <xsl:call-template name="make.tr.uppercase.arg"/>
+    <xsl:text>\\$*&#10;</xsl:text>
+    <xsl:text>.tr</xsl:text>
+    <xsl:text> </xsl:text>
+    <xsl:call-template name="make.tr.normalcase.arg"/>
+    <xsl:text>..&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" SH-xref - format a cross-reference to an SH section&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" SH - level-one heading that works better for non-TTY output&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.de1 SH&#10;</xsl:text>
+    <xsl:text>.\" put an extra blank line of space above the head in non-TTY output&#10;</xsl:text>
+    <xsl:call-template name="roff-if-start">
+      <xsl:with-param name="condition">t</xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>.sp 1&#10;</xsl:text>
+    <xsl:call-template name="roff-if-end"/>
+    <xsl:text>.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" SS - level-two heading that works better for non-TTY output&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&amp;\\$*
+..&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" BB/EB - put background/screen (filled box) around block of text&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.\" BM/EM - put colored marker in margin next to block of text&#10;</xsl:text>
+    <xsl:text>.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&#10;</xsl:text>
+    <xsl:text>.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="make.tr.uppercase.arg">
+  <xsl:call-template name="string.shuffle">
+    <xsl:with-param name="string1">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'lowercase.alpha'"/>
+      </xsl:call-template>
+    </xsl:with-param>
+    <xsl:with-param name="string2">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'uppercase.alpha'"/>
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="make.tr.normalcase.arg">
+  <xsl:call-template name="string.shuffle">
+    <xsl:with-param name="string1">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'lowercase.alpha'"/>
+      </xsl:call-template>
+    </xsl:with-param>
+    <xsl:with-param name="string2">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key" select="'lowercase.alpha'"/>
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="string.shuffle">
+  <!-- * given two strings, "shuffle" them together into one -->
+  <xsl:param name="string1"/>
+  <xsl:param name="string2"/>
+  <xsl:value-of select="substring($string1, 1, 1)"/>
+  <xsl:value-of select="substring($string2, 1, 1)"/>
+  <xsl:if test="string-length($string1) > 1">
+    <xsl:call-template name="string.shuffle">
+      <xsl:with-param name="string1">
+        <xsl:value-of select="substring($string1, 2)"/>
+      </xsl:with-param>
+      <xsl:with-param name="string2">
+        <xsl:value-of select="substring($string2, 2)"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
Index: docbook-xsl/create-1.79.1-stylesheets-patch/file.list
===================================================================
--- docbook-xsl/create-1.79.1-stylesheets-patch/file.list	(nonexistent)
+++ docbook-xsl/create-1.79.1-stylesheets-patch/file.list	(revision 119)
@@ -0,0 +1,10 @@
+docbook-xsl-1.79.1/fo/autoidx.xsl
+docbook-xsl-1.79.1/fo/lists.xsl
+docbook-xsl-1.79.1/fo/pagesetup.xsl
+docbook-xsl-1.79.1/fo/param.xsl
+docbook-xsl-1.79.1/html/autoidx.xsl
+docbook-xsl-1.79.1/html/docbook.xsl
+docbook-xsl-1.79.1/html/param.xsl
+docbook-xsl-1.79.1/html/table.xsl
+docbook-xsl-1.79.1/lib/lib.xsl
+docbook-xsl-1.79.1/manpages/other.xsl
Index: docbook-xsl/patches/README
===================================================================
--- docbook-xsl/patches/README	(nonexistent)
+++ docbook-xsl/patches/README	(revision 119)
@@ -0,0 +1,6 @@
+
+/* begin *
+
+   TODO: Leave some comment here.
+
+ * end */
Index: docbook-xsl/patches
===================================================================
--- docbook-xsl/patches	(nonexistent)
+++ docbook-xsl/patches	(revision 119)

Property changes on: docbook-xsl/patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,74 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.rk358x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: docbook-xsl
===================================================================
--- docbook-xsl	(nonexistent)
+++ docbook-xsl	(revision 119)

Property changes on: docbook-xsl
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,74 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.rk358x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: docbook-xsl-doc/Makefile
===================================================================
--- docbook-xsl-doc/Makefile	(nonexistent)
+++ docbook-xsl-doc/Makefile	(revision 119)
@@ -0,0 +1,47 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../../build-system/constants.mk
+
+
+url         = $(DOWNLOAD_SERVER)/sources/packages/a/linuxdoc-tools/docbook-xsl-doc
+
+versions    = 1.79.1
+pkgname     = docbook-xsl-doc
+suffix      = tar.bz2
+
+tarballs    = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s       = $(addsuffix .sha1sum, $(tarballs))
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s)
+
+
+include ../../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+	@echo -e "\n======= Downloading source tarballs =======" ; \
+	 for tarball in $(tarballs) ; do \
+	   echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+	 done ; wait
+
+$(sha1s): $(tarballs)
+	@for sha in $@ ; do \
+	   echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+	   echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+	   touch $$sha ; \
+	   echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+	   sha1sum --check $$sha ; ret="$$?" ; \
+	   if [ "$$ret" == "1" ]; then \
+	     echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+	     exit 1 ; \
+	   fi ; \
+	 done
+
+download_clean:
+	@rm -f $(tarballs) $(sha1s)
Index: docbook-xsl-doc
===================================================================
--- docbook-xsl-doc	(nonexistent)
+++ docbook-xsl-doc	(revision 119)

Property changes on: docbook-xsl-doc
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,74 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.rk358x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~