New upstream version 2.0.0

This commit is contained in:
Jonas Smedegaard 2021-10-05 01:41:33 +02:00
commit e11228cf77
936 changed files with 63411 additions and 469546 deletions

39
AUTOTOOLS-TESTING Normal file
View File

@ -0,0 +1,39 @@
Untested:
- flags of configure script:
--enable-mlite
--enable-gui=all or --enable-gui=moblin
--enable-akonadi
--enable-kcalextended
--enable-qtcontacts (see TODO)
--enable-kwallet
--enable-maemocal
... probably more.
- make -j and make -jX where X>2, because gcc is being killed by oom-killer).
Partially tested:
--enable-gnome-bluetooth-panel-plugin (installation not tested - plugin is not
installed under given prefix, but somewhere into /usr/lib...)
Tested and passed:
- flags of configure script:
--enable-unit-tests
--enable-integration-tests
--enable-maemo
--enable-libcurl
--enable-libsoup
--enable-bluetooth
--enable-gui=gtk
--enable-core
--enable-dbus-service
--enable-gnome-keyring
--enable-notify
--enable-doc
--enable-sqlite
--enable-dav
--enable-xmlrpc
--enable-qt-dbus
--enable-static
--disable-shared
- make -jX
- make V=0
- make -j2 distcheck

109
AUTOTOOLS-TODO Normal file
View File

@ -0,0 +1,109 @@
REGRESSIONS:
- Port ActiveSync backend to non-recursive Automake.
IMPROVEMENTS:
- Add a check for qt-mobility for QtContacts backend.
- Probably client test should be built only when unit tests or integration tests
are enabled.
- Review CLEANFILES, DISTCLEANFILES, MAINTAINERCLEANFILES and MOSTLYCLEANFILES.
That is - check which files should be assigned to which of CLEAN variables.
- Check why distcheck outputs:
==================
All 0 tests passed
==================
There should have been at least one test being run. The same behavior exists
in old build system.
This is because neither unit tests nor integration tests are enabled by
default. If we would want to enable them then we should add
--enable-unit-tests and --enable-integration-tests into
DISTCHECK_CONFIGURE_FLAGS in toplevel Makefile.am.
- Check why there are so many failed tests when running `make check' explicitly.
The same number of failures exists in old build system:
Run: 583 Failure total: 528 Failures: 206 Errors: 322
- Tidy up configure.ac and some .am files.
- Maybe write scripts generating configs_xml.am, templates.am and profiles.am.
QUESTIONS:
- None.
PERSISTENT:
- Hunt for common variables clobbering.
- Silence more verbose output if found.
NITPICKS:
- Check if SyncEvolutionXML.c should always be recreated, patches always checked
and test-client always relinked.
- Maybe do not create /share/man/man1 directory if we do not put there anything.
- If backends are static libraries then do not create /lib/syncevolution,
because nothing is put here.
- Change $(foo) to @foo@ for all variables substituted by configure script. This
might be useful when looking for actual value of variable appearing out of
nowhere in .am file. Maybe make also all configure variables UPPER_CASE
and all local Automake variables lower_case.
- Lower autoreconf's warnings level later. Namely - don't warn about some
portability issues. The warnings about obsolete stuff should rather remain.
For now only some glib macros are using obsolete features.
- Should stamp files be marked as intermediate or rather as secondary files?
- Check why 'copying selected object files to avoid basename conflicts...' is
displayed between linking src/dbus/server/libsyncevodbusserver.la
and compiling src/gdbus/src_gdbus_libgdbussyncevo_la-debug.lo. This is
probably harmless.
TRACKING:
- Handle nobase prefixes. Link to track:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9289
- Explanation why make -jX used to fail:
It failed because usually Automake generates dependencies of a library/program
by looking at its _LIBADD/_LDADD variable. But this generation doesn't work
correctly when _LIBADD/_LDADD variable has AC_SUBSTed variable - automake then
just discards them and resulting _DEPENDENCIES variable does not contain them.
As a workaround _DEPENDENCIES variable have to be written explicitly. Link to
track:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9320

52148
ChangeLog

File diff suppressed because it is too large Load Diff

368
INSTALL
View File

@ -1,368 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell command './configure && make && make install'
should configure, build, and install this package. The following
more-detailed instructions are generic; see the 'README' file for
instructions specific to this package. Some packages provide this
'INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The 'configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a 'Makefile' in each directory of the package.
It may also create one or more '.h' files containing system-dependent
definitions. Finally, it creates a shell script 'config.status' that
you can run in the future to recreate the current configuration, and a
file 'config.log' containing compiler output (useful mainly for
debugging 'configure').
It can also use an optional file (typically called 'config.cache' and
enabled with '--cache-file=config.cache' or simply '-C') that saves the
results of its tests to speed up reconfiguring. Caching is disabled by
default to prevent problems with accidental use of stale cache files.
If you need to do unusual things to compile the package, please try
to figure out how 'configure' could check whether to do them, and mail
diffs or instructions to the address given in the 'README' so they can
be considered for the next release. If you are using the cache, and at
some point 'config.cache' contains results you don't want to keep, you
may remove or edit it.
The file 'configure.ac' (or 'configure.in') is used to create
'configure' by a program called 'autoconf'. You need 'configure.ac' if
you want to change it or regenerate 'configure' using a newer version of
'autoconf'.
The simplest way to compile this package is:
1. 'cd' to the directory containing the package's source code and type
'./configure' to configure the package for your system.
Running 'configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type 'make' to compile the package.
3. Optionally, type 'make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type 'make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the 'make install' phase executed with root
privileges.
5. Optionally, type 'make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior 'make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing 'make clean'. To also remove the
files that 'configure' created (so you can compile the package for
a different kind of computer), type 'make distclean'. There is
also a 'make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type 'make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide 'make
distcheck', which can by used by developers to test that all other
targets like 'make install' and 'make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the 'configure' script does not know about. Run './configure --help'
for details on some of the pertinent environment variables.
You can give 'configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here is
an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU 'make'. 'cd' to the
directory where you want the object files and executables to go and run
the 'configure' script. 'configure' automatically checks for the source
code in the directory that 'configure' is in and in '..'. This is known
as a "VPATH" build.
With a non-GNU 'make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use 'make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple '-arch' options to the
compiler but only a single '-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the 'lipo' tool if you have problems.
Installation Names
==================
By default, 'make install' installs the package's commands under
'/usr/local/bin', include files under '/usr/local/include', etc. You
can specify an installation prefix other than '/usr/local' by giving
'configure' the option '--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like '--bindir=DIR' to specify different values for particular
kinds of files. Run 'configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the default
for these options is expressed in terms of '${prefix}', so that
specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to 'configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
'make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
'${prefix}'. Any directories that were specified during 'configure',
but not in terms of '${prefix}', must each be overridden at install time
for the entire installation to be relocated. The approach of makefile
variable overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation. However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.
The second method involves providing the 'DESTDIR' variable. For
example, 'make install DESTDIR=/alternate/directory' will prepend
'/alternate/directory' before all installation names. The approach of
'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of '${prefix}'
at 'configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving 'configure' the
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
Some packages pay attention to '--enable-FEATURE' options to
'configure', where FEATURE indicates an optional part of the package.
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
is something like 'gnu-as' or 'x' (for the X Window System). The
'README' should mention any '--enable-' and '--with-' options that the
package recognizes.
For packages that use the X Window System, 'configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the 'configure' options '--x-includes=DIR' and
'--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of 'make' will be. For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with 'make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX 'make' updates targets which have the same time stamps as their
prerequisites, which makes it generally unusable when shipped generated
files such as 'configure' are involved. Use GNU 'make' instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
workaround. If GNU CC is not installed, it is therefore recommended to
try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
in your 'PATH', put it _after_ '/usr/bin'.
On Haiku, software installed for all users goes in '/boot/common',
not '/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features 'configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, 'configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
'--build=TYPE' option. TYPE can either be a short name for the system
type, such as 'sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file 'config.sub' for the possible values of each field. If
'config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option '--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with '--host=TYPE'.
Sharing Defaults
================
If you want to set default values for 'configure' scripts to share,
you can create a site shell script called 'config.site' that gives
default values for variables like 'CC', 'cache_file', and 'prefix'.
'configure' looks for 'PREFIX/share/config.site' if it exists, then
'PREFIX/etc/config.site' if it exists. Or, you can set the
'CONFIG_SITE' environment variable to the location of the site script.
A warning: not all 'configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to 'configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the 'configure' command line, using 'VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified 'gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
Autoconf limitation. Until the limitation is lifted, you can use this
workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
'configure' Invocation
======================
'configure' recognizes the following options to control how it
operates.
'--help'
'-h'
Print a summary of all of the options to 'configure', and exit.
'--help=short'
'--help=recursive'
Print a summary of the options unique to this package's
'configure', and exit. The 'short' variant lists options used only
in the top level, while the 'recursive' variant lists options also
present in any nested packages.
'--version'
'-V'
Print the version of Autoconf used to generate the 'configure'
script, and exit.
'--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally 'config.cache'. FILE defaults to '/dev/null' to
disable caching.
'--config-cache'
'-C'
Alias for '--cache-file=config.cache'.
'--quiet'
'--silent'
'-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to '/dev/null' (any error
messages will still be shown).
'--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
'configure' can determine that directory automatically.
'--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names:: for
more details, including other options available for fine-tuning the
installation locations.
'--no-create'
'-n'
Run the configure checks, but stop before creating any output
files.
'configure' also accepts some other, not widely useful, options. Run
'configure --help' for more details.

12
INSTALL-tar-gz Normal file
View File

@ -0,0 +1,12 @@
This archive contains all files necessary to run SyncEvolution *as
part of the system*.
This means that the files have to be placed in the root file
system. This is necessary because some system services (D-Bus server)
would not be able to find them without further hacks otherwise.
To install the files, unpack them and then run:
sudo cp -a usr/* /usr
*** Warning: *** this bypasses the system's package management. If
there are packages for your system, then better install those.

13504
Makefile.in

File diff suppressed because it is too large Load Diff

1864
README

File diff suppressed because it is too large Load Diff

30
README-DLT.rst Normal file
View File

@ -0,0 +1,30 @@
Diagnostic Log and Trace
========================
Diagnostic Log and Trace (DLT) is a logging mechanism defined and
implemented by GENIVI: http://projects.genivi.org/diagnostic-log-trace/
SyncEvolution optionally supports DLT as follows:
* syncevo-dbus-server, syncevo-dbus-helper and syncevo-local-sync can
log to DLT. Operations with "syncevolution --daemon=no" never use
DLT.
* Each of the three processes uses a different application ID. By
default, these IDs are "SYNS", "SYNH", "SYNL". These default can be
changed via configure options. All processes use just one context,
with the fixed ID "SYNC".
* syncevo-dbus-helper and syncevo-local-sync only run occasionally.
This makes is hard to adjust their log levels, for example via the
dlt-viewer, because the processes and their contexts are only shown
(known?) while the processes run. To work around this, the initial
log level of these two helpers are inherited from the
log level of the "SYNC" context in syncevo-dbus-helper.
* That log level defaults to "WARN", which ensures that normal runs
produce no output.
* To enable DLT support during compilation, use
"--enable-dlt" and "--with-dlt-syncevolution=SYNS,SYNH,SYNL" where SYNS/H/L
are the actual application IDs.
* To enable DLT support at runtime, run syncevo-dbus-server with
"--dlt". Logging to syslog should be disabled with "--no-syslog".
* The hierarchical log from libsynthesis gets flattened into a flat
stream of messages and no syncevolution-log.html files are written.

27
README.packagers Normal file
View File

@ -0,0 +1,27 @@
Some of the advanced features of SyncEvolution depend on optional
packages. In addition to the more obvious dependencies of the
backends there are more subtle dependencies:
- for good time zone support, libsynthesis must have access to
either libical or libecal
- direct sync with phones depends on bluez and openobex
- GNOME Bluetooth Panel needs libgnome-bluetooth-dev *AND*
--enable-gnome-bluetooth-panel
- either glib or libnss should be available, so that
SyncEvolution can use SHA-256 hashes instead of a
weaker built-in algorithm for hashes in the database dump
.ini files
- libnotify is needed by the syncevo-dbus-server, although
--disable-notify can be used to avoid that.
- Localization data is shared between sync-ui and syncevo-dbus-server
and thus needs to be packaged with the core SyncEvolution.
- to enable CalDAV/CardDAV:
- use --enable-dav
- needs libneon[-gnutls].pc (use gnutls version, if available,
but make sure that it is >= 0.29.5, which has this patch:
http://lists.manyfish.co.uk/pipermail/neon/2010-November/001294.html)
- ensure that one of the following commands is available at runtime:
adnshost, host, nslookup
- as of SyncEvolution >= 1.3 rst2html tool should be made as a build
requirement, because README.html is optionally generated during build instead
of being distributed.

67
SyncEvolution.plist.in Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleIdentifier</key>
<string>de.estamos.iphone.SyncEvolution</string>
<key>name</key>
<string>SyncEvolution</string>
<key>version</key>
<string>__VERSION__</string>
<key>location</key>
<string>http://www.estamos.de/iphone/zips/__FILENAME__</string>
<key>size</key>
<string>__SIZE__</string>
<key>description</key>
<string>A command line tool to synchronize the address book via SyncML.</string>
<key>url</key>
<string>http://www.estamos.de/projects/SyncML/</string>
<key>scripts</key>
<dict>
<key>install</key>
<array>
<array>
<string>CopyPath</string>
<string>usr/bin/syncevolution</string>
<string>/usr/bin/syncevolution</string>
</array>
<array>
<string>CopyPath</string>
<string>usr/bin/synccompare</string>
<string>/usr/bin/synccompare</string>
</array>
<array>
<string>SetStatus</string>
<string>Run 'syncevolution &lt;server&gt;' to synchronize.</string>
</array>
<array>
<string>IfNot</string>
<array>
<array>
<string>ExistsPath</string>
<string>/var/root/.sync4j</string>
</array>
</array>
<array>
<array>
<string>CopyPath</string>
<string>usr/share/doc/syncevolution/</string>
<string>/var/root/.sync4j/evolution</string>
</array>
</array>
</array>
</array>
<key>uninstall</key>
<array>
<array>
<string>RemovePath</string>
<string>/usr/bin/syncevolution</string>
</array>
<array>
<string>RemovePath</string>
<string>/usr/bin/synccompare</string>
</array>
</array>
</dict>
</dict>
</plist>

1980
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

15
build/xsl-update.sh Executable file
View File

@ -0,0 +1,15 @@
#! /bin/sh
#
# Download current version of all our docbook XSL files.
# Handles download errors by retrying. Does not handle
# new or removed files, that needs to be done manually.
set -x
cd `dirname $0`/xsl
for i in `find * -type f`; do
for attempt in `seq 0 10`; do
if wget -O $i.tmp http://docbook.sourceforge.net/release/xsl/current/$i && mv $i.tmp $i; then
break
fi
done
done

48
build/xsl/COPYING Normal file
View File

@ -0,0 +1,48 @@
Copyright
---------
Copyright (C) 1999-2007 Norman Walsh
Copyright (C) 2003 Jiří Kosek
Copyright (C) 2004-2007 Steve Ball
Copyright (C) 2005-2008 The DocBook Project
Copyright (C) 2011-2012 O'Reilly Media
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the ``Software''), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Except as contained in this notice, the names of individuals
credited with contribution to this software shall not be used in
advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization
from the individuals in question.
Any stylesheet derived from this Software that is publically
distributed will be identified with a different name and the
version strings in any derived Software will be changed so that
no possibility of confusion between the derived package and this
Software will exist.
Warranty
--------
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Contacting the Author
---------------------
The DocBook XSL stylesheets are maintained by Norman Walsh,
<ndw@nwalsh.com>, and members of the DocBook Project,
<docbook-developers@sf.net>

173
build/xsl/README Normal file
View File

@ -0,0 +1,173 @@
----------------------------------------------------------------------
README file for the DocBook XSL Stylesheets
----------------------------------------------------------------------
$Id: README 9397 2012-06-02 22:35:07Z bobstayton $
These are XSL stylesheets for transforming DocBook XML document
instances into various output formats.
This README file provides only very minimal documentation on using
the stylesheets. For more complete information, see Bob Stayton's
book "DocBook XSL: The Complete Guide", available online at:
http://www.sagehill.net/docbookxsl/
----------------------------------------------------------------------
Installation
----------------------------------------------------------------------
See the INSTALL file for information about installing this release.
----------------------------------------------------------------------
How to use the stylesheets
----------------------------------------------------------------------
The base canonical URI for these stylesheets is:
http://docbook.sourceforge.net/release/xsl/current/
You call any of the stylesheets in this distribution by doing one
of the following:
- Use the base canonical URI in combination with one of the
pathnames below. For example, for "chunked" HTML, output:
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
If your system has a working XML Catalog or SGML Catalog setup
(most Linux systems do), then that URI will automatically be
resolved and replaced with a local pathname on your system.
- Use a "real" local system base path in combination with one of
the pathnames below. For example, for "chunked" HTML, output:
/usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
To transform documents created with the standard DocBook
schema/DTD, use one of the following stylesheets:
fo/docbook.xsl - for XSL-FO
html/docbook.xsl - for HTML (as a single file)
html/chunk.xsl - for HTML (chunked into multiple files)
html/onechunk.xsl - for HTML (chunked output in single file)
xhtml/*.xsl - for XHTML versions of the above
xhtml-1_1/*.xsl - for XHTML 1.1 versions of the above
xhtml5/*.xsl - for XHTML5 versions of the above
epub/docbook.xsl - for .epub version 2 and earlier
epub3/docbook.xsl - for .epub version 3 and later
htmlhelp/htmlhelp.xsl - for HTML Help
javahelp/javahelp.xsl - for JavaHelp
eclipse/eclipse.xsl - for Eclipse Help
manpages/docbook.xsl - for groff/nroff man pages
*/profile-* - single-pass-profiling versions of all above
roundtrip/*.xsl - for DocBook to WordML, etc., to DocBook
assembly/assemble.xsl - converts an assembly into a DocBook document
assembly/topic-maker-chunk.xsl
- converts a DocBook document into an assembly
with topic files.
To transform documents created with the DocBook Slides schema/DTD,
use one of the following stylesheets:
slides/html/*.xsl - for HTML slides of various kinds
slides/xhtml/*.xsl - for XHTML slides of various kinds
slides/fo/plain.xsl - for XSL-FO slides
slides/htmlhelp/... - for HTML Help slides
To transform documents created with the DocBook Website
schema/DTD, use one of the following stylesheets:
website/website.xsl - for non-tabular, non-chunked output
website/tabular.xsl - for tabular, non-chunked output
website/chunk-* - for chunked output
To generate a titlepage customization layer from a titlepage spec:
template/titlepage.xsl
For fo titlepage customizations, set the stylesheet parameter named 'ns'
to 'http://www.w3.org/1999/XSL/Format' when using this stylesheet.
For xhtml titlepage customizations, set the stylesheet parameter named 'ns'
to 'http://www.w3.org/1999/xhtml' when using this stylesheet.
For details about creating titlepage spec files and generating and
using titlepage customization layers, see "DocBook XSL: The
Complete Guide" <http://www.sagehill.net/docbookxsl/>
----------------------------------------------------------------------
Manifest
----------------------------------------------------------------------
AUTHORS contact information
BUGS about known problems
COPYING copyright information
INSTALL installation instructions
README this file
RELEASE.* per-release cumulative summaries of user-visible changes
TODO about planned features not yet implemented
VERSION release metadata, including the current version
number (note that the VERSION file is an XSL stylesheet)
NEWS changes since the last public release (for a cumulative list of
changes, see the ChangeHistory.xml file)
assembly/ for making and processing DocBook assemblies.
common/ code used among several output formats (HTML, FO, manpages,...)
docsrc/ documentation sources
eclipse/ for producing Eclipse Help
epub/ for producing .epub version 2.
epub3/ for producing .epub version 3 and beyond.
extensions/ DocBook XSL Java extensions
fo/ for producing XSL-FO
highlighting files used for adding source-code syntax highlighting in output
html/ for producing HTML
htmlhelp/ for producing HTML Help
images/ images used in callouts and graphical admonitions
javahelp/ for producing Java Help
lib/ utility stylesheets with schema-independent functions
manpages/ for producing groff/troff man pages
profiling/ for profiling (omitting/including conditional text)
roundtrip/ for "round trip" conversion among DocBook and
various word-processor formats (WordML, etc.)
slides/ for producing slides output (from Slides source)
template/ templates for building stylesheet customization layers
tools/ assorted supplementary tools
website/ for producing website output (from Website source)
xhtml/ for producing XHTML
xhtml-1_1/ for producing (stricter) XHTML 1.1
xhtml5/ for producing XHTML5
----------------------------------------------------------------------
Changes
----------------------------------------------------------------------
See the NEWS file for changes made since the previous release.
See the RELEASE-NOTES.html or RELEASE-NOTES.txt or RELEASE-NOTES.pdf
files for per-release cumulative summaries of significant
user-visible changes.
For online access to a hyperlinked view of all changes made over
the entire history of the codebase, see the following:
http://docbook.svn.sourceforge.net/viewvc/docbook/trunk/xsl/?view=log
WARNING: That above change history is a very long list and may
take a long time to load/download.
You can also create an XML-formatted "ChangeHistory.xml" copy of
the complete change history for the codebase by running the
following commands:
svn checkout https://docbook.svn.sf.net/svnroot/docbook/trunk/xsl
svn log --xml --verbose xsl > ChangeHistory.xml
----------------------------------------------------------------------
Copyright information
----------------------------------------------------------------------
See the accompanying file named COPYING.

115
build/xsl/VERSION.xsl Normal file
View File

@ -0,0 +1,115 @@
<?xml version='1.0'?> <!-- -*- nxml -*- vim: set foldlevel=2: -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fm="http://freshmeat.net/projects/freshmeat-submit/"
xmlns:sf="http://sourceforge.net/"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:saxon="http://icl.com/saxon"
exclude-result-prefixes="fm sf"
version='1.0'>
<xsl:param name="get"/>
<xsl:param name="VERSION" select="string(document('')//fm:Version[1])"/>
<xsl:param name="Tag" select="concat('V',translate(string(document('')//fm:Version[1]),'.',''))"/>
<xsl:param name="DistroTitle" select="string(document('')//fm:Branch[1])"/>
<xsl:param name="sf-relid" select="0"/>
<xsl:param name="DistroName">docbook-xsl</xsl:param>
<xsl:param name="PreviousRelease">1.77.0</xsl:param>
<xsl:param name="PreviousReleaseRevision">9371</xsl:param>
<xsl:param name="Revision">$Revision: 9399 $</xsl:param>
<xsl:param name="VersionFileURL">$URL: https://docbook.svn.sourceforge.net/svnroot/docbook/trunk/xsl/VERSION $</xsl:param>
<xsl:strip-space elements="fm:*"/>
<fm:project>
<fm:Project>DocBook</fm:Project>
<fm:Branch>XSL Stylesheets</fm:Branch>
<!-- * set/keep fm:version as N.NN.N-pre except for official releases, -->
<!-- * then after the release, revert it to N.NN.N-pre & check back in -->
<fm:Version>1.77.1</fm:Version>
<!--
<fm:License>MIT/X Consortium License</fm:License>
-->
<fm:Release-Focus>
<!-- * Initial freshmeat announcement -->
<!-- * Documentation -->
<!-- * Code cleanup -->
<!-- * Minor feature enhancements -->
* Major feature enhancements
<!-- * Minor bugfixes -->
<!-- * Major bugfixes -->
<!-- * Minor security fixes -->
<!-- * Major security fixes -->
</fm:Release-Focus>
<fm:Home-Page-URL>http://sourceforge.net/projects/docbook/</fm:Home-Page-URL>
<fm:Gzipped-Tar-URL>http://prdownloads.sourceforge.net/docbook/{DISTRONAME-VERSION}.tar.gz?download</fm:Gzipped-Tar-URL>
<fm:Zipped-Tar-URL>http://prdownloads.sourceforge.net/docbook/{DISTRONAME-VERSION}.zip?download</fm:Zipped-Tar-URL>
<fm:Bzipped-Tar-URL>http://prdownloads.sourceforge.net/docbook/{DISTRONAME-VERSION}.bz2?download</fm:Bzipped-Tar-URL>
<fm:Changelog-URL>http://sourceforge.net/project/shownotes.php?release_id={SFRELID}</fm:Changelog-URL>
<fm:CVS-URL>http://docbook.svn.sourceforge.net/viewvc/docbook/</fm:CVS-URL>
<fm:Mailing-List-URL>http://lists.oasis-open.org/archives/docbook-apps/</fm:Mailing-List-URL>
<fm:Changes>This is a release with bugfixes and some enhancements.</fm:Changes>
</fm:project>
<xsl:template match="/" priority="-100">
<xsl:choose>
<xsl:when test="$get = 'Tag'">
<xsl:value-of select="$Tag"/>
</xsl:when>
<xsl:when test="$get = 'PreviousRelease'">
<xsl:value-of select="$PreviousRelease"/>
</xsl:when>
<xsl:when test="$get = 'PreviousReleaseRevision'">
<xsl:value-of select="$PreviousReleaseRevision"/>
</xsl:when>
<xsl:when test="$get = 'DistroTitle'">
<xsl:value-of select="$DistroTitle"/>
</xsl:when>
<xsl:when test="$get = 'VERSION'">
<xsl:value-of select="$VERSION"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$sf-relid = 0">
<xsl:message terminate="yes">
<xsl:text>You must specify the sf-relid as a parameter.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:apply-templates select="//fm:project"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="fm:project">
<xsl:apply-templates/>
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="fm:Changes" mode="text"/>
</xsl:template>
<xsl:template match="fm:Changes"/>
<xsl:template match="fm:Gzipped-Tar-URL|fm:Zipped-Tar-URL|fm:Bzipped-Tar-URL">
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="substring-before(., '{DISTRONAME-VERSION}')"/>
<xsl:value-of select="concat($DistroName, '-', $VERSION)"/>
<xsl:value-of select="substring-after(., '{DISTRONAME-VERSION}')"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="fm:Changelog-URL">
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="substring-before(., '{SFRELID}')"/>
<xsl:value-of select="$sf-relid"/>
<xsl:value-of select="substring-after(., '{SFRELID}')"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="fm:*">
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>

2110
build/xsl/common/common.xsl Normal file

File diff suppressed because it is too large Load Diff

1247
build/xsl/common/en.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
<!-- ********************************************************************
$Id: entities.ent 9286 2012-04-19 10:10:58Z bobstayton $
********************************************************************
This file contains common entity declarations used for
sorting (and other things) by various templates.
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.
******************************************************************** -->
<!-- ==================================================================== -->
<!ENTITY lowercase "'Aa&#192;&#224;&#193;&#225;&#194;&#226;&#195;&#227;&#196;&#228;&#197;&#229;&#256;&#257;&#258;&#259;&#260;&#261;&#461;&#462;&#478;&#479;&#480;&#481;&#506;&#507;&#512;&#513;&#514;&#515;&#550;&#551;&#7680;&#7681;&#7834;&#7840;&#7841;&#7842;&#7843;&#7844;&#7845;&#7846;&#7847;&#7848;&#7849;&#7850;&#7851;&#7852;&#7853;&#7854;&#7855;&#7856;&#7857;&#7858;&#7859;&#7860;&#7861;&#7862;&#7863;Bb&#384;&#385;&#595;&#386;&#387;&#7682;&#7683;&#7684;&#7685;&#7686;&#7687;Cc&#199;&#231;&#262;&#263;&#264;&#265;&#266;&#267;&#268;&#269;&#391;&#392;&#597;&#7688;&#7689;Dd&#270;&#271;&#272;&#273;&#394;&#599;&#395;&#396;&#453;&#498;&#545;&#598;&#7690;&#7691;&#7692;&#7693;&#7694;&#7695;&#7696;&#7697;&#7698;&#7699;Ee&#200;&#232;&#201;&#233;&#202;&#234;&#203;&#235;&#274;&#275;&#276;&#277;&#278;&#279;&#280;&#281;&#282;&#283;&#516;&#517;&#518;&#519;&#552;&#553;&#7700;&#7701;&#7702;&#7703;&#7704;&#7705;&#7706;&#7707;&#7708;&#7709;&#7864;&#7865;&#7866;&#7867;&#7868;&#7869;&#7870;&#7871;&#7872;&#7873;&#7874;&#7875;&#7876;&#7877;&#7878;&#7879;Ff&#401;&#402;&#7710;&#7711;Gg&#284;&#285;&#286;&#287;&#288;&#289;&#290;&#291;&#403;&#608;&#484;&#485;&#486;&#487;&#500;&#501;&#7712;&#7713;Hh&#292;&#293;&#294;&#295;&#542;&#543;&#614;&#7714;&#7715;&#7716;&#7717;&#7718;&#7719;&#7720;&#7721;&#7722;&#7723;&#7830;Ii&#204;&#236;&#205;&#237;&#206;&#238;&#207;&#239;&#296;&#297;&#298;&#299;&#300;&#301;&#302;&#303;&#304;&#407;&#616;&#463;&#464;&#520;&#521;&#522;&#523;&#7724;&#7725;&#7726;&#7727;&#7880;&#7881;&#7882;&#7883;Jj&#308;&#309;&#496;&#669;Kk&#310;&#311;&#408;&#409;&#488;&#489;&#7728;&#7729;&#7730;&#7731;&#7732;&#7733;Ll&#313;&#314;&#315;&#316;&#317;&#318;&#319;&#320;&#321;&#322;&#410;&#456;&#564;&#619;&#620;&#621;&#7734;&#7735;&#7736;&#7737;&#7738;&#7739;&#7740;&#7741;Mm&#625;&#7742;&#7743;&#7744;&#7745;&#7746;&#7747;Nn&#209;&#241;&#323;&#324;&#325;&#326;&#327;&#328;&#413;&#626;&#414;&#544;&#459;&#504;&#505;&#565;&#627;&#7748;&#7749;&#7750;&#7751;&#7752;&#7753;&#7754;&#7755;Oo&#210;&#242;&#211;&#243;&#212;&#244;&#213;&#245;&#214;&#246;&#216;&#248;&#332;&#333;&#334;&#335;&#336;&#337;&#415;&#416;&#417;&#465;&#466;&#490;&#491;&#492;&#493;&#510;&#511;&#524;&#525;&#526;&#527;&#554;&#555;&#556;&#557;&#558;&#559;&#560;&#561;&#7756;&#7757;&#7758;&#7759;&#7760;&#7761;&#7762;&#7763;&#7884;&#7885;&#7886;&#7887;&#7888;&#7889;&#7890;&#7891;&#7892;&#7893;&#7894;&#7895;&#7896;&#7897;&#7898;&#7899;&#7900;&#7901;&#7902;&#7903;&#7904;&#7905;&#7906;&#7907;Pp&#420;&#421;&#7764;&#7765;&#7766;&#7767;Qq&#672;Rr&#340;&#341;&#342;&#343;&#344;&#345;&#528;&#529;&#530;&#531;&#636;&#637;&#638;&#7768;&#7769;&#7770;&#7771;&#7772;&#7773;&#7774;&#7775;Ss&#346;&#347;&#348;&#349;&#350;&#351;&#352;&#353;&#536;&#537;&#642;&#7776;&#7777;&#7778;&#7779;&#7780;&#7781;&#7782;&#7783;&#7784;&#7785;Tt&#354;&#355;&#356;&#357;&#358;&#359;&#427;&#428;&#429;&#430;&#648;&#538;&#539;&#566;&#7786;&#7787;&#7788;&#7789;&#7790;&#7791;&#7792;&#7793;&#7831;Uu&#217;&#249;&#218;&#250;&#219;&#251;&#220;&#252;&#360;&#361;&#362;&#363;&#364;&#365;&#366;&#367;&#368;&#369;&#370;&#371;&#431;&#432;&#467;&#468;&#469;&#470;&#471;&#472;&#473;&#474;&#475;&#476;&#532;&#533;&#534;&#535;&#7794;&#7795;&#7796;&#7797;&#7798;&#7799;&#7800;&#7801;&#7802;&#7803;&#7908;&#7909;&#7910;&#7911;&#7912;&#7913;&#7914;&#7915;&#7916;&#7917;&#7918;&#7919;&#7920;&#7921;Vv&#434;&#651;&#7804;&#7805;&#7806;&#7807;Ww&#372;&#373;&#7808;&#7809;&#7810;&#7811;&#7812;&#7813;&#7814;&#7815;&#7816;&#7817;&#7832;Xx&#7818;&#7819;&#7820;&#7821;Yy&#221;&#253;&#255;&#376;&#374;&#375;&#435;&#436;&#562;&#563;&#7822;&#7823;&#7833;&#7922;&#7923;&#7924;&#7925;&#7926;&#7927;&#7928;&#7929;Zz&#377;&#378;&#379;&#380;&#381;&#382;&#437;&#438;&#548;&#549;&#656;&#657;&#7824;&#7825;&#7826;&#7827;&#7828;&#7829;&#7829;'">
<!ENTITY uppercase "'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPQQQRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWWWWWWWXXXXXXYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZ'">
<!-- The following three entities are used for sorting and grouping
indexterms, not in presentation of them. -->
<!-- If @sortas is present, sort and group by combination of
@sortas, space and entry to keep it separate from other entries
with the same @sortas.
If @sortas is not present, the first item is empty, and the added space
is removed when normalize-space is applied, leaving just the entry -->
<!ENTITY primary 'normalize-space(concat(primary/@sortas, " ", primary))'>
<!ENTITY secondary 'normalize-space(concat(secondary/@sortas, " ", secondary))'>
<!ENTITY tertiary 'normalize-space(concat(tertiary/@sortas, " ", tertiary))'>
<!ENTITY section '(ancestor-or-self::set|ancestor-or-self::book|ancestor-or-self::part|ancestor-or-self::reference|ancestor-or-self::partintro|ancestor-or-self::chapter|ancestor-or-self::appendix|ancestor-or-self::preface|ancestor-or-self::article|ancestor-or-self::section|ancestor-or-self::sect1|ancestor-or-self::sect2|ancestor-or-self::sect3|ancestor-or-self::sect4|ancestor-or-self::sect5|ancestor-or-self::refentry|ancestor-or-self::refsect1|ancestor-or-self::refsect2|ancestor-or-self::refsect3|ancestor-or-self::simplesect|ancestor-or-self::bibliography|ancestor-or-self::glossary|ancestor-or-self::index|ancestor-or-self::webpage|ancestor-or-self::topic)[last()]'>
<!ENTITY section.id 'generate-id(&section;)'>
<!ENTITY sep '" "'>
<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))'>
<!ENTITY setup-language-variable '
<xsl:variable name="language" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:call-template name="l10n.language"/>
</xsl:variable>
<xsl:variable name="lowercase" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:call-template name="gentext">
<xsl:with-param name="key">normalize.sort.input</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="uppercase" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:call-template name="gentext">
<xsl:with-param name="key">normalize.sort.output</xsl:with-param>
</xsl:call-template>
</xsl:variable>
'>
<!-- Entity used in html/inline.xsl and fo/inline.xsl -->
<!ENTITY comment.block.parents "parent::answer|parent::appendix|parent::article|parent::bibliodiv|
parent::bibliography|parent::blockquote|parent::caution|parent::chapter|
parent::glossary|parent::glossdiv|parent::important|parent::index|
parent::indexdiv|parent::listitem|parent::note|parent::orderedlist|
parent::partintro|parent::preface|parent::procedure|parent::qandadiv|
parent::qandaset|parent::question|parent::refentry|parent::refnamediv|
parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection|
parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4|
parent::sect5|parent::section|parent::setindex|parent::sidebar|
parent::simplesect|parent::taskprerequisites|parent::taskrelated|
parent::tasksummary|parent::warning|parent::topic">

View File

@ -0,0 +1,839 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: gentext.xsl 9286 2012-04-19 10:10:58Z 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="*" mode="object.title.template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="chapter" mode="object.title.template">
<xsl:choose>
<xsl:when test="string($chapter.autolabel) != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="appendix" mode="object.title.template">
<xsl:choose>
<xsl:when test="string($appendix.autolabel) != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="part" mode="object.title.template">
<xsl:choose>
<xsl:when test="string($part.autolabel) != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section|sect1|sect2|sect3|sect4|sect5|simplesect
|bridgehead|topic"
mode="object.title.template">
<xsl:variable name="is.numbered">
<xsl:call-template name="label.this.section"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$is.numbered != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="procedure" mode="object.title.template">
<xsl:choose>
<xsl:when test="$formal.procedures != 0 and title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
<xsl:text>.formal</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.subtitle.template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'subtitle'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="is.autonumber">
<xsl:value-of select="'0'"/>
</xsl:template>
<xsl:template match="section|sect1|sect2|sect3|sect4|sect5"
mode="is.autonumber">
<xsl:call-template name="label.this.section"/>
</xsl:template>
<xsl:template match="figure|example|table|equation" mode="is.autonumber">
<xsl:value-of select="'1'"/>
</xsl:template>
<xsl:template match="appendix" mode="is.autonumber">
<xsl:value-of select="$appendix.autolabel"/>
</xsl:template>
<xsl:template match="chapter" mode="is.autonumber">
<xsl:value-of select="$chapter.autolabel"/>
</xsl:template>
<xsl:template match="part" mode="is.autonumber">
<xsl:value-of select="$part.autolabel"/>
</xsl:template>
<xsl:template match="preface" mode="is.autonumber">
<xsl:value-of select="$preface.autolabel"/>
</xsl:template>
<xsl:template match="question|answer" mode="is.autonumber">
<xsl:choose>
<xsl:when test="$qanda.defaultlabel = 'number'
and not(label)">
<xsl:value-of select="'1'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'0'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="qandadiv" mode="is.autonumber">
<xsl:value-of select="$qandadiv.autolabel"/>
</xsl:template>
<xsl:template match="bridgehead" mode="is.autonumber">
<xsl:value-of select="$section.autolabel"/>
</xsl:template>
<xsl:template match="procedure" mode="is.autonumber">
<xsl:value-of select="$formal.procedures"/>
</xsl:template>
<xsl:template match="*" mode="object.xref.template">
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<!-- Is autonumbering on? -->
<xsl:variable name="autonumber">
<xsl:apply-templates select="." mode="is.autonumber"/>
</xsl:variable>
<xsl:variable name="number-and-title-template">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'xref-number-and-title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="number-template">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'xref-number'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="context">
<xsl:choose>
<xsl:when test="self::equation and not(title) and not(info/title)">
<xsl:value-of select="'xref-number'"/>
</xsl:when>
<xsl:when test="string($autonumber) != 0
and $number-and-title-template != 0
and $xref.with.number.and.title != 0">
<xsl:value-of select="'xref-number-and-title'"/>
</xsl:when>
<xsl:when test="string($autonumber) != 0
and $number-template != 0">
<xsl:value-of select="'xref-number'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'xref'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="template">
<xsl:apply-templates select="." mode="object.title.template"/>
</xsl:variable>
<!--
<xsl:message>
<xsl:text>object.title.markup: </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="$template"/>
</xsl:message>
-->
<xsl:call-template name="substitute-markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="*" mode="object.title.markup.textonly">
<xsl:variable name="title">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:variable>
<xsl:value-of select="normalize-space($title)"/>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<!-- Just for consistency in template naming -->
<xsl:apply-templates select="." mode="titleabbrev.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.subtitle.markup">
<xsl:variable name="template">
<xsl:apply-templates select="." mode="object.subtitle.template"/>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.xref.markup">
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="template">
<xsl:choose>
<xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
<xsl:call-template name="make.gentext.template">
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
<xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="object.xref.template">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--
<xsl:message>
<xsl:text>object.xref.markup: </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text>(</xsl:text>
<xsl:value-of select="$xrefstyle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$purpose"/>
<xsl:text>)</xsl:text>
<xsl:text>: [</xsl:text>
<xsl:value-of select="$template"/>
<xsl:text>]</xsl:text>
</xsl:message>
-->
<xsl:if test="$template = '' and $verbose != 0">
<xsl:message>
<xsl:text>object.xref.markup: empty xref template</xsl:text>
<xsl:text> for linkend="</xsl:text>
<xsl:value-of select="@id|@xml:id"/>
<xsl:text>" and @xrefstyle="</xsl:text>
<xsl:value-of select="$xrefstyle"/>
<xsl:text>"</xsl:text>
</xsl:message>
</xsl:if>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="template" select="$template"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="listitem" mode="object.xref.markup">
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<xsl:when test="parent::orderedlist">
<xsl:variable name="template">
<xsl:apply-templates select="." mode="object.xref.template"/>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$verbose != 0">
<xsl:message>
<xsl:text>Xref is only supported to listitems in an</xsl:text>
<xsl:text> orderedlist: </xsl:text>
<xsl:value-of select=".//@id|.//@xml:id"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="question" mode="object.xref.markup">
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:variable name="deflabel">
<xsl:choose>
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
/@defaultlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="template">
<xsl:choose>
<!-- This avoids double Q: Q: in xref when defaultlabel=qanda -->
<xsl:when test="$deflabel = 'qanda' and not(label)">%n</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="object.xref.template">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="substitute-markup">
<xsl:param name="template" select="''"/>
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="title" select="''"/>
<xsl:param name="subtitle" select="''"/>
<xsl:param name="docname" select="''"/>
<xsl:param name="label" select="''"/>
<xsl:param name="pagenumber" select="''"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="verbose"/>
<xsl:choose>
<xsl:when test="contains($template, '%')">
<xsl:value-of select="substring-before($template, '%')"/>
<xsl:variable name="candidate"
select="substring(substring-after($template, '%'), 1, 1)"/>
<xsl:choose>
<xsl:when test="$candidate = 't'">
<xsl:apply-templates select="." mode="insert.title.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="title">
<xsl:choose>
<xsl:when test="$title != ''">
<xsl:copy-of select="$title"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 's'">
<xsl:apply-templates select="." mode="insert.subtitle.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="subtitle">
<xsl:choose>
<xsl:when test="$subtitle != ''">
<xsl:copy-of select="$subtitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'n'">
<xsl:apply-templates select="." mode="insert.label.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="label">
<xsl:choose>
<xsl:when test="$label != ''">
<xsl:copy-of select="$label"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'p'">
<xsl:apply-templates select="." mode="insert.pagenumber.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="pagenumber">
<xsl:choose>
<xsl:when test="$pagenumber != ''">
<xsl:copy-of select="$pagenumber"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="pagenumber.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'o'">
<!-- olink target document title -->
<xsl:apply-templates select="." mode="insert.olink.docname.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="docname">
<xsl:choose>
<xsl:when test="$docname != ''">
<xsl:copy-of select="$docname"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="olink.docname.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'd'">
<xsl:apply-templates select="." mode="insert.direction.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="direction">
<xsl:choose>
<xsl:when test="$referrer">
<xsl:variable name="referent-is-below">
<xsl:for-each select="preceding::xref">
<xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$referent-is-below = ''">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'above'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'below'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = '%' ">
<xsl:text>%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
<!-- recurse with the rest of the template string -->
<xsl:variable name="rest"
select="substring($template,
string-length(substring-before($template, '%'))+3)"/>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$rest"/>
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="title" select="$title"/>
<xsl:with-param name="subtitle" select="$subtitle"/>
<xsl:with-param name="docname" select="$docname"/>
<xsl:with-param name="label" select="$label"/>
<xsl:with-param name="pagenumber" select="$pagenumber"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$template"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="make.gentext.template">
<xsl:param name="xrefstyle" select="''"/>
<xsl:param name="purpose"/>
<xsl:param name="referrer"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:param name="target.elem" select="local-name(.)"/>
<!-- parse xrefstyle to get parts -->
<xsl:variable name="parts"
select="substring-after(normalize-space($xrefstyle), 'select:')"/>
<xsl:variable name="labeltype">
<xsl:choose>
<xsl:when test="contains($parts, 'labelnumber')">
<xsl:text>labelnumber</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'labelname')">
<xsl:text>labelname</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'label')">
<xsl:text>label</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="titletype">
<xsl:choose>
<xsl:when test="contains($parts, 'quotedtitle')">
<xsl:text>quotedtitle</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'title')">
<xsl:text>title</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pagetype">
<xsl:choose>
<xsl:when test="$insert.olink.page.number = 'no' and
local-name($referrer) = 'olink'">
<!-- suppress page numbers -->
</xsl:when>
<xsl:when test="$insert.xref.page.number = 'no' and
local-name($referrer) != 'olink'">
<!-- suppress page numbers -->
</xsl:when>
<xsl:when test="contains($parts, 'nopage')">
<xsl:text>nopage</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'pagenumber')">
<xsl:text>pagenumber</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'pageabbrev')">
<xsl:text>pageabbrev</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'Page')">
<xsl:text>Page</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'page')">
<xsl:text>page</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="docnametype">
<xsl:choose>
<xsl:when test="($olink.doctitle = 0 or
$olink.doctitle = 'no') and
local-name($referrer) = 'olink'">
<!-- suppress docname -->
</xsl:when>
<xsl:when test="contains($parts, 'nodocname')">
<xsl:text>nodocname</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'docnamelong')">
<xsl:text>docnamelong</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'docname')">
<xsl:text>docname</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="$labeltype != ''">
<xsl:choose>
<xsl:when test="$labeltype = 'labelname'">
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="local-name($referrer) = 'olink'">
<xsl:value-of select="$target.elem"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$labeltype = 'labelnumber'">
<xsl:text>%n</xsl:text>
</xsl:when>
<xsl:when test="$labeltype = 'label'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref-number'"/>
<xsl:with-param name="name">
<xsl:choose>
<xsl:when test="local-name($referrer) = 'olink'">
<xsl:value-of select="$target.elem"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="xpath.location"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="$titletype != ''">
<xsl:value-of select="$xref.label-title.separator"/>
</xsl:when>
<xsl:when test="$pagetype != '' and $pagetype != 'nopage'">
<xsl:value-of select="$xref.label-page.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="$titletype != ''">
<xsl:choose>
<xsl:when test="$titletype = 'title'">
<xsl:text>%t</xsl:text>
</xsl:when>
<xsl:when test="$titletype = 'quotedtitle'">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat" select="'startquote'"/>
</xsl:call-template>
<xsl:text>%t</xsl:text>
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat" select="'endquote'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="$pagetype != '' and $pagetype != 'nopage'">
<xsl:value-of select="$xref.title-page.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- special case: use regular xref template if just turning off page -->
<xsl:if test="($pagetype = 'nopage' or $docnametype = 'nodocname')
and local-name($referrer) != 'olink'
and $labeltype = ''
and $titletype = ''">
<xsl:apply-templates select="." mode="object.xref.template">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="$pagetype != ''">
<xsl:choose>
<xsl:when test="$pagetype = 'page'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'page'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pagetype = 'Page'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'Page'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pagetype = 'pageabbrev'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'pageabbrev'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pagetype = 'pagenumber'">
<xsl:text>%p</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- Add reference to other document title -->
<xsl:if test="$docnametype != '' and local-name($referrer) = 'olink'">
<!-- Any separator should be in the gentext template -->
<xsl:choose>
<xsl:when test="$docnametype = 'docnamelong'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'docnamelong'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$docnametype = 'docname'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'docname'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

64
build/xsl/common/l10n.dtd Normal file
View File

@ -0,0 +1,64 @@
<!ENTITY % prefix "l">
<!ENTITY % xmlns "xmlns:%prefix;">
<!ENTITY % uri "'http://docbook.sourceforge.net/xmlns/l10n/1.0'">
<!ENTITY % i18n "%prefix;:i18n">
<!ENTITY % l10n "%prefix;:l10n">
<!ENTITY % gentext "%prefix;:gentext">
<!ENTITY % dingbat "%prefix;:dingbat">
<!ENTITY % context "%prefix;:context">
<!ENTITY % template "%prefix;:template">
<!ENTITY % letters "%prefix;:letters">
<!ENTITY % l "%prefix;:l">
<!ENTITY % lang "lang NMTOKEN #IMPLIED">
<!ELEMENT %i18n; ((%l10n;)+)>
<!ATTLIST %i18n;
%xmlns; CDATA #FIXED %uri;
>
<!ELEMENT %l10n; (%gentext;|%dingbat;|%context;|%letters;)*>
<!ATTLIST %l10n;
%xmlns; CDATA #FIXED %uri;
language CDATA #REQUIRED
english-language-name CDATA #IMPLIED
href CDATA #IMPLIED
>
<!ELEMENT %gentext; EMPTY>
<!ATTLIST %gentext;
%lang;
key CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT %dingbat; EMPTY>
<!ATTLIST %dingbat;
%lang;
key CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT %context; ((%template;)+)>
<!ATTLIST %context;
name CDATA #REQUIRED
>
<!ELEMENT %template; EMPTY>
<!ATTLIST %template;
%lang;
name CDATA #REQUIRED
text CDATA #REQUIRED
style CDATA #IMPLIED
>
<!ELEMENT %letters; ((%l;)+)>
<!ATTLIST %letters;
%lang;
>
<!ELEMENT %l; (#PCDATA)>
<!ATTLIST %l;
i CDATA #REQUIRED
>

77
build/xsl/common/l10n.xml Normal file
View File

@ -0,0 +1,77 @@
<?xml version='1.0'?>
<!DOCTYPE l:i18n SYSTEM "l10n.dtd">
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="af" href="af.xml"/>
<l:l10n language="am" href="am.xml"/>
<l:l10n language="ar" href="ar.xml"/>
<l:l10n language="as" href="as.xml"/>
<l:l10n language="ast" href="ast.xml"/>
<l:l10n language="az" href="az.xml"/>
<l:l10n language="bg" href="bg.xml"/>
<l:l10n language="bn" href="bn.xml"/>
<l:l10n language="bn_in" href="bn_in.xml"/>
<l:l10n language="bs" href="bs.xml"/>
<l:l10n language="ca" href="ca.xml"/>
<l:l10n language="cs" href="cs.xml"/>
<l:l10n language="cy" href="cy.xml"/>
<l:l10n language="da" href="da.xml"/>
<l:l10n language="de" href="de.xml"/>
<l:l10n language="el" href="el.xml"/>
<l:l10n language="en" href="en.xml"/>
<l:l10n language="eo" href="eo.xml"/>
<l:l10n language="es" href="es.xml"/>
<l:l10n language="et" href="et.xml"/>
<l:l10n language="eu" href="eu.xml"/>
<l:l10n language="fa" href="fa.xml"/>
<l:l10n language="fi" href="fi.xml"/>
<l:l10n language="fr" href="fr.xml"/>
<l:l10n language="ga" href="ga.xml"/>
<l:l10n language="gl" href="gl.xml"/>
<l:l10n language="gu" href="gu.xml"/>
<l:l10n language="he" href="he.xml"/>
<l:l10n language="hi" href="hi.xml"/>
<l:l10n language="hr" href="hr.xml"/>
<l:l10n language="hu" href="hu.xml"/>
<l:l10n language="id" href="id.xml"/>
<l:l10n language="is" href="is.xml"/>
<l:l10n language="it" href="it.xml"/>
<l:l10n language="ja" href="ja.xml"/>
<l:l10n language="ka" href="ka.xml"/>
<l:l10n language="kn" href="kn.xml"/>
<l:l10n language="ko" href="ko.xml"/>
<l:l10n language="ky" href="ky.xml"/>
<l:l10n language="la" href="la.xml"/>
<l:l10n language="lt" href="lt.xml"/>
<l:l10n language="lv" href="lv.xml"/>
<l:l10n language="ml" href="ml.xml"/>
<l:l10n language="mn" href="mn.xml"/>
<l:l10n language="mr" href="mr.xml"/>
<l:l10n language="nb" href="nb.xml"/>
<l:l10n language="nds" href="nds.xml"/>
<l:l10n language="nl" href="nl.xml"/>
<l:l10n language="nn" href="nn.xml"/>
<l:l10n language="or" href="or.xml"/>
<l:l10n language="pa" href="pa.xml"/>
<l:l10n language="pl" href="pl.xml"/>
<l:l10n language="pt" href="pt.xml"/>
<l:l10n language="pt_br" href="pt_br.xml"/>
<l:l10n language="ro" href="ro.xml"/>
<l:l10n language="ru" href="ru.xml"/>
<l:l10n language="sk" href="sk.xml"/>
<l:l10n language="sl" href="sl.xml"/>
<l:l10n language="sq" href="sq.xml"/>
<l:l10n language="sr" href="sr.xml"/>
<l:l10n language="sr_latn" href="sr_Latn.xml"/>
<l:l10n language="sv" href="sv.xml"/>
<l:l10n language="ta" href="ta.xml"/>
<l:l10n language="te" href="te.xml"/>
<l:l10n language="th" href="th.xml"/>
<l:l10n language="tl" href="tl.xml"/>
<l:l10n language="tr" href="tr.xml"/>
<l:l10n language="uk" href="uk.xml"/>
<l:l10n language="vi" href="vi.xml"/>
<l:l10n language="xh" href="xh.xml"/>
<l:l10n language="zh" href="zh.xml"/>
<l:l10n language="zh_cn" href="zh_cn.xml"/>
<l:l10n language="zh_tw" href="zh_tw.xml"/>
</l:i18n>

593
build/xsl/common/l10n.xsl Normal file
View File

@ -0,0 +1,593 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
exclude-result-prefixes="l"
version='1.0'>
<!-- ********************************************************************
$Id: l10n.xsl 8904 2010-09-11 01:56:22Z kosek $
********************************************************************
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 localization templates (for internationalization)
******************************************************************** -->
<xsl:param name="l10n.xml" select="document('../common/l10n.xml')"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
<xsl:param name="empty.local.l10n.xml" select="not($local.l10n.xml//l:l10n)"/>
<xsl:key name="l10n-lang" match="l:l10n" use="@language"/>
<xsl:key name="l10n-gentext" match="l:l10n/l:gentext" use="@key"/>
<xsl:key name="l10n-dingbat" match="l:l10n/l:dingbat" use="@key"/>
<xsl:key name="l10n-context" match="l:l10n/l:context" use="@name"/>
<xsl:key name="l10n-template" match="l:l10n/l:context/l:template[not(@style)]" use="concat(../@name, '#', @name)"/>
<xsl:key name="l10n-template-style" match="l:l10n/l:context/l:template[@style]" use="concat(../@name, '#', @name, '#', @style)"/>
<xsl:template name="l10n.language">
<xsl:param name="target" select="."/>
<xsl:param name="xref-context" select="false()"/>
<xsl:variable name="mc-language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:when test="$xref-context or $l10n.gentext.use.xref.language != 0">
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$target/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$target/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="language" select="translate($mc-language,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ-',
'abcdefghijklmnopqrstuvwxyz_')"/>
<xsl:for-each select="$l10n.xml"> <!-- We need to change context in order to get key work -->
<xsl:choose>
<xsl:when test="key('l10n-lang', $language)">
<xsl:value-of select="$language"/>
</xsl:when>
<!-- try just the lang code without country -->
<xsl:when test="key('l10n-lang', substring-before($language,'_'))">
<xsl:value-of select="substring-before($language,'_')"/>
</xsl:when>
<!-- or use the default -->
<xsl:otherwise>
<xsl:message>
<xsl:text>No localization exists for "</xsl:text>
<xsl:value-of select="$language"/>
<xsl:text>" or "</xsl:text>
<xsl:value-of select="substring-before($language,'_')"/>
<xsl:text>". Using default "</xsl:text>
<xsl:value-of select="$l10n.gentext.default.language"/>
<xsl:text>".</xsl:text>
</xsl:message>
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="l10n.language.name">
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:for-each select="$l10n.xml">
<xsl:value-of
select="document(key('l10n-lang', $lang)/@href)/l:l10n/@english-language-name"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="language.attribute">
<xsl:param name="node" select="."/>
<xsl:variable name="language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$node/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$language != ''">
<xsl:attribute name="lang">
<xsl:choose>
<xsl:when test="$l10n.lang.value.rfc.compliant != 0">
<xsl:value-of select="translate($language, '_', '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<!-- FIXME: This is sort of hack, but it was the easiest way to add at least partial support for dir attribute -->
<xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
</xsl:template>
<!-- Duplication of language.attribute template to allow for xml:lang attribute
creation for XHTML 1.1 and epub target -->
<xsl:template name="xml.language.attribute">
<xsl:param name="node" select="."/>
<xsl:variable name="language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$node/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$language != ''">
<xsl:attribute name="xml:lang">
<xsl:choose>
<xsl:when test="$l10n.lang.value.rfc.compliant != 0">
<xsl:value-of select="translate($language, '_', '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<!-- FIXME: This is sort of hack, but it was the easiest way to add at least partial support for dir attribute -->
<xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
</xsl:template>
<xsl:template name="gentext">
<xsl:param name="key" select="local-name(.)"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="local.l10n.gentext"
select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:gentext[@key=$key])[1]"/>
<xsl:variable name="l10n.gentext"
select="key('l10n-gentext', $key)[1]"/>
<xsl:choose>
<xsl:when test="$local.l10n.gentext">
<xsl:value-of select="$local.l10n.gentext/@text"/>
</xsl:when>
<xsl:when test="$l10n.gentext">
<xsl:value-of select="$l10n.gentext/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization of "</xsl:text>
<xsl:value-of select="$key"/>
<xsl:text>" exists</xsl:text>
<xsl:choose>
<xsl:when test="$lang = 'en'">
<xsl:text>.</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>; using "en".</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:message>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', 'en')/@href)">
<xsl:value-of select="key('l10n-gentext', $key)[1]/@text"/>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="gentext.element.name">
<xsl:param name="element.name" select="local-name(.)"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="$element.name"/>
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.space">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template name="gentext.edited.by">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Editedby'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.by">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'by'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.dingbat">
<xsl:param name="dingbat">bullet</xsl:param>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="local.l10n.dingbat"
select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:dingbat[@key=$dingbat])[1]"/>
<xsl:variable name="l10n.dingbat"
select="key('l10n-dingbat', $dingbat)[1]"/>
<xsl:choose>
<xsl:when test="$local.l10n.dingbat">
<xsl:value-of select="$local.l10n.dingbat/@text"/>
</xsl:when>
<xsl:when test="$l10n.dingbat">
<xsl:value-of select="$l10n.dingbat/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization of dingbat </xsl:text>
<xsl:value-of select="$dingbat"/>
<xsl:text> exists; using "en".</xsl:text>
</xsl:message>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', 'en')/@href)">
<xsl:value-of select="key('l10n-dingbat', $dingbat)[1]/@text"/>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="gentext.startquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">startquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.endquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">endquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nestedstartquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">nestedstartquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nestedendquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">nestedendquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.prev">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-prev'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.next">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-next'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.home">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-home'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.up">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-up'"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="gentext.template">
<xsl:param name="context" select="'default'"/>
<xsl:param name="name" select="'default'"/>
<xsl:param name="origname" select="$name"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<xsl:when test="$empty.local.l10n.xml">
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="localization.node"
select="key('l10n-lang', $lang)[1]"/>
<xsl:if test="count($localization.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization exists.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:variable name="context.node"
select="key('l10n-context', $context)[1]"/>
<xsl:if test="count($context.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" exists in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:for-each select="$context.node">
<xsl:variable name="template.node"
select="(key('l10n-template-style', concat($context, '#', $name, '#', $xrefstyle))
|key('l10n-template', concat($context, '#', $name)))[1]"/>
<xsl:choose>
<xsl:when test="$template.node/@text">
<xsl:value-of select="$template.node/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($name, '/')">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="substring-after($name, '/')"/>
<xsl:with-param name="origname" select="$origname"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$verbose = 0">
<!-- silence -->
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No template for "</xsl:text>
<xsl:value-of select="$origname"/>
<xsl:text>" (or any of its leaves) exists in the context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="local.localization.node"
select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang])[1]"/>
<xsl:variable name="localization.node"
select="key('l10n-lang', $lang)[1]"/>
<xsl:if test="count($localization.node) = 0
and count($local.localization.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization exists.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:variable name="local.context.node"
select="$local.localization.node/l:context[@name=$context]"/>
<xsl:variable name="context.node"
select="key('l10n-context', $context)[1]"/>
<xsl:if test="count($context.node) = 0
and count($local.context.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" exists in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:variable name="local.template.node"
select="($local.context.node/l:template[@name=$name
and @style
and @style=$xrefstyle]
|$local.context.node/l:template[@name=$name
and not(@style)])[1]"/>
<xsl:for-each select="$context.node">
<xsl:variable name="template.node"
select="(key('l10n-template-style', concat($context, '#', $name, '#', $xrefstyle))
|key('l10n-template', concat($context, '#', $name)))[1]"/>
<xsl:choose>
<xsl:when test="$local.template.node/@text">
<xsl:value-of select="$local.template.node/@text"/>
</xsl:when>
<xsl:when test="$template.node/@text">
<xsl:value-of select="$template.node/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($name, '/')">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="substring-after($name, '/')"/>
<xsl:with-param name="origname" select="$origname"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$verbose = 0">
<!-- silence -->
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No template for "</xsl:text>
<xsl:value-of select="$origname"/>
<xsl:text>" (or any of its leaves) exists in the context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- silently test if a gentext template exists -->
<xsl:template name="gentext.template.exists">
<xsl:param name="context" select="'default'"/>
<xsl:param name="name" select="'default'"/>
<xsl:param name="origname" select="$name"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:variable name="template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="origname" select="$origname"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="verbose" select="0"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($template) != 0">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

903
build/xsl/common/labels.xsl Normal file
View File

@ -0,0 +1,903 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: labels.xsl 9286 2012-04-19 10:10:58Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- label markup -->
<doc:mode mode="label.markup" xmlns="">
<refpurpose>Provides access to element labels</refpurpose>
<refdescription id="label.markup-desc">
<para>Processing an element in the
<literal role="mode">label.markup</literal> mode produces the
element label.</para>
<para>Trailing punctuation is not added to the label.
</para>
</refdescription>
</doc:mode>
<xsl:template match="*" mode="intralabel.punctuation">
<xsl:text>.</xsl:text>
</xsl:template>
<xsl:template match="*" mode="label.markup">
<xsl:param name="verbose" select="1"/>
<xsl:if test="$verbose">
<xsl:message>
<xsl:text>Request for label of unexpected element: </xsl:text>
<xsl:value-of select="local-name(.)"/>
</xsl:message>
</xsl:if>
</xsl:template>
<xsl:template match="set|book" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="part" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($part.autolabel) != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$part.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number from="book" count="part" format="{$format}"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="partintro" mode="label.markup">
<!-- no label -->
</xsl:template>
<xsl:template match="preface" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($preface.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$preface.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="preface" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book" count="preface" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="chapter" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($chapter.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$chapter.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="chapter" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book" count="chapter" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="appendix" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($appendix.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$appendix.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="appendix" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book|article"
count="appendix" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="article" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="dedication|colophon" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="reference" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($reference.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$reference.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="reference" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book" count="reference" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="refentry" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="section" mode="label.markup">
<!-- if this is a nested section, label the parent -->
<xsl:if test="local-name(..) = 'section'">
<xsl:variable name="parent.section.label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select=".."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$parent.section.label != '0'">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<!-- if the parent is a component, maybe label that too -->
<xsl:variable name="parent.is.component">
<xsl:call-template name="is.component">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>
<!-- does this section get labelled? -->
<xsl:variable name="label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$section.label.includes.component.label != 0
and $parent.is.component != 0">
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<!--
<xsl:message>
test: <xsl:value-of select="$label"/>, <xsl:number count="section"/>
</xsl:message>
-->
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$label != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number format="{$format}" count="section"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="sect1" mode="label.markup">
<!-- if the parent is a component, maybe label that too -->
<xsl:variable name="parent.is.component">
<xsl:call-template name="is.component">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="component.label">
<xsl:if test="$section.label.includes.component.label != 0
and $parent.is.component != 0">
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:variable name="is.numbered">
<xsl:call-template name="label.this.section"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$is.numbered != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="$component.label"/>
<xsl:number format="{$format}" count="sect1"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="sect2|sect3|sect4|sect5" mode="label.markup">
<!-- label the parent -->
<xsl:variable name="parent.section.label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select=".."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$parent.section.label != '0'">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:variable name="is.numbered">
<xsl:call-template name="label.this.section"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$is.numbered != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(.) = 'sect2'">
<xsl:number format="{$format}" count="sect2"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect3'">
<xsl:number format="{$format}" count="sect3"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect4'">
<xsl:number format="{$format}" count="sect4"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect5'">
<xsl:number format="{$format}" count="sect5"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>label.markup: this can't happen!</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="bridgehead" mode="label.markup">
<!-- FIXME: could we do a better job here? -->
<xsl:variable name="contsec"
select="(ancestor::section
|ancestor::simplesect
|ancestor::topic
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3
|ancestor::chapter
|ancestor::appendix
|ancestor::preface)[last()]"/>
<xsl:apply-templates select="$contsec" mode="label.markup"/>
</xsl:template>
<xsl:template match="refsect1" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$section.autolabel != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number count="refsect1" format="{$format}"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="refsect2|refsect3" mode="label.markup">
<!-- label the parent -->
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$section.autolabel != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(.) = 'refsect2'">
<xsl:number count="refsect2" format="{$format}"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="refsect3" format="{$format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="simplesect" mode="label.markup">
<!-- if this is a nested section, label the parent -->
<xsl:if test="local-name(..) = 'section'
or local-name(..) = 'sect1'
or local-name(..) = 'sect2'
or local-name(..) = 'sect3'
or local-name(..) = 'sect4'
or local-name(..) = 'sect5'">
<xsl:variable name="parent.section.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.section.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<!-- if the parent is a component, maybe label that too -->
<xsl:variable name="parent.is.component">
<xsl:call-template name="is.component">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>
<!-- does this section get labelled? -->
<xsl:variable name="label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$section.label.includes.component.label != 0
and $parent.is.component != 0">
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$label != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number format="{$format}" count="simplesect"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="topic" mode="label.markup">
<!-- topics are not numbered by default -->
</xsl:template>
<xsl:template match="qandadiv" mode="label.markup">
<xsl:variable name="lparent" select="(ancestor::set
|ancestor::book
|ancestor::chapter
|ancestor::appendix
|ancestor::preface
|ancestor::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3)[last()]"/>
<xsl:variable name="lparent.prefix">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
</xsl:variable>
<xsl:variable name="prefix">
<xsl:if test="$qanda.inherit.numeration != 0">
<xsl:if test="$lparent.prefix != ''">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
<xsl:apply-templates select="$lparent" mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$qandadiv.autolabel != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$qandadiv.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandadiv" format="{$format}"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="question|answer" mode="label.markup">
<xsl:variable name="lparent" select="(ancestor::set
|ancestor::book
|ancestor::chapter
|ancestor::appendix
|ancestor::preface
|ancestor::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3)[last()]"/>
<xsl:variable name="lparent.prefix">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
</xsl:variable>
<xsl:variable name="prefix">
<xsl:if test="$qanda.inherit.numeration != 0">
<xsl:choose>
<xsl:when test="ancestor::qandadiv">
<xsl:variable name="div.label">
<xsl:apply-templates select="ancestor::qandadiv[1]" mode="label.markup"/>
</xsl:variable>
<xsl:if test="string-length($div.label) != 0">
<xsl:copy-of select="$div.label"/>
<xsl:apply-templates select="ancestor::qandadiv[1]"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:when>
<xsl:when test="$lparent.prefix != ''">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
<xsl:apply-templates select="$lparent" mode="intralabel.punctuation"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="inhlabel"
select="ancestor-or-self::qandaset/@defaultlabel[1]"/>
<xsl:variable name="deflabel">
<xsl:choose>
<xsl:when test="$inhlabel != ''">
<xsl:value-of select="$inhlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="label" select="label"/>
<xsl:choose>
<xsl:when test="count($label)>0">
<xsl:apply-templates select="$label"/>
</xsl:when>
<xsl:when test="$deflabel = 'qanda' and self::question">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Question'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$deflabel = 'qanda' and self::answer">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Answer'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="($deflabel = 'qnumber' or
$deflabel = 'qnumberanda') and self::question">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Question'"/>
</xsl:call-template>
<xsl:text>&#xA0;</xsl:text>
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandaentry" format="1"/>
</xsl:when>
<xsl:when test="$deflabel = 'qnumberanda' and self::answer">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Answer'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$deflabel = 'number' and self::question">
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandaentry" format="1"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="bibliography|glossary|
qandaset|index|setindex" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="figure|table|example" mode="label.markup">
<xsl:variable name="pchap"
select="(ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book])[last()]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) &gt; 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
<xsl:number format="1" from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number format="1" from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="procedure" mode="label.markup">
<xsl:variable name="pchap"
select="ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) &gt; 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$formal.procedures = 0">
<!-- No label -->
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count($pchap)>0">
<xsl:if test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
</xsl:if>
<xsl:number count="procedure[title]" format="1"
from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="procedure[title]" format="1"
from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="equation" mode="label.markup">
<xsl:variable name="pchap"
select="ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) &gt; 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count($pchap)>0">
<xsl:if test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
</xsl:if>
<xsl:number format="1" count="equation"
from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number format="1" count="equation"
from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="orderedlist/listitem" mode="label.markup">
<xsl:variable name="numeration">
<xsl:call-template name="list.numeration">
<xsl:with-param name="node" select="parent::orderedlist"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="$numeration='arabic'">1</xsl:when>
<xsl:when test="$numeration='loweralpha'">a</xsl:when>
<xsl:when test="$numeration='lowerroman'">i</xsl:when>
<xsl:when test="$numeration='upperalpha'">A</xsl:when>
<xsl:when test="$numeration='upperroman'">I</xsl:when>
<!-- What!? This should never happen -->
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected numeration: </xsl:text>
<xsl:value-of select="$numeration"/>
</xsl:message>
<xsl:value-of select="1."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="item-number">
<xsl:call-template name="orderedlist-item-number"/>
</xsl:variable>
<xsl:number value="$item-number" format="{$type}"/>
</xsl:template>
<xsl:template match="abstract" mode="label.markup">
<!-- nop -->
</xsl:template>
<xsl:template match="sidebar" mode="label.markup">
<!-- nop -->
</xsl:template>
<xsl:template match="glossdiv|glosslist" mode="label.markup">
<!-- nop -->
</xsl:template>
<xsl:template match="glossentry" mode="label.markup">
<!-- nop -->
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="label.this.section">
<xsl:param name="section" select="."/>
<xsl:variable name="level">
<xsl:call-template name="section.level"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$level &lt;= $section.autolabel.max.depth">
<xsl:value-of select="$section.autolabel"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<doc:template name="label.this.section" xmlns="">
<refpurpose>Returns true if $section should be labelled</refpurpose>
<refdescription id="label.this.section-desc">
<para>Returns true if the specified section should be labelled.
By default, this template returns zero unless
the section level is less than or equal to the value of the
<literal>$section.autolabel.max.depth</literal> parameter, in
which case it returns
<literal>$section.autolabel</literal>.
Custom stylesheets may override it to get more selective behavior.</para>
</refdescription>
</doc:template>
<!-- ============================================================ -->
<xsl:template name="default.autolabel.format">
<xsl:param name="context" select="."/>
<xsl:choose>
<xsl:when test="local-name($context) = 'appendix'">
<xsl:value-of select="'A'"/>
</xsl:when>
<xsl:when test="local-name($context) = 'part'">
<xsl:value-of select="'I'"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="autolabel.format">
<xsl:param name="context" select="."/>
<xsl:param name="format"/>
<xsl:choose>
<xsl:when test="string($format) != 0">
<xsl:choose>
<xsl:when test="string($format)='arabic' or $format='1'">1</xsl:when>
<xsl:when test="$format='loweralpha' or $format='a'">
<xsl:value-of select="'a'"/>
</xsl:when>
<xsl:when test="$format='lowerroman' or $format='i'">
<xsl:value-of select="'i'"/>
</xsl:when>
<xsl:when test="$format='upperalpha' or $format='A'">
<xsl:value-of select="'A'"/>
</xsl:when>
<xsl:when test="$format='upperroman' or $format='I'">
<xsl:value-of select="'I'"/>
</xsl:when>
<xsl:when test="$format='arabicindic' or $format='&#x661;'">
<xsl:value-of select="'&#x661;'"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected </xsl:text><xsl:value-of select="local-name(.)"/><xsl:text>.autolabel value: </xsl:text>
<xsl:value-of select="$format"/><xsl:text>; using default.</xsl:text>
</xsl:message>
<xsl:call-template name="default.autolabel.format"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<doc:template name="autolabel.format" xmlns="">
<refpurpose>Returns format for autolabel parameters</refpurpose>
<refdescription id="autolabel.format-desc">
<para>Returns format passed as parameter if non zero. Supported
format are 'arabic' or '1', 'loweralpha' or 'a', 'lowerroman' or 'i',
'upperlapha' or 'A', 'upperroman' or 'I', 'arabicindic' or '&#x661;'.
If its not one of these then
returns the default format.</para>
</refdescription>
</doc:template>
<!-- ============================================================ -->
</xsl:stylesheet>

1232
build/xsl/common/olink.xsl Normal file

File diff suppressed because it is too large Load Diff

346
build/xsl/common/pi.xsl Normal file
View File

@ -0,0 +1,346 @@
<?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:date="http://exslt.org/dates-and-times"
xmlns:exsl="http://exslt.org/common"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="doc date exsl"
extension-element-prefixes="date exsl"
version='1.0'>
<!-- ********************************************************************
$Id: pi.xsl 8782 2010-07-27 21:15:17Z mzjn $
********************************************************************
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.
******************************************************************** -->
<doc:reference xmlns=""><info><title>Common Processing Instruction Reference</title>
<releaseinfo role="meta">
$Id: pi.xsl 8782 2010-07-27 21:15:17Z mzjn $
</releaseinfo>
</info>
<partintro id="partintro">
<title>Introduction</title>
<para>This is generated reference documentation for all
user-specifiable processing instructions (PIs) in the
“common” part of the DocBook XSL stylesheets.
<note>
<para>You add these PIs at particular points in a document to
cause specific “exceptions” to formatting/output behavior. To
make global changes in formatting/output behavior across an
entire document, its better to do it by setting an
appropriate stylesheet parameter (if there is one).</para>
</note>
</para>
</partintro>
</doc:reference>
<!-- ==================================================================== -->
<doc:pi name="dbchoice_choice" xmlns="">
<refpurpose>Generates a localized choice separator</refpurpose>
<refdescription id="select.choice.separator-desc">
<para>Use the <tag class="xmlpi">dbchoice choice</tag> PI to
generate an appropriate localized “choice” separator (for
example, <literal>and</literal> or <literal>or</literal>)
before the final item in an inline <tag>simplelist</tag></para>
<warning>
<para>This PI is a less-than-ideal hack; support for it may
disappear in the future (particularly if and when a more
appropriate means for marking up "choice" lists becomes
available in DocBook).</para>
</warning>
</refdescription>
<refsynopsisdiv>
<synopsis><tag class="xmlpi">dbchoice choice="and"|"or"|<replaceable>string</replaceable>"</tag></synopsis>
</refsynopsisdiv>
<refparameter>
<variablelist>
<varlistentry><term>choice="and"</term>
<listitem>
<para>generates a localized <literal>and</literal> separator</para>
</listitem>
</varlistentry>
<varlistentry><term>choice="or"</term>
<listitem>
<para>generates a localized <literal>or</literal> separator</para>
</listitem>
</varlistentry>
<varlistentry><term>choice="<replaceable>string</replaceable>"</term>
<listitem>
<para>generates a literal <replaceable>string</replaceable> separator</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
</doc:pi>
<xsl:template name="pi.dbchoice_choice">
<xsl:param name="node" select="."/>
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="$node/processing-instruction('dbchoice')"/>
<xsl:with-param name="attribute">choice</xsl:with-param>
</xsl:call-template>
</xsl:template>
<doc:pi name="dbtimestamp" xmlns="">
<refpurpose>Inserts a date timestamp</refpurpose>
<refdescription>
<para>Use the <tag class="xmlpi">dbtimestamp</tag> PI at any point in a
source document to cause a date timestamp (a formatted
string representing the current date and time) to be
inserted in output of the document.</para>
</refdescription>
<refsynopsisdiv>
<synopsis><tag class="xmlpi">dbtimestamp format="<replaceable>formatstring</replaceable>" [padding="0"|"1"]</tag></synopsis>
</refsynopsisdiv>
<refparameter>
<variablelist>
<varlistentry><term>format="<replaceable>formatstring</replaceable>"</term>
<listitem>
<para>Specifies format in which the date and time are
output</para>
<note>
<para>For details of the content of the format string,
see <link role="tcg" xlink:href="Datetime.html"
>Date and time</link>.</para>
</note>
</listitem>
</varlistentry>
<varlistentry><term>padding="0"|"1"</term>
<listitem>
<para>Specifies padding behavior; if non-zero, padding is is added</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
</doc:pi>
<xsl:template name="pi.dbtimestamp">
<xsl:variable name="format">
<xsl:variable name="pi-format">
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="."/>
<xsl:with-param name="attribute">format</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$pi-format != ''">
<xsl:value-of select="$pi-format"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime'"/>
<xsl:with-param name="name" select="'format'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="padding">
<xsl:variable name="pi-padding">
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="."/>
<xsl:with-param name="attribute">padding</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$pi-padding != ''">
<xsl:value-of select="$pi-padding"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="date">
<xsl:choose>
<xsl:when test="function-available('date:date-time')">
<xsl:value-of select="date:date-time()"/>
</xsl:when>
<xsl:when test="function-available('date:dateTime')">
<!-- Xalan quirk -->
<xsl:value-of select="date:dateTime()"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="function-available('date:date-time') or
function-available('date:dateTime')">
<xsl:call-template name="datetime.format">
<xsl:with-param name="date" select="$date"/>
<xsl:with-param name="format" select="$format"/>
<xsl:with-param name="padding" select="$padding"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Timestamp processing requires XSLT processor with EXSLT date support.
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<doc:pi name="dbtex_delims" xmlns="">
<refpurpose>Generates delimiters around embedded TeX equations
in output</refpurpose>
<refdescription>
<para>Use the <tag class="xmlpi">dbtex delims</tag> PI as a
child of a <tag>textobject</tag> containing embedded TeX
markup, to cause that markup to be surrounded by
<literal>$</literal> delimiter characters in output.</para>
<warning>
<para>This feature is useful for print/PDF output only if you
use the obsolete and now unsupported PassiveTeX XSL-FO
engine.</para>
</warning>
</refdescription>
<refsynopsisdiv>
<synopsis><tag class="xmlpi">dbtex delims="no"|"yes"</tag></synopsis>
</refsynopsisdiv>
<refparameter>
<variablelist>
<varlistentry><term>dbtex delims="no"|"yes"</term>
<listitem>
<para>Specifies whether delimiters are output</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
<refsee role="params">
<para><parameter>tex.math.delims</parameter></para>
</refsee>
</doc:pi>
<xsl:template name="pi.dbtex_delims">
<xsl:param name="node" select="."/>
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="$node/processing-instruction('dbtex')"/>
<xsl:with-param name="attribute" select="'delims'"/>
</xsl:call-template>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="processing-instruction()" mode="titlepage.mode">
<!-- * Als process PIs on title pages -->
<xsl:apply-templates select="."/>
</xsl:template>
<xsl:template match="processing-instruction('dbtimestamp')">
<xsl:call-template name="pi.dbtimestamp"/>
</xsl:template>
<xsl:template name="datetime.format">
<xsl:param name="date"/>
<xsl:param name="format"/>
<xsl:param name="padding" select="1"/>
<xsl:if test="$format != ''">
<!-- replace any whitespace in the format string with a non-breaking space -->
<xsl:variable name="format-nbsp"
select="translate($format,
'&#x20;&#x9;&#xd;&#xa;',
'&#xa0;&#xa0;&#xa0;&#xa0;')"/>
<xsl:variable name="tokenized-format-string">
<xsl:call-template name="str.tokenize.keep.delimiters">
<xsl:with-param name="string" select="$format-nbsp"/>
<xsl:with-param name="delimiters" select="'&#xa0;,./-()[]:'"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<!-- We must preserve context node in order to get valid language -->
<xsl:variable name="context" select="."/>
<xsl:for-each select="exsl:node-set($tokenized-format-string)/node()">
<xsl:variable name="token">
<xsl:value-of select="."/>
</xsl:variable>
<!-- Restore context node -->
<xsl:for-each select="$context">
<xsl:choose>
<xsl:when test="$token = 'a'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-abbrev'"/>
<xsl:with-param name="name" select="date:day-abbreviation($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'A'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-full'"/>
<xsl:with-param name="name" select="date:day-name($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'b'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-abbrev'"/>
<xsl:with-param name="name" select="date:month-abbreviation($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'c'">
<xsl:value-of select="date:date($date)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="date:time($date)"/>
</xsl:when>
<xsl:when test="$token = 'B'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-full'"/>
<xsl:with-param name="name" select="date:month-name($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'd'">
<xsl:if test="$padding = 1 and
string-length(date:day-in-month($date)) = 1">0</xsl:if>
<xsl:value-of select="date:day-in-month($date)"/>
</xsl:when>
<xsl:when test="$token = 'H'">
<xsl:if test="$padding = 1 and string-length(date:hour-in-day($date)) = 1">0</xsl:if>
<xsl:value-of select="date:hour-in-day($date)"/>
</xsl:when>
<xsl:when test="$token = 'j'">
<xsl:value-of select="date:day-in-year($date)"/>
</xsl:when>
<xsl:when test="$token = 'm'">
<xsl:if test="$padding = 1 and string-length(date:month-in-year($date)) = 1">0</xsl:if>
<xsl:value-of select="date:month-in-year($date)"/>
</xsl:when>
<xsl:when test="$token = 'M'">
<xsl:if test="string-length(date:minute-in-hour($date)) = 1">0</xsl:if>
<xsl:value-of select="date:minute-in-hour($date)"/>
</xsl:when>
<xsl:when test="$token = 'S'">
<xsl:if test="string-length(date:second-in-minute($date)) = 1">0</xsl:if>
<xsl:value-of select="date:second-in-minute($date)"/>
</xsl:when>
<xsl:when test="$token = 'U'">
<xsl:value-of select="date:week-in-year($date)"/>
</xsl:when>
<xsl:when test="$token = 'w'">
<xsl:value-of select="date:day-in-week($date)"/>
</xsl:when>
<xsl:when test="$token = 'x'">
<xsl:value-of select="date:date($date)"/>
</xsl:when>
<xsl:when test="$token = 'X'">
<xsl:value-of select="date:time($date)"/>
</xsl:when>
<xsl:when test="$token = 'Y'">
<xsl:value-of select="date:year($date)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$token"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Timestamp processing requires an XSLT processor with support
for the EXSLT node-set() function.
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,372 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ng="http://docbook.org/docbook-ng"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:saxon="http://icl.com/saxon"
xmlns:NodeInfo="http://org.apache.xalan.lib.NodeInfo"
xmlns:exsl="http://exslt.org/common"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="db ng exsl saxon NodeInfo xlink"
version='1.0'>
<!-- ********************************************************************
$Id: stripns.xsl 9016 2011-06-07 12:09:34Z nwalsh $
********************************************************************
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.
******************************************************************** -->
<!-- put an xml:base attribute on the root element -->
<xsl:template match="/*" mode="stripNS">
<xsl:choose>
<xsl:when test="self::ng:* or self::db:*">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="add-xml-base"/>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="add-xml-base"/>
<xsl:apply-templates mode="stripNS"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="stripNS">
<xsl:choose>
<xsl:when test="self::ng:* or self::db:*">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="db:info" mode="stripNS">
<xsl:variable name="info">
<xsl:choose>
<xsl:when test="parent::db:article
|parent::db:appendix
|parent::db:bibliography
|parent::db:book
|parent::db:chapter
|parent::db:glossary
|parent::db:index
|parent::db:part
|parent::db:preface
|parent::db:refentry
|parent::db:reference
|parent::db:refsect1
|parent::db:refsect2
|parent::db:refsect3
|parent::db:refsection
|parent::db:refsynopsisdiv
|parent::db:sect1
|parent::db:sect2
|parent::db:sect3
|parent::db:sect4
|parent::db:sect5
|parent::db:section
|parent::db:setindex
|parent::db:set
|parent::db:slides
|parent::db:sidebar">
<xsl:value-of select="local-name(parent::*)"/>
<xsl:text>info</xsl:text>
</xsl:when>
<xsl:when test="parent::db:audioobject
|parent::db:imageobject
|parent::db:inlinemediaobject
|parent::db:mediaobject
|parent::db:mediaobjectco
|parent::db:textobject
|parent::db:videoobject">
<xsl:text>objectinfo</xsl:text>
</xsl:when>
<xsl:otherwise>blockinfo</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$info}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
<xsl:if test="(not(../db:title) and not(../ng:title))
and ($info = 'prefaceinfo'
or $info = 'chapterinfo'
or $info = 'sectioninfo'
or $info = 'sect1info'
or $info = 'sect2info'
or $info = 'sect3info'
or $info = 'sect4info'
or $info = 'sect5info'
or $info = 'refsectioninfo'
or $info = 'refsect1info'
or $info = 'refsect2info'
or $info = 'refsect3info'
or $info = 'blockinfo'
or $info = 'appendixinfo')">
<xsl:apply-templates select="db:title|ng:title" mode="stripNS"/>
</xsl:if>
</xsl:template>
<xsl:template match="ng:tag|db:tag" mode="stripNS">
<xsl:choose>
<xsl:when test="@xlink:href">
<ulink url="{@xlink:href}">
<sgmltag>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(local-name(.) = 'href')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</sgmltag>
</ulink>
</xsl:when>
<xsl:otherwise>
<sgmltag>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</sgmltag>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="db:link[@xlink:href]" mode="stripNS">
<ulink url="{@xlink:href}">
<xsl:if test="@role">
<xsl:attribute name="role">
<xsl:value-of select="@role"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</ulink>
</xsl:template>
<xsl:template match="db:citetitle[@xlink:href]" mode="stripNS">
<ulink url="{@xlink:href}">
<citetitle>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(local-name(.) = 'href')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</citetitle>
</ulink>
</xsl:template>
<xsl:template match="db:citetitle[@linkend]" mode="stripNS">
<citetitle>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(name(.) = 'linkend')
and not(local-name(.) = 'href')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</citetitle>
</xsl:template>
<xsl:template match="db:alt" mode="stripNS"/>
<xsl:template match="ng:textdata|db:textdata
|ng:imagedata|db:imagedata
|ng:videodata|db:videodata
|ng:audiodata|db:audiodata" mode="stripNS">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(name(.) = 'entityref')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="@entityref">
<xsl:attribute name="fileref">
<xsl:value-of select="unparsed-entity-uri(@entityref)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:template>
<xsl:template name="add-xml-base">
<xsl:if test="not(@xml:base)">
<xsl:variable name="base">
<xsl:choose>
<xsl:when test="function-available('saxon:systemId')">
<xsl:value-of select="saxon:systemId()"/>
</xsl:when>
<xsl:when test="function-available('NodeInfo:systemId')">
<xsl:value-of select="NodeInfo:systemId()"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>WARNING: cannot add @xml:base to node </xsl:text>
<xsl:text>set root element. </xsl:text>
<xsl:text>Relative paths may not work.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- debug
<xsl:message>base is <xsl:value-of select="$base"/></xsl:message>
-->
<xsl:if test="$base != ''">
<xsl:attribute name="xml:base">
<xsl:call-template name="systemIdToBaseURI">
<xsl:with-param name="systemId">
<!-- file: seems to confuse some processors. -->
<xsl:choose>
<!-- however, windows paths must use file:///c:/path -->
<xsl:when test="starts-with($base, 'file:///') and
substring($base, 10, 1) = ':'">
<xsl:value-of select="$base"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file:/')
and substring($base, 8, 1) = ':'">
<xsl:value-of select="concat('file:///',
substring-after($base,'file:/'))"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file:///')">
<xsl:value-of select="substring-after($base,'file://')"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file://')">
<xsl:value-of select="substring-after($base,'file:/')"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file:/')">
<xsl:value-of select="substring-after($base,'file:')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$base"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="systemIdToBaseURI">
<xsl:param name="systemId" select="''"/>
<xsl:if test="contains($systemId,'/')">
<xsl:value-of select="substring-before($systemId,'/')"/>
<xsl:text>/</xsl:text>
<xsl:call-template name="systemIdToBaseURI">
<xsl:with-param name="systemId"
select="substring-after($systemId,'/')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="comment()|processing-instruction()|text()" mode="stripNS">
<xsl:copy/>
</xsl:template>
<xsl:template match="/" priority="-1">
<!-- need a local version of this variable because this module imported many places-->
<xsl:variable name="local.exsl.node.set.available">
<xsl:choose>
<xsl:when exsl:foo="" xmlns:exsl="http://exslt.org/common"
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:variable>
<xsl:choose>
<xsl:when test="$local.exsl.node.set.available != 0
and (*/self::ng:* or */self::db:*)">
<xsl:message>
<xsl:text>Stripping namespace from DocBook 5 document. </xsl:text>
<xsl:text>It is suggested to use namespaced version of the stylesheets </xsl:text>
<xsl:text>available in distribution file 'docbook-xsl-ns' </xsl:text>
<xsl:text>at //http://sourceforge.net/projects/docbook/files/</xsl:text>
<xsl:text> which does not require namespace stripping step.</xsl:text>
</xsl:message>
<xsl:variable name="nons">
<xsl:apply-templates mode="stripNS"/>
</xsl:variable>
<xsl:message>Processing stripped document.</xsl:message>
<xsl:apply-templates select="exsl:node-set($nons)"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,180 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: subtitles.xsl 9286 2012-04-19 10:10:58Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- subtitle markup -->
<doc:mode mode="subtitle.markup" xmlns="">
<refpurpose>Provides access to element subtitles</refpurpose>
<refdescription id="subtitle.markup-desc">
<para>Processing an element in the
<literal role="mode">subtitle.markup</literal> mode produces the
subtitle of the element.
</para>
</refdescription>
</doc:mode>
<xsl:template match="*" mode="subtitle.markup">
<xsl:param name="verbose" select="1"/>
<xsl:if test="$verbose != 0">
<xsl:message>
<xsl:text>Request for subtitle of unexpected element: </xsl:text>
<xsl:value-of select="local-name(.)"/>
</xsl:message>
<xsl:text>???SUBTITLE???</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="subtitle" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="set" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(setinfo/subtitle|info/subtitle|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="book" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(bookinfo/subtitle|info/subtitle|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="part" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(partinfo/subtitle
|docinfo/subtitle
|info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="preface|chapter|appendix" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(docinfo/subtitle
|info/subtitle
|prefaceinfo/subtitle
|chapterinfo/subtitle
|appendixinfo/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="article" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(artheader/subtitle
|articleinfo/subtitle
|info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="dedication|colophon" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(subtitle|info/subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="reference" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(referenceinfo/subtitle
|docinfo/subtitle
|info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="qandaset" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(blockinfo/subtitle|info/subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="refentry" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(refentryinfo/subtitle
|info/subtitle
|docinfo/subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="section
|sect1|sect2|sect3|sect4|sect5
|refsect1|refsect2|refsect3
|topic
|simplesect"
mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(info/subtitle
|sectioninfo/subtitle
|sect1info/subtitle
|sect2info/subtitle
|sect3info/subtitle
|sect4info/subtitle
|sect5info/subtitle
|refsect1info/subtitle
|refsect2info/subtitle
|refsect3info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>

514
build/xsl/common/table.xsl Normal file
View File

@ -0,0 +1,514 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version="1.0">
<!-- ********************************************************************
$Id: table.xsl 8392 2009-04-01 08:47:55Z 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 name="blank.spans">
<xsl:param name="cols" select="1"/>
<xsl:if test="$cols &gt; 0">
<xsl:text>0:</xsl:text>
<xsl:call-template name="blank.spans">
<xsl:with-param name="cols" select="$cols - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="calculate.following.spans">
<xsl:param name="colspan" select="1"/>
<xsl:param name="spans" select="''"/>
<xsl:choose>
<xsl:when test="$colspan &gt; 0">
<xsl:call-template name="calculate.following.spans">
<xsl:with-param name="colspan" select="$colspan - 1"/>
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$spans"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="finaltd">
<xsl:param name="spans"/>
<xsl:param name="col" select="0"/>
<xsl:if test="$spans != ''">
<xsl:choose>
<xsl:when test="starts-with($spans,'0:')">
<xsl:call-template name="empty.table.cell">
<xsl:with-param name="colnum" select="$col"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<xsl:call-template name="finaltd">
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
<xsl:with-param name="col" select="$col+1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="sfinaltd">
<xsl:param name="spans"/>
<xsl:if test="$spans != ''">
<xsl:choose>
<xsl:when test="starts-with($spans,'0:')">0:</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($spans,':')-1"/>
<xsl:text>:</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="sfinaltd">
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="entry.colnum">
<xsl:param name="entry" select="."/>
<xsl:choose>
<xsl:when test="$entry/@spanname">
<xsl:variable name="spanname" select="$entry/@spanname"/>
<xsl:variable name="spanspec"
select="($entry/ancestor::tgroup/spanspec[@spanname=$spanname]
|$entry/ancestor::entrytbl/spanspec[@spanname=$spanname])[last()]"/>
<xsl:variable name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]
|$entry/ancestor::entrytbl/colspec[@colname=$spanspec/@namest])[last()]"/>
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec" select="$colspec"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$entry/@colname">
<xsl:variable name="colname" select="$entry/@colname"/>
<xsl:variable name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$colname]
|$entry/ancestor::entrytbl/colspec[@colname=$colname])[last()]"/>
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec" select="$colspec"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$entry/@namest">
<xsl:variable name="namest" select="$entry/@namest"/>
<xsl:variable name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$namest]
|$entry/ancestor::entrytbl/colspec[@colname=$namest])[last()]"/>
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec" select="$colspec"/>
</xsl:call-template>
</xsl:when>
<!-- no idea, return 0 -->
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<doc:template name="entry.colnum" xmlns="">
<refpurpose>Determine the column number in which a given entry occurs</refpurpose>
<refdescription id="entry.colnum-desc">
<para>If an <tag>entry</tag> has a
<tag class="attribute">colname</tag> or
<tag class="attribute">namest</tag> attribute, this template
will determine the number of the column in which the entry should occur.
For other <tag>entry</tag>s, nothing is returned.</para>
</refdescription>
<refparameter id="entry.colnum-params">
<variablelist>
<varlistentry><term>entry</term>
<listitem>
<para>The <tag>entry</tag>-element which is to be tested.</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
<refreturn id="entry.colnum-returns">
<para>This template returns the column number if it can be determined,
or 0 (the empty string)</para>
</refreturn>
</doc:template>
<xsl:template name="colspec.colnum">
<xsl:param name="colspec" select="."/>
<xsl:choose>
<xsl:when test="$colspec/@colnum">
<xsl:value-of select="$colspec/@colnum"/>
</xsl:when>
<xsl:when test="$colspec/preceding-sibling::colspec">
<xsl:variable name="prec.colspec.colnum">
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec"
select="$colspec/preceding-sibling::colspec[1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$prec.colspec.colnum + 1"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="calculate.colspan">
<xsl:param name="entry" select="."/>
<xsl:variable name="spanname" select="$entry/@spanname"/>
<xsl:variable name="spanspec"
select="($entry/ancestor::tgroup/spanspec[@spanname=$spanname]
|$entry/ancestor::entrytbl/spanspec[@spanname=$spanname])[last()]"/>
<xsl:variable name="namest">
<xsl:choose>
<xsl:when test="@spanname">
<xsl:value-of select="$spanspec/@namest"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entry/@namest"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nameend">
<xsl:choose>
<xsl:when test="@spanname">
<xsl:value-of select="$spanspec/@nameend"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entry/@nameend"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="scol">
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$namest]
|$entry/ancestor::entrytbl/colspec[@colname=$namest])[last()]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="ecol">
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$nameend]
|$entry/ancestor::entrytbl/colspec[@colname=$nameend])[last()]"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$namest != '' and $nameend != ''">
<xsl:choose>
<xsl:when test="number($ecol) &gt;= number($scol)">
<xsl:value-of select="number($ecol) - number($scol) + 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number($scol) - number($ecol) + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="calculate.rowsep">
<xsl:param name="entry" select="."/>
<xsl:param name="colnum" select="0"/>
<xsl:call-template name="inherited.table.attribute">
<xsl:with-param name="entry" select="$entry"/>
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="'rowsep'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="calculate.colsep">
<xsl:param name="entry" select="."/>
<xsl:param name="colnum" select="0"/>
<xsl:call-template name="inherited.table.attribute">
<xsl:with-param name="entry" select="$entry"/>
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="'colsep'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="inherited.table.attribute">
<xsl:param name="entry" select="."/>
<xsl:param name="row" select="$entry/ancestor-or-self::row[1]"/>
<xsl:param name="colnum" select="0"/>
<xsl:param name="attribute" select="'colsep'"/>
<xsl:variable name="tgroup" select="$row/parent::*/parent::tgroup[1]"/>
<xsl:variable name="tbody" select="$row/parent::*[1]"/>
<xsl:variable name="table" select="($tgroup/ancestor::table
|$tgroup/ancestor::informaltable
|$entry/ancestor::entrytbl)[last()]"/>
<xsl:variable name="entry.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$entry"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="row.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$row"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="span.value">
<xsl:if test="$entry/@spanname">
<xsl:variable name="spanname" select="$entry/@spanname"/>
<xsl:variable name="spanspec"
select="$tgroup/spanspec[@spanname=$spanname]"/>
<xsl:variable name="span.colspec"
select="$tgroup/colspec[@colname=$spanspec/@namest]"/>
<xsl:variable name="spanspec.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$spanspec"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="scolspec.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$span.colspec"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$spanspec.value != ''">
<xsl:value-of select="$spanspec.value"/>
</xsl:when>
<xsl:when test="$scolspec.value != ''">
<xsl:value-of select="$scolspec.value"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="namest.value">
<xsl:if test="$entry/@namest">
<xsl:variable name="namest" select="$entry/@namest"/>
<xsl:variable name="colspec"
select="$tgroup/colspec[@colname=$namest]"/>
<xsl:variable name="inner.namest.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$colspec"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$inner.namest.value">
<xsl:value-of select="$inner.namest.value"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="tgroup.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$tgroup"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="tbody.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$tbody"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="table.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$table"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="default.value">
<!-- This section used to say that rowsep and colsep have defaults based -->
<!-- on the frame setting. Further reflection and closer examination of the -->
<!-- CALS spec reveals I was mistaken. The default is "1" for rowsep and colsep. -->
<!-- For everything else, the default is the tgroup value -->
<xsl:choose>
<xsl:when test="$tgroup.value != ''">
<xsl:value-of select="$tgroup.value"/>
</xsl:when>
<xsl:when test="$attribute = 'rowsep'">1</xsl:when>
<xsl:when test="$attribute = 'colsep'">1</xsl:when>
<xsl:otherwise><!-- empty --></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="calc.colvalue">
<xsl:if test="$colnum &gt; 0">
<xsl:call-template name="colnum.colspec">
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$entry.value != ''">
<xsl:value-of select="$entry.value"/>
</xsl:when>
<xsl:when test="$row.value != ''">
<xsl:value-of select="$row.value"/>
</xsl:when>
<xsl:when test="$span.value != ''">
<xsl:value-of select="$span.value"/>
</xsl:when>
<xsl:when test="$namest.value != ''">
<xsl:value-of select="$namest.value"/>
</xsl:when>
<xsl:when test="$calc.colvalue != ''">
<xsl:value-of select="$calc.colvalue"/>
</xsl:when>
<xsl:when test="$tbody.value != ''">
<xsl:value-of select="$tbody.value"/>
</xsl:when>
<xsl:when test="$tgroup.value != ''">
<xsl:value-of select="$tgroup.value"/>
</xsl:when>
<xsl:when test="$table.value != ''">
<xsl:value-of select="$table.value"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default.value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="colnum.colspec">
<xsl:param name="colnum" select="0"/>
<xsl:param name="attribute" select="'colname'"/>
<xsl:param name="colspec.ancestor"
select="(ancestor::tgroup|ancestor::entrytbl)
[position() = last()]"/>
<xsl:param name="colspecs" select="$colspec.ancestor/colspec"/>
<xsl:param name="count" select="1"/>
<xsl:choose>
<xsl:when test="not($colspecs) or $count &gt; $colnum">
<!-- nop -->
</xsl:when>
<xsl:when test="$colspecs[1]/@colnum">
<xsl:choose>
<xsl:when test="$colspecs[1]/@colnum = $colnum">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$colspecs[1]"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="colnum.colspec">
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="$attribute"/>
<xsl:with-param name="colspecs"
select="$colspecs[position()&gt;1]"/>
<xsl:with-param name="count"
select="$colspecs[1]/@colnum+1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$count = $colnum">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$colspecs[1]"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="colnum.colspec">
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="$attribute"/>
<xsl:with-param name="colspecs"
select="$colspecs[position()&gt;1]"/>
<xsl:with-param name="count" select="$count+1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-attribute">
<xsl:param name="element" select="."/>
<xsl:param name="attribute" select="''"/>
<xsl:for-each select="$element/@*">
<xsl:if test="local-name(.) = $attribute">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="consume-row">
<xsl:param name="spans"/>
<xsl:if test="contains($spans,':')">
<xsl:value-of select="substring-before($spans,':') - 1"/>
<xsl:text>:</xsl:text>
<xsl:call-template name="consume-row">
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Returns the table style for the context element -->
<xsl:template name="tabstyle">
<xsl:param name="node" select="."/>
<xsl:variable name="tgroup" select="$node/tgroup[1] |
$node/ancestor-or-self::tgroup[1]"/>
<xsl:variable name="table"
select="($node/ancestor-or-self::table |
$node/ancestor-or-self::informaltable)[last()]"/>
<xsl:variable name="tabstyle">
<xsl:choose>
<xsl:when test="$table/@tabstyle != ''">
<xsl:value-of select="normalize-space($table/@tabstyle)"/>
</xsl:when>
<xsl:when test="$tgroup/@tgroupstyle != ''">
<xsl:value-of select="normalize-space($tgroup/@tgroupstyle)"/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$tabstyle"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,337 @@
<?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:exsl="http://exslt.org/common"
exclude-result-prefixes="doc exsl"
version='1.0'>
<!-- ********************************************************************
$Id: targets.xsl 9286 2012-04-19 10:10:58Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- cross reference target collection -->
<doc:mode mode="collect.targets" xmlns="">
<refpurpose>Collects information for potential cross reference targets</refpurpose>
<refdescription id="collect.targets-desc">
<para>Processing the root element in the
<literal role="mode">collect.targets</literal> mode produces
a set of target database elements that can be used by
the olink mechanism to resolve external cross references.
The collection process is controlled by the <literal>
collect.xref.targets</literal> parameter, which can be
<literal>yes</literal> to collect targets and process
the document for output, <literal>only</literal> to
only collect the targets, and <literal>no</literal>
(default) to not collect the targets and only process the document.
</para>
<para>
A <literal>targets.filename</literal> parameter must be
specified to receive the output if
<literal>collect.xref.targets</literal> is
set to <literal>yes</literal> so as to
redirect the target data to a file separate from the
document output.
</para>
</refdescription>
</doc:mode>
<!-- ============================================================ -->
<xsl:template match="*" mode="collect.targets">
<xsl:choose>
<xsl:when test="$collect.xref.targets = 'yes' and $targets.filename = ''">
<xsl:message>
Must specify a $targets.filename parameter when
$collect.xref.targets is set to 'yes'.
The xref targets were not collected.
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$targets.filename">
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$targets.filename"/>
<xsl:with-param name="method" select="'xml'"/>
<xsl:with-param name="encoding" select="'utf-8'"/>
<xsl:with-param name="omit-xml-declaration" select="'yes'"/>
<xsl:with-param name="doctype-public" select="''"/>
<xsl:with-param name="doctype-system" select="''"/>
<xsl:with-param name="indent" select="'no'"/>
<xsl:with-param name="quiet" select="0"/>
<xsl:with-param name="content">
<xsl:apply-templates select="." mode="olink.mode"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Else write to standard output -->
<xsl:apply-templates select="." mode="olink.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="olink.href.target">
<xsl:param name="nd" select="."/>
<xsl:value-of select="$olink.base.uri"/>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$nd"/>
<xsl:with-param name="context" select="NOTANODE"/>
</xsl:call-template>
</xsl:template>
<!-- Templates for extracting cross reference information
from a document for use in an xref database.
-->
<xsl:template name="attrs">
<xsl:param name="nd" select="."/>
<xsl:attribute name="element">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:call-template name="olink.href.target">
<xsl:with-param name="nd" select="$nd"/>
</xsl:call-template>
</xsl:attribute>
<xsl:variable name="num">
<xsl:apply-templates select="$nd" mode="label.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:if test="$num">
<xsl:attribute name="number">
<xsl:value-of select="$num"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$nd/@id">
<xsl:attribute name="targetptr">
<xsl:value-of select="$nd/@id"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$nd/@xml:id">
<xsl:attribute name="targetptr">
<xsl:value-of select="$nd/@xml:id"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="$nd/@lang">
<xsl:attribute name="lang">
<xsl:value-of select="$nd/@lang"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="div">
<xsl:param name="nd" select="."/>
<div>
<xsl:call-template name="attrs">
<xsl:with-param name="nd" select="$nd"/>
</xsl:call-template>
<ttl>
<xsl:apply-templates select="$nd" mode="title.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</ttl>
<xreftext>
<xsl:choose>
<xsl:when test="$nd/@xreflabel">
<xsl:call-template name="xref.xreflabel">
<xsl:with-param name="target" select="$nd"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$nd" mode="xref-to">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xreftext>
<xsl:apply-templates mode="olink.mode"/>
</div>
</xsl:template>
<xsl:template name="obj">
<xsl:param name="nd" select="."/>
<obj>
<xsl:call-template name="attrs">
<xsl:with-param name="nd" select="$nd"/>
</xsl:call-template>
<ttl>
<xsl:apply-templates select="$nd" mode="title.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</ttl>
<xreftext>
<xsl:choose>
<xsl:when test="$nd/@xreflabel">
<xsl:call-template name="xref.xreflabel">
<xsl:with-param name="target" select="$nd"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$nd" mode="xref-to">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xreftext>
</obj>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()"
mode="olink.mode">
<!-- nop -->
</xsl:template>
<!--
<xsl:template match="*" mode="olink.mode">
</xsl:template>
-->
<xsl:template match="set" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="book" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="preface|chapter|appendix" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="part|reference" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="article" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="topic" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="bibliography|bibliodiv" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="biblioentry|bibliomixed" mode="olink.mode">
<xsl:call-template name="obj"/>
</xsl:template>
<xsl:template match="refentry" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="section|sect1|sect2|sect3|sect4|sect5" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="refsection|refsect1|refsect2|refsect3" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="figure|example|table" mode="olink.mode">
<xsl:call-template name="obj"/>
<xsl:apply-templates mode="olink.mode"/>
</xsl:template>
<xsl:template match="equation[title or info/title]" mode="olink.mode">
<xsl:call-template name="obj"/>
</xsl:template>
<xsl:template match="qandaset|qandaentry" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<!-- handle an glossary collection -->
<xsl:template match="glossary[@role='auto']" mode="olink.mode" priority="2">
<xsl:variable name="collection" select="document($glossary.collection, .)"/>
<xsl:if test="$glossary.collection = ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary </xsl:text>
<xsl:text>without a glossary.collection file.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="not($collection) and $glossary.collection != ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
<xsl:text>open glossary.collection file '</xsl:text>
<xsl:value-of select="$glossary.collection"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="$exsl.node.set.available != 0">
<xsl:variable name="auto.glossary">
<xsl:apply-templates select="." mode="assemble.auto.glossary"/>
</xsl:variable>
<xsl:variable name="auto.glossary.nodeset" select="exsl:node-set($auto.glossary)"/>
<xsl:apply-templates select="$auto.glossary.nodeset/*" mode="olink.mode"/>
</xsl:if>
</xsl:template>
<!-- construct a glossary in memory -->
<xsl:template match="glossary" mode="assemble.auto.glossary">
<xsl:copy>
<xsl:copy-of select="@*[not(local-name() = 'role')]"/>
<xsl:apply-templates select="node()" mode="assemble.auto.glossary"/>
<xsl:call-template name="select.glossentries"/>
</xsl:copy>
</xsl:template>
<xsl:template name="select.glossentries">
<xsl:param name="collection" select="document($glossary.collection, .)"/>
<xsl:param name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
<xsl:for-each select="$collection//glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="glossentry" mode="assemble.auto.glossary">
<!-- skip the dummy entries -->
</xsl:template>
<xsl:template match="*" mode="assemble.auto.glossary">
<!-- pass through any titles and intro stuff -->
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="*" mode="olink.mode">
<xsl:if test="@id or @xml:id">
<xsl:call-template name="obj"/>
</xsl:if>
<xsl:apply-templates mode="olink.mode"/>
</xsl:template>
</xsl:stylesheet>

807
build/xsl/common/titles.xsl Normal file
View File

@ -0,0 +1,807 @@
<?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:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: titles.xsl 9286 2012-04-19 10:10:58Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- title markup -->
<doc:mode mode="title.markup" xmlns="">
<refpurpose>Provides access to element titles</refpurpose>
<refdescription id="title.markup-desc">
<para>Processing an element in the
<literal role="mode">title.markup</literal> mode produces the
title of the element. This does not include the label.
</para>
</refdescription>
</doc:mode>
<xsl:template match="*" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<!-- * FIXME: this should handle other *info elements as well -->
<!-- * but this is good enough for now. -->
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="local-name(.) = 'partintro'">
<!-- partintro's don't have titles, use the parent (part or reference)
title instead. -->
<xsl:apply-templates select="parent::*" mode="title.markup"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$verbose != 0">
<xsl:message>
<xsl:text>Request for title of element with no title: </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:choose>
<xsl:when test="@id">
<xsl:text> (id="</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>")</xsl:text>
</xsl:when>
<xsl:when test="@xml:id">
<xsl:text> (xml:id="</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>")</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:message>
</xsl:if>
<xsl:text>???TITLE???</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="title" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- only occurs in HTML Tables! -->
<xsl:template match="caption" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="set" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(setinfo/title|info/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="book" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(bookinfo/title|info/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="part" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(partinfo/title|info/title|docinfo/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="preface|chapter|appendix" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<!--
<xsl:message>
<xsl:value-of select="local-name(.)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$allow-anchors"/>
</xsl:message>
-->
<xsl:variable name="title" select="(docinfo/title
|info/title
|prefaceinfo/title
|chapterinfo/title
|appendixinfo/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="dedication" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Dedication'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="acknowledgements" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Acknowledgements'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="colophon" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Colophon'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="article" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(artheader/title
|articleinfo/title
|info/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="reference" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(referenceinfo/title|docinfo/title|info/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="refentry" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="refmeta" select=".//refmeta"/>
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
<xsl:variable name="refnamediv" select=".//refnamediv"/>
<xsl:variable name="refname" select="$refnamediv//refname"/>
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$refentrytitle">
<xsl:apply-templates select="$refentrytitle[1]" mode="title.markup"/>
</xsl:when>
<xsl:when test="$refdesc">
<xsl:apply-templates select="$refdesc" mode="title.markup"/>
</xsl:when>
<xsl:when test="$refname">
<xsl:apply-templates select="$refname[1]" mode="title.markup"/>
</xsl:when>
<xsl:otherwise>REFENTRY WITHOUT TITLE???</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:copy-of select="$title"/>
</xsl:template>
<xsl:template match="refentrytitle|refname|refdescriptor" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section
|sect1|sect2|sect3|sect4|sect5
|refsect1|refsect2|refsect3|refsection
|topic
|simplesect"
mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(info/title
|sectioninfo/title
|sect1info/title
|sect2info/title
|sect3info/title
|sect4info/title
|sect5info/title
|refsect1info/title
|refsect2info/title
|refsect3info/title
|refsectioninfo/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="bridgehead" mode="title.markup">
<xsl:apply-templates mode="title.markup"/>
</xsl:template>
<xsl:template match="refsynopsisdiv" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefSynopsisDiv'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="bibliography" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(bibliographyinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Bibliography'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="glossary" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(glossaryinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.element.name">
<xsl:with-param name="element.name" select="local-name(.)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="glossdiv" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:message>ERROR: glossdiv missing its required title</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="glossentry" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="glossterm" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="glossterm|firstterm" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="index" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(indexinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Index'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="setindex" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(setindexinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'SetIndex'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="figure|example|equation" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="table" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title|caption)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="procedure" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="task" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="sidebar" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(info/title|sidebarinfo/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="abstract" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Abstract'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="caution|tip|warning|important|note" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(title|info/title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="local-name(.)='note'">Note</xsl:when>
<xsl:when test="local-name(.)='important'">Important</xsl:when>
<xsl:when test="local-name(.)='caution'">Caution</xsl:when>
<xsl:when test="local-name(.)='warning'">Warning</xsl:when>
<xsl:when test="local-name(.)='tip'">Tip</xsl:when>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="question" mode="title.markup">
<!-- questions don't have titles -->
<xsl:text>Question</xsl:text>
</xsl:template>
<xsl:template match="answer" mode="title.markup">
<!-- answers don't have titles -->
<xsl:text>Answer</xsl:text>
</xsl:template>
<xsl:template match="qandaentry" mode="title.markup">
<!-- qandaentrys are represented by the first question in them -->
<xsl:text>Question</xsl:text>
</xsl:template>
<xsl:template match="qandaset" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(info/title|
blockinfo/title|
title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'QandASet'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="legalnotice" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'LegalNotice'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<xsl:when test="titleabbrev">
<xsl:apply-templates select="titleabbrev[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="info/titleabbrev">
<xsl:apply-templates select="info/titleabbrev[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="book|preface|chapter|appendix" mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="titleabbrev" select="(docinfo/titleabbrev
|bookinfo/titleabbrev
|info/titleabbrev
|prefaceinfo/titleabbrev
|chapterinfo/titleabbrev
|appendixinfo/titleabbrev
|titleabbrev)[1]"/>
<xsl:choose>
<xsl:when test="$titleabbrev">
<xsl:apply-templates select="$titleabbrev" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="article" mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="titleabbrev" select="(artheader/titleabbrev
|articleinfo/titleabbrev
|info/titleabbrev
|titleabbrev)[1]"/>
<xsl:choose>
<xsl:when test="$titleabbrev">
<xsl:apply-templates select="$titleabbrev" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section
|sect1|sect2|sect3|sect4|sect5
|refsect1|refsect2|refsect3
|topic
|simplesect"
mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="titleabbrev" select="(info/titleabbrev
|sectioninfo/titleabbrev
|sect1info/titleabbrev
|sect2info/titleabbrev
|sect3info/titleabbrev
|sect4info/titleabbrev
|sect5info/titleabbrev
|refsect1info/titleabbrev
|refsect2info/titleabbrev
|refsect3info/titleabbrev
|titleabbrev)[1]"/>
<xsl:choose>
<xsl:when test="$titleabbrev">
<xsl:apply-templates select="$titleabbrev" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="titleabbrev" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="no.anchor.mode">
<!-- Switch to normal mode if no links -->
<xsl:choose>
<xsl:when test="descendant-or-self::footnote or
descendant-or-self::anchor or
descendant-or-self::ulink or
descendant-or-self::link or
descendant-or-self::olink or
descendant-or-self::xref or
descendant-or-self::indexterm or
(ancestor::title and (@id or @xml:id))">
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="footnote" mode="no.anchor.mode">
<!-- nop, suppressed -->
</xsl:template>
<xsl:template match="anchor" mode="no.anchor.mode">
<!-- nop, suppressed -->
</xsl:template>
<xsl:template match="ulink" mode="no.anchor.mode">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="link" mode="no.anchor.mode">
<xsl:choose>
<xsl:when test="count(child::node()) &gt; 0">
<!-- If it has content, use it -->
<xsl:apply-templates/>
</xsl:when>
<!-- look for an endterm -->
<xsl:when test="@endterm">
<xsl:variable name="etargets" select="key('id',@endterm)"/>
<xsl:variable name="etarget" select="$etargets[1]"/>
<xsl:choose>
<xsl:when test="count($etarget) = 0">
<xsl:message>
<xsl:value-of select="count($etargets)"/>
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
<xsl:value-of select="@endterm"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$etarget" mode="endterm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="olink" mode="no.anchor.mode">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="indexterm" mode="no.anchor.mode">
<!-- nop, suppressed -->
</xsl:template>
<xsl:template match="xref" mode="no.anchor.mode">
<xsl:variable name="targets" select="key('id',@linkend)|key('id',substring-after(@xlink:href,'#'))"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:variable name="refelem" select="local-name($target)"/>
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="count($target) = 0">
<xsl:message>
<xsl:text>XRef to nonexistent id: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:value-of select="@xlink:href"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:when test="@endterm">
<xsl:variable name="etargets" select="key('id',@endterm)"/>
<xsl:variable name="etarget" select="$etargets[1]"/>
<xsl:choose>
<xsl:when test="count($etarget) = 0">
<xsl:message>
<xsl:value-of select="count($etargets)"/>
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
<xsl:value-of select="@endterm"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$etarget" mode="endterm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$target/@xreflabel">
<xsl:call-template name="xref.xreflabel">
<xsl:with-param name="target" select="$target"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<!-- Watch out for the case when there is a xref or link inside
a title. See bugs #1811721 and #1838136. -->
<xsl:when test="not(ancestor::*[@id = $target/@id] or ancestor::*[@xml:id = $target/@xml:id])">
<xsl:apply-templates select="$target" mode="xref-to-prefix"/>
<xsl:apply-templates select="$target" mode="xref-to">
<xsl:with-param name="referrer" select="."/>
<xsl:with-param name="xrefstyle">
<xsl:choose>
<xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
<xsl:value-of select="@role"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@xrefstyle"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
<xsl:apply-templates select="$target" mode="xref-to-suffix"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
</xsl:stylesheet>

View File

@ -0,0 +1,290 @@
<?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:dyn="http://exslt.org/dynamic"
xmlns:saxon="http://icl.com/saxon"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="doc dyn saxon"
version='1.0'>
<!-- ********************************************************************
$Id: utility.xsl 7101 2007-07-20 15:32:12Z xmldoc $
********************************************************************
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.
******************************************************************** -->
<doc:reference xmlns="" xml:id="utility">
<info>
<title>Common » Utility Template Reference</title>
<releaseinfo role="meta">
$Id: utility.xsl 7101 2007-07-20 15:32:12Z xmldoc $
</releaseinfo>
</info>
<!-- * yes, partintro is a valid child of a reference... -->
<partintro xml:id="partintro">
<title>Introduction</title>
<para>This is technical reference documentation for the
miscellaneous utility templates in the DocBook XSL
Stylesheets.</para>
<note>
<para>These templates are defined in a separate file from the set
of “common” templates because some of the common templates
reference DocBook XSL stylesheet parameters, requiring the
entire set of parameters to be imported/included in any
stylesheet that imports/includes the common templates.</para>
<para>The utility templates dont import or include any DocBook
XSL stylesheet parameters, so the utility templates can be used
without importing the whole set of parameters.</para>
</note>
<para>This is not intended to be user documentation. It is
provided for developers writing customization layers for the
stylesheets.</para>
</partintro>
</doc:reference>
<!-- ====================================================================== -->
<doc:template name="log.message" xmlns="">
<refpurpose>Logs/emits formatted notes and warnings</refpurpose>
<refdescription id="log.message-desc">
<para>The <function>log.message</function> template is a utility
template for logging/emitting formatted messages&#xa0; that is,
notes and warnings, along with a given log “level” and an
identifier for the “source” that the message relates to.</para>
</refdescription>
<refparameter id="log.message-params">
<variablelist>
<varlistentry><term>level</term>
<listitem>
<para>Text to log/emit in the message-level field to
indicate the message level
(<literal>Note</literal> or
<literal>Warning</literal>)</para>
</listitem>
</varlistentry>
<varlistentry><term>source</term>
<listitem>
<para>Text to log/emit in the source field to identify the
“source” to which the notification/warning relates.
This can be any arbitrary string, but because the
message lacks line and column numbers to identify the
exact part of the source document to which it
relates, the intention is that the value you pass
into the <literal>source</literal> parameter should
give the user some way to identify the portion of
their source document on which to take potentially
take action in response to the log message (for
example, to edit, change, or add content).</para>
<para>So the <literal>source</literal> value should be,
for example, an ID, book/chapter/article title, title
of some formal object, or even a string giving an
XPath expression.</para>
</listitem>
</varlistentry>
<varlistentry><term>context-desc</term>
<listitem>
<para>Text to log/emit in the context-description field to
describe the context for the message.</para>
</listitem>
</varlistentry>
<varlistentry><term>context-desc-field-length</term>
<listitem>
<para>Specifies length of the context-description field
(in characters); default is 12</para>
<para>If the text specified by the
<literal>context-desc</literal> parameter is longer
than the number of characters specified in
<literal>context-desc-field-length</literal>, it is
truncated to <literal>context-desc-field-length</literal>
(12 characters by default).</para>
<para>If the specified text is shorter than
<literal>context-desc-field-length</literal>,
it is right-padded out to
<literal>context-desc-field-length</literal> (12 by
default).</para>
<para>If no value has been specified for the
<literal>context-desc</literal> parameter, the field is
left empty and the text of the log message begins with
the value of the <literal>message</literal>
parameter.</para>
</listitem>
</varlistentry>
<varlistentry><term>message</term>
<listitem>
<para>Text to log/emit in the actual message field</para>
</listitem>
</varlistentry>
<varlistentry><term>message-field-length</term>
<listitem>
<para>Specifies length of the message
field (in characters); default is 45</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
<refreturn id="log.message-returns">
<para>Outputs a message (generally, to standard error).</para></refreturn>
</doc:template>
<xsl:template name="log.message">
<xsl:param name="level"/>
<xsl:param name="source"/>
<xsl:param name="context-desc"/>
<xsl:param name="context-desc-field-length">12</xsl:param>
<xsl:param name="context-desc-padded">
<xsl:if test="not($context-desc = '')">
<xsl:call-template name="pad-string">
<xsl:with-param name="leftRight">right</xsl:with-param>
<xsl:with-param name="padVar"
select="substring($context-desc, 1, $context-desc-field-length)"/>
<xsl:with-param name="length" select="$context-desc-field-length"/>
</xsl:call-template>
</xsl:if>
</xsl:param>
<xsl:param name="message"/>
<xsl:param name="message-field-length" select="45"/>
<xsl:param name="message-padded">
<xsl:variable name="spaces-for-blank-level">
<!-- * if the level field is blank, we'll need to pad out -->
<!-- * the message field with spaces to compensate -->
<xsl:choose>
<xsl:when test="$level = ''">
<xsl:value-of select="4 + 2"/>
<!-- * 4 = hard-coded length of comment text ("Note" or "Warn") -->
<!-- * + 2 = length of colon-plus-space separator ": " -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="spaces-for-blank-context-desc">
<!-- * if the context-description field is blank, we'll need -->
<!-- * to pad out the message field with spaces to compensate -->
<xsl:choose>
<xsl:when test="$context-desc = ''">
<xsl:value-of select="$context-desc-field-length + 2"/>
<!-- * + 2 = length of colon-plus-space separator ": " -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="extra-spaces"
select="$spaces-for-blank-level + $spaces-for-blank-context-desc"/>
<xsl:call-template name="pad-string">
<xsl:with-param name="leftRight">right</xsl:with-param>
<xsl:with-param name="padVar"
select="substring($message, 1, ($message-field-length + $extra-spaces))"/>
<xsl:with-param name="length"
select="$message-field-length + $extra-spaces"/>
</xsl:call-template>
</xsl:param>
<!-- * emit the actual log message -->
<xsl:message>
<xsl:if test="not($level = '')">
<xsl:value-of select="$level"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:if test="not($context-desc = '')">
<xsl:value-of select="$context-desc-padded"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="$message-padded"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$source"/>
</xsl:message>
</xsl:template>
<!-- ===================================== -->
<doc:template name="get.doc.title" xmlns="">
<refpurpose>Gets a title from the current document</refpurpose>
<refdescription id="get.doc.title-desc">
<para>The <function>get.doc.title</function> template is a
utility template for returning the first title found in the
current document.</para>
</refdescription>
<refreturn id="get.doc.title-returns">
<para>Returns a string containing some identifying title for the
current document .</para></refreturn>
</doc:template>
<xsl:template name="get.doc.title">
<xsl:choose>
<xsl:when test="//*[local-name() = 'title'
or local-name() = 'refname']">
<xsl:value-of select="//*[local-name() = 'title'
or local-name() = 'refname'][1]"/>
</xsl:when>
<xsl:when test="substring(local-name(*[1]),
string-length(local-name(*[1])-3) = 'info')
and *[1]/*[local-name() = 'title']">
<xsl:value-of select="*[1]/*[local-name() = 'title'][1]"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ===================================== -->
<doc:template name="pad-string" xmlns="">
<refpurpose>Right-pads or left-pads a string out to a certain length</refpurpose>
<refdescription id="pad-string-desc">
<para>This function takes string <parameter>padVar</parameter> and
pads it out in the direction <parameter>rightLeft</parameter> to
the string-length <parameter>length</parameter>, using string
<parameter>padChar</parameter> (a space character by default) as
the padding string (note that <parameter>padChar</parameter> can
be a string; it is not limited to just being a single
character).</para>
<note>
<para>This function began as a copy of Nate Austin's
<function>prepend-pad</function> function in the <link
xlink:href="http://www.dpawson.co.uk/xsl/sect2/padding.html" >Padding
Content</link> section of Dave Pawson's <link
xlink:href="http://www.dpawson.co.uk/xsl/index.html" >XSLT
FAQ</link>.</para>
</note>
</refdescription>
<refreturn id="pad-string-returns">
<para>Returns a (padded) string.</para></refreturn>
</doc:template>
<xsl:template name="pad-string">
<!-- * recursive template to right/left pad the value with -->
<!-- * whatever padChar is passed in -->
<xsl:param name="padChar" select="' '"/>
<xsl:param name="leftRight">left</xsl:param>
<xsl:param name="padVar"/>
<xsl:param name="length"/>
<xsl:choose>
<xsl:when test="string-length($padVar) &lt; $length">
<xsl:call-template name="pad-string">
<xsl:with-param name="padChar" select="$padChar"/>
<xsl:with-param name="leftRight" select="$leftRight"/>
<xsl:with-param name="padVar">
<xsl:choose>
<!-- * determine whether string should be -->
<!-- * right- or left-padded -->
<xsl:when test="$leftRight = 'left'">
<!-- * pad it to left -->
<xsl:value-of select="concat($padChar,$padVar)"/>
</xsl:when>
<xsl:otherwise>
<!-- * otherwise, right-pad the string -->
<xsl:value-of select="concat($padVar,$padChar)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="substring($padVar,string-length($padVar) - $length + 1)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

139
build/xsl/html/admon.xsl Normal file
View File

@ -0,0 +1,139 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: admon.xsl 9352 2012-05-12 23:17:11Z 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="*" mode="admon.graphic.width">
<xsl:param name="node" select="."/>
<xsl:text>25</xsl:text>
</xsl:template>
<xsl:template match="note|important|warning|caution|tip">
<xsl:choose>
<xsl:when test="$admon.graphics != 0">
<xsl:call-template name="graphical.admonition"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="nongraphical.admonition"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="admon.graphic">
<xsl:param name="node" select="."/>
<xsl:value-of select="$admon.graphics.path"/>
<xsl:choose>
<xsl:when test="local-name($node)='note'">note</xsl:when>
<xsl:when test="local-name($node)='warning'">warning</xsl:when>
<xsl:when test="local-name($node)='caution'">caution</xsl:when>
<xsl:when test="local-name($node)='tip'">tip</xsl:when>
<xsl:when test="local-name($node)='important'">important</xsl:when>
<xsl:otherwise>note</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$admon.graphics.extension"/>
</xsl:template>
<xsl:template name="graphical.admonition">
<xsl:variable name="admon.type">
<xsl:choose>
<xsl:when test="local-name(.)='note'">Note</xsl:when>
<xsl:when test="local-name(.)='warning'">Warning</xsl:when>
<xsl:when test="local-name(.)='caution'">Caution</xsl:when>
<xsl:when test="local-name(.)='tip'">Tip</xsl:when>
<xsl:when test="local-name(.)='important'">Important</xsl:when>
<xsl:otherwise>Note</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="alt">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="$admon.type"/>
</xsl:call-template>
</xsl:variable>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:if test="$admon.style != ''">
<xsl:attribute name="style">
<xsl:value-of select="$admon.style"/>
</xsl:attribute>
</xsl:if>
<table border="{$table.border.off}">
<!-- omit summary attribute in html5 output -->
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">
<xsl:value-of select="$admon.type"/>
<xsl:if test="title|info/title">
<xsl:text>: </xsl:text>
<xsl:value-of select="(title|info/title)[1]"/>
</xsl:if>
</xsl:attribute>
</xsl:if>
<tr>
<td rowspan="2" align="center" valign="top">
<xsl:attribute name="width">
<xsl:apply-templates select="." mode="admon.graphic.width"/>
</xsl:attribute>
<img alt="[{$alt}]">
<xsl:attribute name="src">
<xsl:call-template name="admon.graphic"/>
</xsl:attribute>
</img>
</td>
<th align="{$direction.align.start}">
<xsl:call-template name="anchor"/>
<xsl:if test="$admon.textlabel != 0 or title or info/title">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:if>
</th>
</tr>
<tr>
<td align="{$direction.align.start}" valign="top">
<xsl:apply-templates/>
</td>
</tr>
</table>
</div>
</xsl:template>
<xsl:template name="nongraphical.admonition">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute"/>
<xsl:if test="$admon.style">
<xsl:attribute name="style">
<xsl:value-of select="$admon.style"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$admon.textlabel != 0 or title or info/title">
<h3 class="title">
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="." mode="object.title.markup"/>
</h3>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="note/title"></xsl:template>
<xsl:template match="important/title"></xsl:template>
<xsl:template match="warning/title"></xsl:template>
<xsl:template match="caution/title"></xsl:template>
<xsl:template match="tip/title"></xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,169 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:template name="add.annotation.links">
<xsl:param name="scripts" select="normalize-space($annotation.js)"/>
<xsl:choose>
<xsl:when test="contains($scripts, ' ')">
<script type="text/javascript" src="{substring-before($scripts, ' ')}"/>
<xsl:call-template name="add.annotation.links">
<xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<script type="text/javascript" src="{$scripts}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="annotation"/>
<xsl:template name="apply-annotations">
<xsl:if test="$annotation.support != 0">
<!-- do any annotations apply to the context node? -->
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
<xsl:variable name="aids">
<xsl:for-each select="//annotation">
<xsl:if test="@annotates=$id
or starts-with(@annotates, concat($id, ' '))
or contains(@annotates, concat(' ', $id, ' '))
or substring(@annotates, string-length(@annotates)-3)
= concat(' ', $id)">
<xsl:value-of select="generate-id()"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="normalize-space(@annotations) != ''">
<xsl:call-template name="annotations-pointed-to">
<xsl:with-param name="annotations"
select="normalize-space(@annotations)"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:if test="$aids != ''">
<xsl:call-template name="apply-annotations-by-gid">
<xsl:with-param name="gids" select="normalize-space($aids)"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="annotations-pointed-to">
<xsl:param name="annotations"/>
<xsl:choose>
<xsl:when test="contains($annotations, ' ')">
<xsl:variable name='a'
select="key('id', substring-before($annotations, ' '))"/>
<xsl:if test="$a">
<xsl:value-of select="generate-id($a)"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="annotations-pointed-to">
<xsl:with-param name="annotations"
select="substring-after($annotations, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name='a'
select="key('id', $annotations)"/>
<xsl:if test="$a">
<xsl:value-of select="generate-id($a)"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="apply-annotations-by-gid">
<xsl:param name="gids"/>
<xsl:choose>
<xsl:when test="contains($gids, ' ')">
<xsl:variable name="gid" select="substring-before($gids, ' ')"/>
<xsl:apply-templates select="key('gid', $gid)"
mode="annotation-inline"/>
<xsl:call-template name="apply-annotations-by-gid">
<xsl:with-param name="gids"
select="substring-after($gids, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="key('gid', $gids)"
mode="annotation-inline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="annotation" mode="annotation-inline">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="title">
<xsl:value-of select="title"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>[Annotation #</xsl:text>
<xsl:number count="annotation" level="any" format="1"/>
<xsl:text>]</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="#annot-{generate-id(.)}" title="{$title}"
name="anch-{generate-id(.)}" id="anch-{generate-id(.)}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:attribute name="onClick">
<xsl:text>popup_</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>.showPopup('anch-</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>'); return false;</xsl:text>
</xsl:attribute>
<img src="{$annotation.graphic.open}" border="0" alt="{$title}"/>
</a>
</xsl:template>
<xsl:template match="annotation" mode="annotation-popup">
<div class="annotation-nocss">
<p>
<a name="annot-{generate-id(.)}"/>
<xsl:text>Annotation #</xsl:text>
<xsl:number count="annotation" level="any" format="1"/>
<xsl:text>:</xsl:text>
</p>
</div>
<div id="popup-{generate-id(.)}" class="annotation-popup">
<xsl:if test="string-length(.) &gt; 300">
<xsl:attribute name="style">width:400px</xsl:attribute>
</xsl:if>
<xsl:call-template name="annotation-title"/>
<div class="annotation-body">
<xsl:apply-templates select="*[local-name(.) != 'title']"/>
</div>
<div class="annotation-close">
<a href="#" onclick="popup_{generate-id(.)}.hidePopup();return false;">
<xsl:apply-templates select="." mode="class.attribute"/>
<img src="{$annotation.graphic.close}" alt="X" border="0"/>
</a>
</div>
</div>
</xsl:template>
<xsl:template name="annotation-title">
<div class="annotation-title">
<xsl:choose>
<xsl:when test="title">
<xsl:apply-templates select="title/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Annotation</xsl:text>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
</xsl:stylesheet>

797
build/xsl/html/autoidx.xsl Normal file
View File

@ -0,0 +1,797 @@
<?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"
extension-element-prefixes="exslt"
exclude-result-prefixes="exslt"
version="1.0">
<!-- ********************************************************************
$Id: autoidx.xsl 9376 2012-05-24 18:32:40Z 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;)"/>
<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: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="&section;/titleabbrev and $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:text> (</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'see'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="see"/>
<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;)"/>
<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:value-of select="."/>
<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>

726
build/xsl/html/autotoc.xsl Normal file
View File

@ -0,0 +1,726 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: autotoc.xsl 9295 2012-04-19 19:05:29Z 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:variable name="toc.listitem.type">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">dt</xsl:when>
<xsl:otherwise>li</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- this is just hack because dl and ul aren't completely isomorphic -->
<xsl:variable name="toc.dd.type">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">dd</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template name="make.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
<xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
<xsl:variable name="toc.title">
<xsl:if test="$toc.title.p">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="toc-title">
<xsl:call-template name="gentext">
<xsl:with-param name="key">TableofContents</xsl:with-param>
</xsl:call-template>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key">TableofContents</xsl:with-param>
</xsl:call-template>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$manual.toc != ''">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="toc" select="document($manual.toc, .)"/>
<xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
<xsl:if test="$tocentry and $tocentry/*">
<div class="toc">
<xsl:copy-of select="$toc.title"/>
<xsl:element name="{$toc.list.type}">
<xsl:call-template name="manual-toc">
<xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
</xsl:call-template>
</xsl:element>
</div>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$qanda.in.toc != 0">
<xsl:if test="$nodes.plus">
<div class="toc">
<xsl:copy-of select="$toc.title"/>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="$nodes.plus" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:element>
</div>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$nodes">
<div class="toc">
<xsl:copy-of select="$toc.title"/>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:element>
</div>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make.lots">
<xsl:param name="toc.params" select="''"/>
<xsl:param name="toc"/>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:copy-of select="$toc"/>
</xsl:if>
<xsl:if test="contains($toc.params, 'figure')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'figure'"/>
<xsl:with-param name="nodes" select=".//figure"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'table')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'table'"/>
<xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'example')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'example'"/>
<xsl:with-param name="nodes" select=".//example"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'equation')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'equation'"/>
<xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'procedure')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'procedure'"/>
<xsl:with-param name="nodes" select=".//procedure[title]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- ====================================================================== -->
<xsl:template name="set.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes" select="book|setindex|set"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="division.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes" select="part|reference
|preface|chapter|appendix
|article
|topic
|bibliography|glossary|index
|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="component.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes" select="section|sect1
|simplesect[$simplesect.in.toc != 0]
|topic
|refentry
|article|bibliography|glossary
|appendix|index
|bridgehead[not(@renderas)
and $bridgehead.in.toc != 0]
|.//bridgehead[@renderas='sect1'
and $bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="component.toc.separator">
<!-- Customize to output something between
component.toc and first output -->
</xsl:template>
<xsl:template name="section.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes"
select="section|sect1|sect2|sect3|sect4|sect5|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="section.toc.separator">
<!-- Customize to output something between
section.toc and first output -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="subtoc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
<xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
<xsl:variable name="subtoc">
<xsl:element name="{$toc.list.type}">
<xsl:choose>
<xsl:when test="$qanda.in.toc != 0">
<xsl:apply-templates mode="toc" select="$nodes.plus">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="toc" select="$nodes">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:variable>
<xsl:variable name="depth">
<xsl:choose>
<xsl:when test="local-name(.) = 'section'">
<xsl:value-of select="count(ancestor::section) + 1"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
<xsl:when test="local-name(.) = 'sect2'">2</xsl:when>
<xsl:when test="local-name(.) = 'sect3'">3</xsl:when>
<xsl:when test="local-name(.) = 'sect4'">4</xsl:when>
<xsl:when test="local-name(.) = 'sect5'">5</xsl:when>
<xsl:when test="local-name(.) = 'refsect1'">1</xsl:when>
<xsl:when test="local-name(.) = 'refsect2'">2</xsl:when>
<xsl:when test="local-name(.) = 'refsect3'">3</xsl:when>
<xsl:when test="local-name(.) = 'topic'">1</xsl:when>
<xsl:when test="local-name(.) = 'simplesect'">
<!-- sigh... -->
<xsl:choose>
<xsl:when test="local-name(..) = 'section'">
<xsl:value-of select="count(ancestor::section)"/>
</xsl:when>
<xsl:when test="local-name(..) = 'sect1'">2</xsl:when>
<xsl:when test="local-name(..) = 'sect2'">3</xsl:when>
<xsl:when test="local-name(..) = 'sect3'">4</xsl:when>
<xsl:when test="local-name(..) = 'sect4'">5</xsl:when>
<xsl:when test="local-name(..) = 'sect5'">6</xsl:when>
<xsl:when test="local-name(..) = 'topic'">2</xsl:when>
<xsl:when test="local-name(..) = 'refsect1'">2</xsl:when>
<xsl:when test="local-name(..) = 'refsect2'">3</xsl:when>
<xsl:when test="local-name(..) = 'refsect3'">4</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
<xsl:variable name="subtoc.list">
<xsl:choose>
<xsl:when test="$toc.dd.type = ''">
<xsl:copy-of select="$subtoc"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$toc.dd.type}">
<xsl:copy-of select="$subtoc"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$toc.listitem.type}">
<xsl:call-template name="toc.line">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
<xsl:if test="$toc.listitem.type = 'li' and
( (self::set or self::book or self::part) or
$toc.section.depth > $depth) and
( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
and $toc.max.depth > $depth.from.context">
<xsl:copy-of select="$subtoc.list"/>
</xsl:if>
</xsl:element>
<xsl:if test="$toc.listitem.type != 'li' and
( (self::set or self::book or self::part) or
$toc.section.depth > $depth) and
( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
and $toc.max.depth > $depth.from.context">
<xsl:copy-of select="$subtoc.list"/>
</xsl:if>
</xsl:template>
<xsl:template name="toc.line">
<xsl:param name="toc-context" select="."/>
<xsl:param name="depth" select="1"/>
<xsl:param name="depth.from.context" select="8"/>
<span>
<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
<!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
<!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
<xsl:if test="$autotoc.label.in.hyperlink = 0">
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="context" select="$toc-context"/>
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label -->
<!-- * as part of the hyperlinked title -->
<xsl:if test="not($autotoc.label.in.hyperlink = 0)">
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
</xsl:if>
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</span>
</xsl:template>
<xsl:template match="book" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="part|reference
|preface|chapter|appendix
|article
|topic
|bibliography|glossary|index
|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="setindex" mode="toc">
<xsl:param name="toc-context" select="."/>
<!-- If the setindex tag is not empty, it should be it in the TOC -->
<xsl:if test="* or $generate.index != 0">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="part|reference" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="appendix|chapter|article|topic
|index|glossary|bibliography
|preface|reference|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="preface|chapter|appendix|article|topic" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|sect1
|simplesect[$simplesect.in.toc != 0]
|topic
|refentry
|glossary|bibliography|index
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect1" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect2
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect2" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect3
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect3" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect4
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect4" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect5
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect5" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="simplesect" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="section" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|refentry
|simplesect[$simplesect.in.toc != 0]
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="topic" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|refentry
|simplesect[$simplesect.in.toc != 0]
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="bridgehead" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:if test="$bridgehead.in.toc != 0">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="bibliography|glossary" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="index" mode="toc">
<xsl:param name="toc-context" select="."/>
<!-- If the index tag is not empty, it should be it in the TOC -->
<xsl:if test="* or $generate.index != 0">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="refentry" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:variable name="refmeta" select=".//refmeta"/>
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
<xsl:variable name="refnamediv" select=".//refnamediv"/>
<xsl:variable name="refname" select="$refnamediv//refname"/>
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$refentrytitle">
<xsl:apply-templates select="$refentrytitle[1]"
mode="titleabbrev.markup"/>
</xsl:when>
<xsl:when test="$refdesc">
<xsl:apply-templates select="$refdesc"
mode="titleabbrev.markup"/>
</xsl:when>
<xsl:when test="$refname">
<xsl:apply-templates select="$refname[1]"
mode="titleabbrev.markup"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$toc.listitem.type}">
<span class='refentrytitle'>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:copy-of select="$title"/>
</a>
</span>
<span class='refpurpose'>
<xsl:if test="$annotate.toc != 0">
<!-- * DocBook 5 says inlinemediaobject (among other things) -->
<!-- * is allowed in refpurpose; so we need to run -->
<!-- * apply-templates on refpurpose here, instead of value-of -->
<xsl:apply-templates select="refnamediv/refpurpose" mode="no.anchor.mode"/>
</xsl:if>
</span>
</xsl:element>
</xsl:template>
<xsl:template match="title" mode="toc">
<xsl:param name="toc-context" select="."/>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select=".."/>
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template name="manual-toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="tocentry"/>
<!-- be careful, we don't want to change the current document to the other tree! -->
<xsl:if test="$tocentry">
<xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
<xsl:element name="{$toc.listitem.type}">
<xsl:variable name="label">
<xsl:apply-templates select="$node" mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$node"/>
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
</a>
</xsl:element>
<xsl:if test="$tocentry/*">
<xsl:element name="{$toc.list.type}">
<xsl:call-template name="manual-toc">
<xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:if test="$tocentry/following-sibling::*">
<xsl:call-template name="manual-toc">
<xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="list.of.titles">
<xsl:param name="toc-context" select="."/>
<xsl:param name="titles" select="'table'"/>
<xsl:param name="nodes" select=".//table"/>
<xsl:if test="$nodes">
<div class="list-of-{$titles}s">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="toc-title">
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="$titles='table'">ListofTables</xsl:when>
<xsl:when test="$titles='figure'">ListofFigures</xsl:when>
<xsl:when test="$titles='equation'">ListofEquations</xsl:when>
<xsl:when test="$titles='example'">ListofExamples</xsl:when>
<xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
<xsl:otherwise>ListofUnknown</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="$titles='table'">ListofTables</xsl:when>
<xsl:when test="$titles='figure'">ListofFigures</xsl:when>
<xsl:when test="$titles='equation'">ListofEquations</xsl:when>
<xsl:when test="$titles='example'">ListofExamples</xsl:when>
<xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
<xsl:otherwise>ListofUnknown</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:element>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="figure|table|example|equation|procedure" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:element name="{$toc.listitem.type}">
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</xsl:element>
</xsl:template>
<!-- Used only if qanda.in.toc parameter is non-zero -->
<xsl:template match="qandaset" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="qandadiv | qandaentry"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="qandadiv|qandaentry" mode="toc">
<xsl:apply-templates select="." mode="qandatoc.mode"/>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

1382
build/xsl/html/biblio.xsl Normal file

File diff suppressed because it is too large Load Diff

568
build/xsl/html/block.xsl Normal file
View File

@ -0,0 +1,568 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: block.xsl 9353 2012-05-12 23:24:54Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- What should we do about styling blockinfo? -->
<xsl:template match="blockinfo|info">
<!-- suppress -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="block.object">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="para">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:if test="position() = 1 and parent::listitem">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="parent::listitem"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="paragraph">
<xsl:param name="class" select="''"/>
<xsl:param name="content"/>
<xsl:variable name="p">
<p>
<xsl:call-template name="id.attribute"/>
<xsl:choose>
<xsl:when test="$class != ''">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="class" select="''"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="$content"/>
</p>
</xsl:variable>
<xsl:choose>
<xsl:when test="$html.cleanup != 0">
<xsl:call-template name="unwrap.p">
<xsl:with-param name="p" select="$p"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$p"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="simpara">
<!-- see also listitem/simpara in lists.xsl -->
<p>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="locale.html.attributes"/>
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="@role"/>
</xsl:apply-templates>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="formalpara">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Only use title from info -->
<xsl:template match="formalpara/info">
<xsl:apply-templates select="title"/>
</xsl:template>
<xsl:template match="formalpara/title|formalpara/info/title">
<xsl:variable name="titleStr">
<xsl:apply-templates/>
</xsl:variable>
<xsl:variable name="lastChar">
<xsl:if test="$titleStr != ''">
<xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="formalpara-title">
<xsl:copy-of select="$titleStr"/>
<xsl:if test="$lastChar != ''
and not(contains($runinhead.title.end.punct, $lastChar))">
<xsl:value-of select="$runinhead.default.title.end.punct"/>
</xsl:if>
<xsl:text>&#160;</xsl:text>
</span>
</xsl:when>
<xsl:otherwise>
<b>
<xsl:copy-of select="$titleStr"/>
<xsl:if test="$lastChar != ''
and not(contains($runinhead.title.end.punct, $lastChar))">
<xsl:value-of select="$runinhead.default.title.end.punct"/>
</xsl:if>
<xsl:text>&#160;</xsl:text>
</b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="formalpara/para">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="blockquote">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:choose>
<xsl:when test="attribution">
<table border="{$table.border.off}" class="blockquote">
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:text>width: 100%; cellspacing: 0; cellpadding: 0;</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">Block quote</xsl:attribute>
</xsl:if>
<tr>
<td width="10%" valign="top">&#160;</td>
<td width="80%" valign="top">
<xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
</td>
<td width="10%" valign="top">&#160;</td>
</tr>
<tr>
<td width="10%" valign="top">&#160;</td>
<td colspan="2" align="{$direction.align.end}" valign="top">
<xsl:text>--</xsl:text>
<xsl:apply-templates select="attribution"/>
</td>
</tr>
</table>
</xsl:when>
<xsl:otherwise>
<blockquote>
<xsl:call-template name="common.html.attributes"/>
<xsl:apply-templates/>
</blockquote>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="blockquote/title|blockquote/info/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="blockquote-title">
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="blockquote-title">
<p>
<b>
<xsl:apply-templates/>
</b>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Use an em dash per Chicago Manual of Style and https://sourceforge.net/tracker/index.php?func=detail&aid=2793878&group_id=21935&atid=373747 -->
<xsl:template match="epigraph">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
<xsl:if test="attribution">
<div class="attribution">
<span>&#x2014;<xsl:apply-templates select="attribution"/></span>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="attribution">
<span>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="abstract|sidebar">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:call-template name="sidebar.titlepage"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="abstract/title|sidebar/title">
</xsl:template>
<xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
<!-- ==================================================================== -->
<xsl:template match="msgset">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgentry">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="simplemsgentry">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msg">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msgmain">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgmain/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgmain-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<b><xsl:apply-templates/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgsub">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgsub/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgsub-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<b><xsl:apply-templates/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgrel">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgrel/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgrel-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<b><xsl:apply-templates/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgtext">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msginfo">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msglevel">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msglevel">
<span class="msglevel-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgLevel'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgLevel'"/>
</xsl:call-template>
</b>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgorig">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgorig">
<span class="msgorig-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgOrig'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgOrig'"/>
</xsl:call-template>
</b>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgaud">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgaud">
<span class="msgaud-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgAud'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgAud'"/>
</xsl:call-template>
</b>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgexplan">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msgexplan/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgexplan">
<span class="msgexplan-title">
<xsl:apply-templates/>
</span>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:apply-templates/>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="revhistory">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<table>
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:text>border-style:solid; width:100%;</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- include summary attribute if not HTML5 -->
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">
<xsl:call-template name="gentext">
<xsl:with-param name="key">revhistory</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<tr>
<th align="{$direction.align.start}" valign="top" colspan="3">
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RevHistory'"/>
</xsl:call-template>
</b>
</th>
</tr>
<xsl:apply-templates/>
</table>
</div>
</xsl:template>
<xsl:template match="revhistory/revision">
<xsl:variable name="revnumber" select="revnumber"/>
<xsl:variable name="revdate" select="date"/>
<xsl:variable name="revauthor" select="authorinitials|author"/>
<xsl:variable name="revremark" select="revremark|revdescription"/>
<tr>
<td align="{$direction.align.start}">
<xsl:if test="$revnumber">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Revision'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:apply-templates select="$revnumber"/>
</xsl:if>
</td>
<td align="{$direction.align.start}">
<xsl:apply-templates select="$revdate"/>
</td>
<xsl:choose>
<xsl:when test="count($revauthor)=0">
<td align="{$direction.align.start}">
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">nbsp</xsl:with-param>
</xsl:call-template>
</td>
</xsl:when>
<xsl:otherwise>
<td align="{$direction.align.start}">
<xsl:for-each select="$revauthor">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</td>
</xsl:otherwise>
</xsl:choose>
</tr>
<xsl:if test="$revremark">
<tr>
<td align="{$direction.align.start}" colspan="3">
<xsl:apply-templates select="$revremark"/>
</td>
</tr>
</xsl:if>
</xsl:template>
<xsl:template match="revision/revnumber">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/date">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/authorinitials">
<xsl:text>, </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/authorinitials[1]" priority="2">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/revremark">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/revdescription">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="ackno|acknowledgements[parent::article]">
<xsl:call-template name="block.object"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="highlights">
<xsl:call-template name="block.object"/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

222
build/xsl/html/callout.xsl Normal file
View File

@ -0,0 +1,222 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim"
xmlns:lxslt="http://xml.apache.org/xslt"
exclude-result-prefixes="sverb xverb lxslt"
version='1.0'>
<!-- ********************************************************************
$Id: callout.xsl 9305 2012-04-27 21:50:53Z 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="xverb"
functions="insertCallouts"/>
<xsl:template match="programlistingco|screenco">
<xsl:variable name="verbatim" select="programlisting|screen"/>
<xsl:choose>
<xsl:when test="$use.extensions != '0'
and $callouts.extension != '0'">
<xsl:variable name="rtf">
<xsl:apply-templates select="$verbatim">
<xsl:with-param name="suppress-numbers" select="'1'"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="rtf-with-callouts">
<xsl:choose>
<xsl:when test="function-available('sverb:insertCallouts')">
<xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
</xsl:when>
<xsl:when test="function-available('xverb:insertCallouts')">
<xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>No insertCallouts function is available.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$verbatim/@linenumbering = 'numbered'
and $linenumbering.extension != '0'">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf-with-callouts"/>
<xsl:with-param name="pi.context"
select="programlisting|screen"/>
</xsl:call-template>
<xsl:apply-templates select="calloutlist"/>
</div>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:copy-of select="$rtf-with-callouts"/>
<xsl:apply-templates select="calloutlist"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="areaspec|areaset|area">
</xsl:template>
<xsl:template match="areaset" mode="conumber">
<xsl:number count="area|areaset" format="1"/>
</xsl:template>
<xsl:template match="area" mode="conumber">
<xsl:number count="area|areaset" format="1"/>
</xsl:template>
<xsl:template match="co" name="co">
<!-- Support a single linkend in HTML -->
<xsl:variable name="targets" select="key('id', @linkends)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:choose>
<xsl:when test="$target">
<a>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<!-- force an id attribute here -->
<xsl:if test="@id or @xml:id">
<xsl:attribute name="name">
<xsl:value-of select="(@id|@xml:id)[1]"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="id.attribute"/>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="." mode="callout-bug"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$generate.id.attributes != 0">
<xsl:if test="@id or @xml:id">
<span>
<xsl:attribute name="id">
<xsl:value-of select="(@id|@xml:id)[1]"/>
</xsl:attribute>
</span>
</xsl:if>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="." mode="callout-bug"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="coref">
<!-- tricky; this relies on the fact that we can process the "co" that's -->
<!-- "over there" as if it were "right here" -->
<xsl:variable name="co" select="key('id', @linkend)"/>
<xsl:choose>
<xsl:when test="not($co)">
<xsl:message>
<xsl:text>Error: coref link is broken: </xsl:text>
<xsl:value-of select="@linkend"/>
</xsl:message>
</xsl:when>
<xsl:when test="local-name($co) != 'co'">
<xsl:message>
<xsl:text>Error: coref doesn't point to a co: </xsl:text>
<xsl:value-of select="@linkend"/>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$co"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="co" mode="callout-bug">
<xsl:call-template name="callout-bug">
<xsl:with-param name="conum">
<xsl:number count="co"
level="any"
from="programlisting|screen|literallayout|synopsis"
format="1"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="callout-bug">
<xsl:param name="conum" select='1'/>
<xsl:choose>
<xsl:when test="$callout.graphics != 0
and $conum &lt;= $callout.graphics.number.limit">
<!-- Added span to make valid in XHTML 1 -->
<span><img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}"
alt="{$conum}" border="0"/></span>
</xsl:when>
<xsl:when test="$callout.unicode != 0
and $conum &lt;= $callout.unicode.number.limit">
<xsl:choose>
<xsl:when test="$callout.unicode.start.character = 10102">
<xsl:choose>
<xsl:when test="$conum = 1">&#10102;</xsl:when>
<xsl:when test="$conum = 2">&#10103;</xsl:when>
<xsl:when test="$conum = 3">&#10104;</xsl:when>
<xsl:when test="$conum = 4">&#10105;</xsl:when>
<xsl:when test="$conum = 5">&#10106;</xsl:when>
<xsl:when test="$conum = 6">&#10107;</xsl:when>
<xsl:when test="$conum = 7">&#10108;</xsl:when>
<xsl:when test="$conum = 8">&#10109;</xsl:when>
<xsl:when test="$conum = 9">&#10110;</xsl:when>
<xsl:when test="$conum = 10">&#10111;</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Don't know how to generate Unicode callouts </xsl:text>
<xsl:text>when $callout.unicode.start.character is </xsl:text>
<xsl:value-of select="$callout.unicode.start.character"/>
</xsl:message>
<xsl:text>(</xsl:text>
<xsl:value-of select="$conum"/>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>(</xsl:text>
<xsl:value-of select="$conum"/>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

452
build/xsl/html/chunker.xsl Normal file
View File

@ -0,0 +1,452 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
xmlns:exsl="http://exslt.org/common"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
version="1.0"
exclude-result-prefixes="saxon lxslt redirect exsl doc"
extension-element-prefixes="saxon redirect lxslt exsl">
<!-- ********************************************************************
$Id: chunker.xsl 9147 2011-11-12 00:05:44Z 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 stylesheet works with XSLT implementations that support -->
<!-- exsl:document, saxon:output, or Xalan's redirect:write -->
<!-- Note: Only Saxon 6.4.2 or later is supported. -->
<xsl:param name="chunker.output.method" select="'html'"/>
<xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/>
<xsl:param name="chunker.output.indent" select="'no'"/>
<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
<xsl:param name="chunker.output.standalone" select="'no'"/>
<xsl:param name="chunker.output.doctype-public" select="''"/>
<xsl:param name="chunker.output.doctype-system" select="''"/>
<xsl:param name="chunker.output.media-type" select="''"/>
<xsl:param name="chunker.output.cdata-section-elements" select="''"/>
<!-- Make sure base.dir has a trailing slash now -->
<xsl:param name="chunk.base.dir">
<xsl:choose>
<xsl:when test="string-length($base.dir) = 0"></xsl:when>
<!-- make sure to add trailing slash if omitted by user -->
<xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'">
<xsl:value-of select="$base.dir"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($base.dir, '/')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="saxon.character.representation" select="'entity;decimal'"/>
<!-- ==================================================================== -->
<xsl:template name="make-relative-filename">
<xsl:param name="base.dir" select="'./'"/>
<xsl:param name="base.name" select="''"/>
<xsl:choose>
<!-- put Saxon first to work around a bug in libxslt -->
<xsl:when test="element-available('saxon:output')">
<!-- Saxon doesn't make the chunks relative -->
<xsl:value-of select="concat($chunk.base.dir,$base.name)"/>
</xsl:when>
<xsl:when test="element-available('exsl:document')">
<!-- EXSL document does make the chunks relative, I think -->
<xsl:choose>
<xsl:when test="count(parent::*) = 0">
<xsl:value-of select="concat($chunk.base.dir,$base.name)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$base.name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="element-available('redirect:write')">
<!-- Xalan doesn't make the chunks relative -->
<xsl:value-of select="concat($chunk.base.dir,$base.name)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>Don't know how to chunk with </xsl:text>
<xsl:value-of select="system-property('xsl:vendor')"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="write.chunk">
<xsl:param name="filename" select="''"/>
<xsl:param name="quiet" select="$chunk.quietly"/>
<xsl:param name="suppress-context-node-name" select="0"/>
<xsl:param name="message-prolog"/>
<xsl:param name="message-epilog"/>
<xsl:param name="method" select="$chunker.output.method"/>
<xsl:param name="encoding" select="$chunker.output.encoding"/>
<xsl:param name="indent" select="$chunker.output.indent"/>
<xsl:param name="omit-xml-declaration"
select="$chunker.output.omit-xml-declaration"/>
<xsl:param name="standalone" select="$chunker.output.standalone"/>
<xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
<xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
<xsl:param name="media-type" select="$chunker.output.media-type"/>
<xsl:param name="cdata-section-elements"
select="$chunker.output.cdata-section-elements"/>
<xsl:param name="content"/>
<xsl:if test="$quiet = 0">
<xsl:message>
<xsl:if test="not($message-prolog = '')">
<xsl:value-of select="$message-prolog"/>
</xsl:if>
<xsl:text>Writing </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:if test="name(.) != '' and $suppress-context-node-name = 0">
<xsl:text> for </xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:if test="@id or @xml:id">
<xsl:text>(</xsl:text>
<xsl:value-of select="(@id|@xml:id)[1]"/>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="not($message-epilog = '')">
<xsl:value-of select="$message-epilog"/>
</xsl:if>
</xsl:message>
</xsl:if>
<xsl:choose>
<xsl:when test="element-available('exsl:document')">
<xsl:choose>
<!-- Handle the permutations ... -->
<xsl:when test="$media-type != ''">
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="element-available('saxon:output')">
<xsl:choose>
<!-- Handle the permutations ... -->
<xsl:when test="$media-type != ''">
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="element-available('redirect:write')">
<!-- Xalan uses redirect -->
<redirect:write file="{$filename}">
<xsl:copy-of select="$content"/>
</redirect:write>
</xsl:when>
<xsl:otherwise>
<!-- it doesn't matter since we won't be making chunks... -->
<xsl:message terminate="yes">
<xsl:text>Can't make chunks with </xsl:text>
<xsl:value-of select="system-property('xsl:vendor')"/>
<xsl:text>'s processor.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="write.chunk.with.doctype">
<xsl:param name="filename" select="''"/>
<xsl:param name="quiet" select="$chunk.quietly"/>
<xsl:param name="method" select="$chunker.output.method"/>
<xsl:param name="encoding" select="$chunker.output.encoding"/>
<xsl:param name="indent" select="$chunker.output.indent"/>
<xsl:param name="omit-xml-declaration"
select="$chunker.output.omit-xml-declaration"/>
<xsl:param name="standalone" select="$chunker.output.standalone"/>
<xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
<xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
<xsl:param name="media-type" select="$chunker.output.media-type"/>
<xsl:param name="cdata-section-elements"
select="$chunker.output.cdata-section-elements"/>
<xsl:param name="content"/>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="quiet" select="$quiet"/>
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="encoding" select="$encoding"/>
<xsl:with-param name="indent" select="$indent"/>
<xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/>
<xsl:with-param name="standalone" select="$standalone"/>
<xsl:with-param name="doctype-public" select="$doctype-public"/>
<xsl:with-param name="doctype-system" select="$doctype-system"/>
<xsl:with-param name="media-type" select="$media-type"/>
<xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="write.text.chunk">
<xsl:param name="filename" select="''"/>
<xsl:param name="quiet" select="$chunk.quietly"/>
<xsl:param name="suppress-context-node-name" select="0"/>
<xsl:param name="message-prolog"/>
<xsl:param name="message-epilog"/>
<xsl:param name="method" select="'text'"/>
<xsl:param name="encoding" select="$chunker.output.encoding"/>
<xsl:param name="media-type" select="$chunker.output.media-type"/>
<xsl:param name="content"/>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="quiet" select="$quiet"/>
<xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/>
<xsl:with-param name="message-prolog" select="$message-prolog"/>
<xsl:with-param name="message-epilog" select="$message-epilog"/>
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="encoding" select="$encoding"/>
<xsl:with-param name="indent" select="'no'"/>
<xsl:with-param name="omit-xml-declaration" select="'no'"/>
<xsl:with-param name="standalone" select="'no'"/>
<xsl:with-param name="doctype-public"/>
<xsl:with-param name="doctype-system"/>
<xsl:with-param name="media-type" select="$media-type"/>
<xsl:with-param name="cdata-section-elements"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,471 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: component.xsl 9356 2012-05-12 23:33:15Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- Set to 2 for backwards compatibility -->
<xsl:param name="component.heading.level" select="2"/>
<xsl:template name="component.title">
<xsl:param name="node" select="."/>
<!-- This handles the case where a component (bibliography, for example)
occurs inside a section; will we need parameters for this? -->
<!-- This "level" is a section level. To compute <h> level, add 1. -->
<xsl:variable name="level">
<xsl:choose>
<!-- chapters and other book children should get <h1> -->
<xsl:when test="$node/parent::book">0</xsl:when>
<xsl:when test="ancestor::section">
<xsl:value-of select="count(ancestor::section)+1"/>
</xsl:when>
<xsl:when test="ancestor::sect5">6</xsl:when>
<xsl:when test="ancestor::sect4">5</xsl:when>
<xsl:when test="ancestor::sect3">4</xsl:when>
<xsl:when test="ancestor::sect2">3</xsl:when>
<xsl:when test="ancestor::sect1">2</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$level+1}">
<xsl:attribute name="class">title</xsl:attribute>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$node" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template name="component.subtitle">
<xsl:param name="node" select="."/>
<xsl:variable name="subtitle"
select="($node/docinfo/subtitle
|$node/info/subtitle
|$node/prefaceinfo/subtitle
|$node/chapterinfo/subtitle
|$node/appendixinfo/subtitle
|$node/articleinfo/subtitle
|$node/artheader/subtitle
|$node/subtitle)[1]"/>
<xsl:if test="$subtitle">
<h3 class="subtitle">
<xsl:call-template name="id.attribute"/>
<i>
<xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
</i>
</h3>
</xsl:if>
</xsl:template>
<xsl:template name="component.separator">
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="dedication" mode="dedication">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="dedication.titlepage"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="dedication/title|dedication/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::dedication[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dedication/subtitle|dedication/info/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::dedication[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
<xsl:template match="dedication/title"></xsl:template>
<xsl:template match="dedication/subtitle"></xsl:template>
<xsl:template match="dedication/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="acknowledgements" mode="acknowledgements">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="acknowledgements.titlepage"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="acknowledgements/title|acknowledgements/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="acknowledgements/subtitle|acknowledgements/info/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="acknowledgements"></xsl:template> <!-- see mode="acknowledgements" -->
<xsl:template match="acknowledgements/title"></xsl:template>
<xsl:template match="acknowledgements/subtitle"></xsl:template>
<xsl:template match="acknowledgements/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="colophon">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="component.separator"/>
<xsl:call-template name="component.title"/>
<xsl:call-template name="component.subtitle"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="colophon/title"></xsl:template>
<xsl:template match="colophon/subtitle"></xsl:template>
<xsl:template match="colophon/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="preface">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="component.separator"/>
<xsl:call-template name="preface.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="preface/title" mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::preface[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="preface/subtitle
|preface/prefaceinfo/subtitle
|preface/info/subtitle
|preface/docinfo/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::preface[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="preface/docinfo|prefaceinfo"></xsl:template>
<xsl:template match="preface/info"></xsl:template>
<xsl:template match="preface/title"></xsl:template>
<xsl:template match="preface/titleabbrev"></xsl:template>
<xsl:template match="preface/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="chapter">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="component.separator"/>
<xsl:call-template name="chapter.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="chapter/title|chapter/chapterinfo/title|chapter/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::chapter[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="chapter/subtitle
|chapter/chapterinfo/subtitle
|chapter/info/subtitle
|chapter/docinfo/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::chapter[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
<xsl:template match="chapter/info"></xsl:template>
<xsl:template match="chapter/title"></xsl:template>
<xsl:template match="chapter/titleabbrev"></xsl:template>
<xsl:template match="chapter/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="appendix">
<xsl:variable name="ischunk">
<xsl:call-template name="chunk"/>
</xsl:variable>
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="parent::article and $ischunk = 0">
<xsl:call-template name="section.heading">
<xsl:with-param name="level" select="1"/>
<xsl:with-param name="title">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="component.separator"/>
<xsl:call-template name="appendix.titlepage"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:if test="not(parent::article) or $ischunk != 0">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="appendix/title|appendix/appendixinfo/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::appendix[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="appendix/subtitle
|appendix/appendixinfo/subtitle
|appendix/info/subtitle
|appendix/docinfo/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::appendix[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
<xsl:template match="appendix/info"></xsl:template>
<xsl:template match="appendix/title"></xsl:template>
<xsl:template match="appendix/titleabbrev"></xsl:template>
<xsl:template match="appendix/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="article">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="article.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.lots">
<xsl:with-param name="toc.params" select="$toc.params"/>
<xsl:with-param name="toc">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::article[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="article/subtitle
|article/articleinfo/subtitle
|article/info/subtitle
|article/artheader/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::article[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="article/artheader|article/articleinfo"></xsl:template>
<xsl:template match="article/info"></xsl:template>
<xsl:template match="article/title"></xsl:template>
<xsl:template match="article/titleabbrev"></xsl:template>
<xsl:template match="article/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="topic">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="topic.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="topic/title|topic/info/title" mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::topic[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="topic/subtitle
|topic/info/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::topic[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="topic/info"></xsl:template>
<xsl:template match="topic/title"></xsl:template>
<xsl:template match="topic/titleabbrev"></xsl:template>
<xsl:template match="topic/subtitle"></xsl:template>
</xsl:stylesheet>

212
build/xsl/html/division.xsl Normal file
View File

@ -0,0 +1,212 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: division.xsl 9366 2012-05-12 23:44:25Z 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="set">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="dir">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="language.attribute"/>
<xsl:if test="$generate.id.attributes != 0">
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="set.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.lots">
<xsl:with-param name="toc.params" select="$toc.params"/>
<xsl:with-param name="toc">
<xsl:call-template name="set.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="set/setinfo"></xsl:template>
<xsl:template match="set/title"></xsl:template>
<xsl:template match="set/titleabbrev"></xsl:template>
<xsl:template match="set/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="book">
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="book.titlepage"/>
<xsl:apply-templates select="dedication" mode="dedication"/>
<xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.lots">
<xsl:with-param name="toc.params" select="$toc.params"/>
<xsl:with-param name="toc">
<xsl:call-template name="division.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="book/bookinfo"></xsl:template>
<xsl:template match="book/info"></xsl:template>
<xsl:template match="book/title"></xsl:template>
<xsl:template match="book/titleabbrev"></xsl:template>
<xsl:template match="book/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="part">
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="part.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="not(partintro) and contains($toc.params, 'toc')">
<xsl:call-template name="division.toc"/>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="part" mode="make.part.toc">
<xsl:call-template name="division.toc"/>
</xsl:template>
<xsl:template match="reference" mode="make.part.toc">
<xsl:call-template name="division.toc"/>
</xsl:template>
<xsl:template match="part/docinfo"></xsl:template>
<xsl:template match="part/partinfo"></xsl:template>
<xsl:template match="part/info"></xsl:template>
<xsl:template match="part/title"></xsl:template>
<xsl:template match="part/titleabbrev"></xsl:template>
<xsl:template match="part/subtitle"></xsl:template>
<xsl:template match="partintro">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="partintro.titlepage"/>
<xsl:apply-templates/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<!-- not ancestor::part because partintro appears in reference -->
<xsl:apply-templates select="parent::*" mode="make.part.toc"/>
</xsl:if>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="partintro/title"></xsl:template>
<xsl:template match="partintro/titleabbrev"></xsl:template>
<xsl:template match="partintro/subtitle"></xsl:template>
<xsl:template match="partintro/title" mode="partintro.title.mode">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="partintro/subtitle" mode="partintro.title.mode">
<h3>
<i><xsl:apply-templates/></i>
</h3>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="book" mode="division.number">
<xsl:number from="set" count="book" format="1."/>
</xsl:template>
<xsl:template match="part" mode="division.number">
<xsl:number from="book" count="part" format="I."/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="division.title">
<xsl:param name="node" select="."/>
<h1>
<xsl:attribute name="class">title</xsl:attribute>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$node" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</h1>
</xsl:template>
</xsl:stylesheet>

527
build/xsl/html/docbook.xsl Normal file
View File

@ -0,0 +1,527 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ng="http://docbook.org/docbook-ng"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:exsl="http://exslt.org/common"
xmlns:exslt="http://exslt.org/common"
exclude-result-prefixes="db ng exsl exslt"
version='1.0'>
<xsl:output method="html"
encoding="ISO-8859-1"
indent="no"/>
<!-- ********************************************************************
$Id: docbook.xsl 9396 2012-06-02 21:56:19Z 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="../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="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="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: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">
<xsl:param name="node" select="."/>
<xsl:param name="title">
<xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
</xsl:param>
<title>
<xsl:copy-of select="$title"/>
</title>
<xsl:if test="$html.base != ''">
<base href="{$html.base}"/>
</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 != ''">
<link rev="made"
href="{$link.mailto.url}"/>
</xsl:if>
<meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
<xsl:if test="$generate.meta.abstract != 0">
<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:if>
<xsl:if test="($draft.mode = 'yes' or
($draft.mode = 'maybe' and
ancestor-or-self::*[@status][1]/@status = 'draft'))
and $draft.watermark.image != ''">
<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: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.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 stripped nodeset everywhere, it should
be created as a global variable here.
Used by docbook.xsl, chunk-code.xsl and chunkfast.xsl -->
<xsl:variable name="no.namespace">
<xsl:if test="$exsl.node.set.available != 0
and (*/self::ng:* or */self::db:*)">
<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>
<!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
toss the namespace and continue. Use the docbook5 namespaced
stylesheets for DocBook5 if you don't want to use this feature.-->
<!-- include extra test for Xalan quirk -->
<xsl:when test="$exsl.node.set.available != 0
and (*/self::ng:* or */self::db:*)">
<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: to save stripped document.
<xsl:message>Saving stripped document.</xsl:message>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="'/tmp/stripped.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: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>processing stripped document</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="exsl:node-set($no.namespace)"/>
</xsl:when>
<!-- Can't process unless namespace removed -->
<xsl:when test="*/self::ng:* or */self::db:*">
<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>

331
build/xsl/html/ebnf.xsl Normal file
View File

@ -0,0 +1,331 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: ebnf.xsl 9358 2012-05-12 23:37: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.
******************************************************************** -->
<doc:reference xmlns="">
<referenceinfo>
<releaseinfo role="meta">
$Id: ebnf.xsl 9358 2012-05-12 23:37:10Z bobstayton $
</releaseinfo>
<author><surname>Walsh</surname>
<firstname>Norman</firstname></author>
<copyright><year>1999</year><year>2000</year>
<holder>Norman Walsh</holder>
</copyright>
</referenceinfo>
<title>HTML EBNF Reference</title>
<partintro>
<section><title>Introduction</title>
<para>This is technical reference documentation for the DocBook XSL
Stylesheets; it documents (some of) the parameters, templates, and
other elements of the stylesheets.</para>
<para>This reference describes the templates and parameters relevant
to formatting EBNF markup.</para>
<para>This is not intended to be <quote>user</quote> documentation.
It is provided for developers writing customization layers for the
stylesheets, and for anyone who's interested in <quote>how it
works</quote>.</para>
<para>Although I am trying to be thorough, this documentation is known
to be incomplete. Don't forget to read the source, too :-)</para>
</section>
</partintro>
</doc:reference>
<!-- ==================================================================== -->
<xsl:template match="productionset">
<table width="100%" cellpadding="5">
<xsl:if test="$ebnf.table.bgcolor != ''">
<xsl:attribute name="bgcolor">
<xsl:value-of select="$ebnf.table.bgcolor"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ebnf.table.border != 0">
<xsl:attribute name="border">1</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="summary">
<xsl:text>EBNF</xsl:text>
<xsl:if test="title|info/title">
<xsl:text> for </xsl:text>
<xsl:value-of select="title|info/title[1]"/>
</xsl:if>
</xsl:attribute>
<xsl:if test="title|info/title">
<tr>
<th align="{$direction.align.start}" valign="top">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:apply-templates select="title|info/title[1]"/>
</th>
</tr>
</xsl:if>
<tr>
<td>
<table border="0" width="99%" cellpadding="0">
<xsl:if test="$ebnf.table.bgcolor != ''">
<xsl:attribute name="bgcolor">
<xsl:value-of select="$ebnf.table.bgcolor"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="summary">EBNF productions</xsl:attribute>
<xsl:apply-templates select="production|productionrecap"/>
</table>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="productionset/title">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="production">
<xsl:param name="recap" select="false()"/>
<tr>
<td align="{$direction.align.start}" valign="top" width="3%">
<xsl:text>[</xsl:text>
<xsl:number count="production" level="any"/>
<xsl:text>]</xsl:text>
</td>
<td align="{$direction.align.end}" valign="top" width="10%">
<xsl:choose>
<xsl:when test="$recap">
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="lhs"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="lhs"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td valign="top" width="5%" align="center">
<xsl:copy-of select="$ebnf.assignment"/>
</td>
<td valign="top" width="52%">
<xsl:apply-templates select="rhs"/>
<xsl:copy-of select="$ebnf.statement.terminator"/>
</td>
<td align="{$direction.align.start}" valign="top" width="30%">
<xsl:choose>
<xsl:when test="rhs/lineannotation|constraint">
<xsl:apply-templates select="rhs/lineannotation" mode="rhslo"/>
<xsl:apply-templates select="constraint"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#160;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<xsl:template match="productionrecap">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:if test="count($targets)=0">
<xsl:message>
<xsl:text>Error: no ID for productionrecap linkend: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="count($targets)>1">
<xsl:message>
<xsl:text>Warning: multiple "IDs" for productionrecap linkend: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:apply-templates select="$target">
<xsl:with-param name="recap" select="true()"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="lhs">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="rhs">
<xsl:apply-templates/>
<xsl:if test="following-sibling::rhs">
<xsl:text> |</xsl:text>
<br/>
</xsl:if>
</xsl:template>
<xsl:template match="nonterminal">
<xsl:variable name="linkend">
<xsl:call-template name="xpointer.idref">
<xsl:with-param name="xpointer" select="@def"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="$linkend"/>
</xsl:call-template>
<xsl:call-template name="check.idref.targets">
<xsl:with-param name="linkend" select="$linkend"/>
<xsl:with-param name="element-list">production</xsl:with-param>
</xsl:call-template>
<!-- If you don't provide content, you can't point outside this doc. -->
<xsl:choose>
<xsl:when test="*|text()"><!--nop--></xsl:when>
<xsl:otherwise>
<xsl:if test="$linkend = ''">
<xsl:message>
<xsl:text>Non-terminals with no content must point to </xsl:text>
<xsl:text>production elements in the current document.</xsl:text>
</xsl:message>
<xsl:message>
<xsl:text>Invalid xpointer for empty nt: </xsl:text>
<xsl:value-of select="@def"/>
</xsl:message>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="href">
<xsl:choose>
<xsl:when test="$linkend != ''">
<xsl:variable name="targets" select="key('id',$linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@def"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{$href}">
<xsl:choose>
<xsl:when test="*|text()">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$linkend != ''">
<xsl:variable name="targets" select="key('id',$linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:apply-templates select="$target/lhs"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>???</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:template>
<xsl:template match="rhs/lineannotation">
<!--nop-->
</xsl:template>
<xsl:template match="rhs/lineannotation" mode="rhslo">
<xsl:text>/*&#160;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#160;*/</xsl:text>
<br/>
</xsl:template>
<xsl:template match="constraint">
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<xsl:call-template name="check.idref.targets">
<xsl:with-param name="linkend" select="@linkend"/>
<xsl:with-param name="element-list">constraintdef</xsl:with-param>
</xsl:call-template>
<xsl:variable name="href">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>[&#160;</xsl:text>
<xsl:choose>
<xsl:when test="@role">
<xsl:value-of select="@role"/>
<xsl:text>: </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:if test="$target/@role">
<xsl:value-of select="$target/@role"/>
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<a href="{$href}">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:apply-templates select="$target" mode="title.markup"/>
</a>
<xsl:text>&#160;]</xsl:text>
<xsl:if test="following-sibling::constraint">
<br/>
</xsl:if>
</xsl:template>
<xsl:template match="constraintdef">
<div>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="constraintdef/title">
<p><b><xsl:apply-templates/></b></p>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

350
build/xsl/html/footnote.xsl Normal file
View File

@ -0,0 +1,350 @@
<?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'>
<!-- ********************************************************************
$Id: footnote.xsl 9361 2012-05-12 23:39:44Z 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 template generates just the footnote marker inline.
The footnote text is handled in name="process.footnote".
The footnote marker gets an id of @id, while the
footnote text gets an id of #ftn.@id. They cross link to each other. -->
<xsl:template match="footnote">
<xsl:variable name="href">
<xsl:text>#ftn.</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:variable>
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<sup>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="." mode="footnote.number"/>
<xsl:text>]</xsl:text>
</sup>
</a>
</xsl:template>
<xsl:template match="footnoteref">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="footnote" select="$targets[1]"/>
<xsl:if test="not(local-name($footnote) = 'footnote')">
<xsl:message terminate="yes">
ERROR: A footnoteref element has a linkend that points to an element that is not a footnote.
Typically this happens when an id attribute is accidentally applied to the child of a footnote element.
target element: <xsl:value-of select="local-name($footnote)"/>
linkend/id: <xsl:value-of select="@linkend"/>
</xsl:message>
</xsl:if>
<xsl:variable name="target.href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:value-of select="substring-before($target.href, '#')"/>
<xsl:text>#ftn.</xsl:text>
<xsl:value-of select="substring-after($target.href, '#')"/>
</xsl:variable>
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute"/>
<sup>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="$footnote" mode="footnote.number"/>
<xsl:text>]</xsl:text>
</sup>
</a>
</xsl:template>
<xsl:template match="footnote" mode="footnote.number">
<xsl:choose>
<xsl:when test="string-length(@label) != 0">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="ancestor::table or ancestor::informaltable">
<xsl:variable name="tfnum">
<xsl:number level="any" from="table|informaltable" format="1"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($table.footnote.number.symbols) &gt;= $tfnum">
<xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:number level="any" from="table | informaltable"
format="{$table.footnote.number.format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="pfoot" select="preceding::footnote[not(@label)]"/>
<xsl:variable name="ptfoot" select="preceding::table//footnote |
preceding::informaltable//footnote"/>
<xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/>
<xsl:choose>
<xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
<xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:number value="$fnum" format="{$footnote.number.format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="footnote/para[1]|footnote/simpara[1]" priority="2">
<!-- this only works if the first thing in a footnote is a para, -->
<!-- which is ok, because it usually is. -->
<xsl:variable name="href">
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="ancestor::footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<sup>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
<xsl:text>] </xsl:text>
</sup>
</a>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="*" mode="footnote.body.number">
<xsl:variable name="name">
<xsl:text>ftn.</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="ancestor::footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="ancestor::footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="footnote.mark">
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<xsl:if test="@id or @xml:id">
<xsl:attribute name="name">
<xsl:value-of select="@id|@xml:id"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="id.attribute"/>
</xsl:otherwise>
</xsl:choose>
<sup>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="ancestor::footnote"
mode="footnote.number"/>
<xsl:text>] </xsl:text>
</sup>
</a>
</xsl:variable>
<xsl:variable name="html">
<xsl:apply-templates select="."/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<xsl:variable name="html-nodes" select="exsl:node-set($html)"/>
<xsl:choose>
<xsl:when test="$html-nodes//p">
<xsl:apply-templates select="$html-nodes" mode="insert.html.p">
<xsl:with-param name="mark" select="$footnote.mark"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$html-nodes" mode="insert.html.text">
<xsl:with-param name="mark" select="$footnote.mark"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$html"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!--
<xsl:template name="count-element-from">
<xsl:param name="from" select=".."/>
<xsl:param name="to" select="."/>
<xsl:param name="count" select="0"/>
<xsl:param name="list" select="$from/following::*[local-name(.)=local-name($to)]
|$from/descendant-or-self::*[local-name(.)=local-name($to)]"/>
<xsl:choose>
<xsl:when test="not($list)">
<xsl:text>-1</xsl:text>
</xsl:when>
<xsl:when test="$list[1] = $to">
<xsl:value-of select="$count + 1"/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-->
<!-- ==================================================================== -->
<xsl:template name="process.footnotes">
<xsl:variable name="footnotes" select=".//footnote"/>
<xsl:variable name="table.footnotes"
select=".//table//footnote | .//informaltable//footnote"/>
<!-- Only bother to do this if there's at least one non-table footnote -->
<xsl:if test="count($footnotes)>count($table.footnotes)">
<div class="footnotes">
<xsl:call-template name="footnotes.attributes"/>
<br/>
<hr>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<xsl:attribute name="class">footnote-hr</xsl:attribute>
</xsl:when>
<xsl:when test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:value-of select="concat('width:100; align:',
$direction.align.start,
';')"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="width">100</xsl:attribute>
<xsl:attribute name="align"><xsl:value-of
select="$direction.align.start"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</hr>
<xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
</div>
</xsl:if>
<xsl:if test="$annotation.support != 0 and //annotation">
<div class="annotation-list">
<div class="annotation-nocss">
<p>The following annotations are from this essay. You are seeing
them here because your browser doesnt support the user-interface
techniques used to make them appear as popups on modern browsers.</p>
</div>
<xsl:apply-templates select="//annotation"
mode="annotation-popup"/>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="footnotes.attributes">
<!-- customizable for footnotes attributes -->
</xsl:template>
<xsl:template name="process.chunk.footnotes">
<!-- nop -->
</xsl:template>
<xsl:template match="footnote" name="process.footnote" mode="process.footnote.mode">
<xsl:variable name="id">
<xsl:text>ftn.</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'">
<div id="{$id}">
<xsl:call-template name="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:when test="$html.cleanup != 0 and
$exsl.node.set.available != 0">
<div id="{$id}">
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
<xsl:apply-templates select="*[position() &gt; 1]"/>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Warning: footnote number may not be generated </xsl:text>
<xsl:text>correctly; </xsl:text>
<xsl:value-of select="local-name(*[1])"/>
<xsl:text> unexpected as first child of footnote.</xsl:text>
</xsl:message>
<div id="{$id}">
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="table//footnote | informaltable//footnote"
mode="process.footnote.mode">
</xsl:template>
<xsl:template match="footnote" mode="table.footnote.mode">
<xsl:call-template name="process.footnote"/>
</xsl:template>
</xsl:stylesheet>

507
build/xsl/html/formal.xsl Normal file
View File

@ -0,0 +1,507 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: formal.xsl 9297 2012-04-22 03:56:16Z 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="formal.object.break.after">1</xsl:param>
<xsl:template name="formal.object">
<xsl:param name="placement" select="'before'"/>
<xsl:param name="class">
<xsl:apply-templates select="." mode="class.value"/>
</xsl:param>
<xsl:call-template name="id.warning"/>
<xsl:variable name="content">
<div class="{$class}">
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
<div class="{$class}-contents">
<xsl:apply-templates/>
</div>
<!-- HACK: This doesn't belong inside formal.object; it
should be done by the table template, but I want
the link to be inside the DIV, so... -->
<xsl:if test="local-name(.) = 'table'">
<xsl:call-template name="table.longdesc"/>
</xsl:if>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
<div class="{$class}-contents"><xsl:apply-templates/></div>
<!-- HACK: This doesn't belong inside formal.object; it
should be done by the table template, but I want
the link to be inside the DIV, so... -->
<xsl:if test="local-name(.) = 'table'">
<xsl:call-template name="table.longdesc"/>
</xsl:if>
<xsl:call-template name="formal.object.heading"/>
</xsl:otherwise>
</xsl:choose>
</div>
<xsl:if test="not($formal.object.break.after = '0')">
<br class="{$class}-break"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="floatstyle">
<xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$floatstyle != ''">
<xsl:call-template name="floater">
<xsl:with-param name="class"><xsl:value-of
select="$class"/>-float</xsl:with-param>
<xsl:with-param name="floatstyle" select="$floatstyle"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="formal.object.heading">
<xsl:param name="object" select="."/>
<xsl:param name="title">
<xsl:apply-templates select="$object" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</xsl:param>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<xsl:variable name="html.class" select="concat(local-name($object),'-title')"/>
<div class="{$html.class}">
<xsl:copy-of select="$title"/>
</div>
</xsl:when>
<xsl:otherwise>
<p class="title">
<b>
<xsl:copy-of select="$title"/>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="informal.object">
<xsl:param name="class">
<xsl:apply-templates select="." mode="class.value"/>
</xsl:param>
<xsl:variable name="content">
<div class="{$class}">
<xsl:call-template name="id.attribute"/>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
<!-- HACK: This doesn't belong inside formal.object; it
should be done by the table template, but I want
the link to be inside the DIV, so... -->
<xsl:if test="local-name(.) = 'informaltable'">
<xsl:call-template name="table.longdesc"/>
</xsl:if>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
</div>
</xsl:variable>
<xsl:variable name="floatstyle">
<xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$floatstyle != ''">
<xsl:call-template name="floater">
<xsl:with-param name="class"><xsl:value-of
select="$class"/>-float</xsl:with-param>
<xsl:with-param name="floatstyle" select="$floatstyle"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="semiformal.object">
<xsl:param name="placement" select="'before'"/>
<xsl:param name="class" select="local-name(.)"/>
<xsl:choose>
<xsl:when test="title or info/title">
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="informal.object">
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="figure">
<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>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="table">
<xsl:choose>
<xsl:when test="tgroup|mediaobject|graphic">
<xsl:call-template name="calsTable"/>
</xsl:when>
<xsl:when test="caption">
<xsl:call-template name="htmlTable.with.caption"/>
</xsl:when>
<xsl:otherwise>
<!-- do not use xsl:copy because of XHTML's needs -->
<xsl:element name="table" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
<xsl:call-template name="htmlTable"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Handle html markup table like formal.object -->
<xsl:template name="htmlTable.with.caption">
<xsl:param name="class">
<xsl:apply-templates select="." mode="class.value"/>
</xsl:param>
<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>
<xsl:call-template name="id.warning"/>
<xsl:variable name="content">
<div class="{$class}">
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
<div class="{$class}-contents">
<xsl:apply-templates select="." mode="htmlTable"/>
</div>
<xsl:call-template name="table.longdesc"/>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
<div class="{$class}-contents">
<xsl:apply-templates select="." mode="htmlTable"/>
</div>
<xsl:call-template name="table.longdesc"/>
<xsl:call-template name="formal.object.heading"/>
</xsl:otherwise>
</xsl:choose>
</div>
<xsl:if test="not($formal.object.break.after = '0')">
<br class="{$class}-break"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="floatstyle">
<xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$floatstyle != ''">
<xsl:call-template name="floater">
<xsl:with-param name="class"><xsl:value-of
select="$class"/>-float</xsl:with-param>
<xsl:with-param name="floatstyle" select="$floatstyle"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="calsTable">
<xsl:if test="tgroup/tbody/tr
|tgroup/thead/tr
|tgroup/tfoot/tr">
<xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
</xsl:if>
<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>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="table|informaltable" mode="class.value">
<xsl:choose>
<xsl:when test="@tabstyle">
<xsl:value-of select="@tabstyle"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="htmlTable">
<xsl:if test="tgroup/tbody/row
|tgroup/thead/row
|tgroup/tfoot/row">
<xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
</xsl:if>
<xsl:apply-templates mode="htmlTable"/>
<xsl:if test=".//footnote|../title//footnote">
<tbody class="footnotes">
<tr>
<td colspan="50">
<xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
</td>
</tr>
</tbody>
</xsl:if>
</xsl:template>
<xsl:template match="example">
<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>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="equation">
<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>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="figure/title"></xsl:template>
<xsl:template match="figure/titleabbrev"></xsl:template>
<xsl:template match="table/title"></xsl:template>
<xsl:template match="table/titleabbrev"></xsl:template>
<xsl:template match="table/textobject"></xsl:template>
<xsl:template match="example/title"></xsl:template>
<xsl:template match="example/titleabbrev"></xsl:template>
<xsl:template match="equation/title"></xsl:template>
<xsl:template match="equation/titleabbrev"></xsl:template>
<xsl:template match="informalfigure">
<xsl:call-template name="informal.object"/>
</xsl:template>
<xsl:template match="informalexample">
<xsl:call-template name="informal.object"/>
</xsl:template>
<xsl:template match="informaltable">
<xsl:choose>
<xsl:when test="tgroup|mediaobject|graphic">
<xsl:call-template name="informal.object"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="table" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
<xsl:call-template name="htmlTable"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="informaltable/textobject"></xsl:template>
<xsl:template name="table.longdesc">
<!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
<!-- the table template, but I want the link to be inside the DIV, so... -->
<xsl:variable name="longdesc.uri">
<xsl:call-template name="longdesc.uri">
<xsl:with-param name="mediaobject" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="irrelevant">
<!-- write.longdesc returns the filename ... -->
<xsl:call-template name="write.longdesc">
<xsl:with-param name="mediaobject" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0
and textobject[not(phrase)]">
<xsl:call-template name="longdesc.link">
<xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="informalequation">
<xsl:call-template name="informal.object"/>
</xsl:template>
<xsl:template name="floatstyle">
<xsl:if test="(@float and @float != '0') or @floatstyle != ''">
<xsl:choose>
<xsl:when test="@floatstyle != ''">
<xsl:value-of select="@floatstyle"/>
</xsl:when>
<xsl:when test="@float = '1'">
<xsl:value-of select="$default.float.class"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@float"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="floater">
<xsl:param name="content"/>
<xsl:param name="class" select="'float'"/>
<xsl:param name="floatstyle" select="'left'"/>
<div class="{$class}">
<xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
<xsl:attribute name="style">
<xsl:text>float: </xsl:text>
<xsl:value-of select="$floatstyle"/>
<xsl:text>;</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="$content"/>
</div>
</xsl:template>
</xsl:stylesheet>

521
build/xsl/html/glossary.xsl Normal file
View File

@ -0,0 +1,521 @@
<?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:xlink='http://www.w3.org/1999/xlink'
exclude-result-prefixes="xlink"
version='1.0'>
<!-- ********************************************************************
$Id: glossary.xsl 9364 2012-05-12 23:43:04Z 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="glossary">
&setup-language-variable;
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<xsl:when test="glossdiv">
<xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
</xsl:when>
<xsl:when test="glossentry">
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="glossdiv">
<xsl:apply-templates select="glossdiv"/>
</xsl:when>
<xsl:when test="glossentry">
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:apply-templates select="glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossentry"/>
</xsl:otherwise>
</xsl:choose>
</dl>
</xsl:when>
<xsl:otherwise>
<!-- empty glossary -->
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="glossary/glossaryinfo"></xsl:template>
<xsl:template match="glossary/info"></xsl:template>
<xsl:template match="glossary/title"></xsl:template>
<xsl:template match="glossary/subtitle"></xsl:template>
<xsl:template match="glossary/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="glosslist">
&setup-language-variable;
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:if test="blockinfo/title|info/title|title">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:apply-templates select="glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossentry"/>
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="glossdiv">
&setup-language-variable;
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:apply-templates select="glossentry">
<xsl:sort lang="{$language}"
select="translate(glossterm, $lowercase,
$uppercase)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossentry"/>
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:template>
<xsl:template match="glossdiv/title">
<h3>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</h3>
</xsl:template>
<!-- ==================================================================== -->
<!--
GlossEntry ::=
GlossTerm, Acronym?, Abbrev?,
(IndexTerm)*,
RevHistory?,
(GlossSee | GlossDef+)
-->
<xsl:template match="glossentry">
<xsl:choose>
<xsl:when test="$glossentry.show.acronym = 'primary'">
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:choose>
<xsl:when test="acronym|abbrev">
<xsl:apply-templates select="acronym|abbrev"/>
<xsl:text> (</xsl:text>
<xsl:apply-templates select="glossterm"/>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossterm"/>
</xsl:otherwise>
</xsl:choose>
</dt>
</xsl:when>
<xsl:when test="$glossentry.show.acronym = 'yes'">
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="glossterm"/>
<xsl:if test="acronym|abbrev">
<xsl:text> (</xsl:text>
<xsl:apply-templates select="acronym|abbrev"/>
<xsl:text>)</xsl:text>
</xsl:if>
</dt>
</xsl:when>
<xsl:otherwise>
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="glossterm"/>
</dt>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
</xsl:template>
<xsl:template match="glossentry/glossterm">
<xsl:apply-templates/>
<xsl:if test="following-sibling::glossterm">, </xsl:if>
</xsl:template>
<xsl:template match="glossentry/acronym">
<xsl:apply-templates/>
<xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
</xsl:template>
<xsl:template match="glossentry/abbrev">
<xsl:apply-templates/>
<xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
</xsl:template>
<xsl:template match="glossentry/revhistory">
</xsl:template>
<xsl:template match="glossentry/glosssee">
<xsl:variable name="otherterm" select="@otherterm"/>
<xsl:variable name="targets" select="key('id', $otherterm)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:variable name="xlink" select="@xlink:href"/>
<dd>
<p>
<xsl:variable name="template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'glossary'"/>
<xsl:with-param name="name" select="'see'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$target">
<a>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$target" mode="xref-to"/>
</a>
</xsl:when>
<xsl:when test="$xlink">
<xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$otherterm != '' and not($target)">
<xsl:message>
<xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
<xsl:value-of select="$otherterm"/>
</xsl:message>
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
</p>
</dd>
</xsl:template>
<xsl:template match="glossentry/glossdef">
<dd>
<xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
<xsl:if test="glossseealso">
<p>
<xsl:variable name="template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'glossary'"/>
<xsl:with-param name="name" select="'seealso'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:apply-templates select="glossseealso"/>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
</p>
</xsl:if>
</dd>
</xsl:template>
<xsl:template match="glossseealso">
<xsl:variable name="otherterm" select="@otherterm"/>
<xsl:variable name="targets" select="key('id', $otherterm)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:variable name="xlink" select="@xlink:href"/>
<xsl:choose>
<xsl:when test="$target">
<a>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$target" mode="xref-to"/>
</a>
</xsl:when>
<xsl:when test="$xlink">
<xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$otherterm != '' and not($target)">
<xsl:message>
<xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
<xsl:value-of select="$otherterm"/>
</xsl:message>
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="position() = last()"/>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'glossary'"/>
<xsl:with-param name="name" select="'seealso-separator'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- Glossary collection -->
<xsl:template match="glossary[@role='auto']" priority="2">
&setup-language-variable;
<xsl:variable name="terms"
select="//glossterm[not(parent::glossdef)]|//firstterm"/>
<xsl:variable name="collection" select="document($glossary.collection, .)"/>
<xsl:call-template name="id.warning"/>
<xsl:if test="$glossary.collection = ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary </xsl:text>
<xsl:text>without a glossary.collection file.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="not($collection) and $glossary.collection != ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
<xsl:text>open glossary.collection file '</xsl:text>
<xsl:value-of select="$glossary.collection"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:if>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<xsl:when test="glossdiv and $collection//glossdiv">
<xsl:for-each select="$collection//glossdiv">
<!-- first see if there are any in this div -->
<xsl:variable name="exist.test">
<xsl:for-each select="glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:value-of select="glossterm"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$exist.test != ''">
<xsl:apply-templates select="." mode="auto-glossary">
<xsl:with-param name="terms" select="$terms"/>
</xsl:apply-templates>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:for-each select="$collection//glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$collection//glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</dl>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="*" mode="auto-glossary">
<!-- pop back out to the default mode for most elements -->
<xsl:apply-templates select="."/>
</xsl:template>
<xsl:template match="glossdiv" mode="auto-glossary">
<xsl:param name="terms" select="."/>
&setup-language-variable;
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:for-each select="glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

1568
build/xsl/html/graphics.xsl Normal file

File diff suppressed because it is too large Load Diff

336
build/xsl/html/html-rtf.xsl Normal file
View File

@ -0,0 +1,336 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:set="http://exslt.org/sets"
exclude-result-prefixes="exsl set"
version="1.0">
<!-- ********************************************************************
$Id: html-rtf.xsl 8345 2009-03-16 06:44:07Z 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 contains templates that match against HTML nodes. It is used
to post-process result tree fragments for some sorts of cleanup.
These templates can only ever be fired by a processor that supports
exslt:node-set(). -->
<!-- ==================================================================== -->
<!-- insert.html.p mode templates insert a particular RTF at the beginning
of the first paragraph in the primary RTF. -->
<xsl:template match="/" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:apply-templates mode="insert.html.p">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="insert.html.p">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml"
match="html:p|p" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:if test="not(preceding::p|preceding::html:p)">
<xsl:copy-of select="$mark"/>
</xsl:if>
<xsl:apply-templates mode="insert.html.p">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:copy/>
</xsl:template>
<!-- ==================================================================== -->
<!-- insert.html.text mode templates insert a particular RTF at the beginning
of the first text-node in the primary RTF. -->
<xsl:template match="/" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:apply-templates mode="insert.html.text">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="insert.html.text">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:if test="not(preceding::text())">
<xsl:copy-of select="$mark"/>
</xsl:if>
<xsl:copy/>
</xsl:template>
<xsl:template match="processing-instruction()|comment()" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:copy/>
</xsl:template>
<!-- ==================================================================== -->
<!-- unwrap.p mode templates remove blocks from HTML p elements (and
other places where blocks aren't allowed) -->
<xsl:template name="unwrap.p">
<xsl:param name="p"/>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0
and function-available('set:leading')
and function-available('set:trailing')">
<xsl:apply-templates select="exsl:node-set($p)" mode="unwrap.p"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$p"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml"
match="html:p|p" mode="unwrap.p">
<!-- xmlns:html is necessary for the xhtml stylesheet case -->
<xsl:variable name="blocks" xmlns:html="http://www.w3.org/1999/xhtml"
select="address|blockquote|div|hr|h1|h2|h3|h4|h5|h6
|layer|p|pre|table|dl|menu|ol|ul|form
|html:address|html:blockquote|html:div|html:hr
|html:h1|html:h2|html:h3|html:h4|html:h5|html:h6
|html:layer|html:p|html:pre|html:table|html:dl
|html:menu|html:ol|html:ul|html:form"/>
<xsl:choose>
<xsl:when test="$blocks">
<xsl:call-template name="unwrap.p.nodes">
<xsl:with-param name="wrap" select="."/>
<xsl:with-param name="first" select="1"/>
<xsl:with-param name="nodes" select="node()"/>
<xsl:with-param name="blocks" select="$blocks"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="unwrap.p"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="unwrap.p">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="unwrap.p"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="unwrap.p">
<xsl:copy/>
</xsl:template>
<xsl:template name="unwrap.p.nodes">
<xsl:param name="wrap" select="."/>
<xsl:param name="first" select="0"/>
<xsl:param name="nodes"/>
<xsl:param name="blocks"/>
<xsl:variable name="block" select="$blocks[1]"/>
<!-- This template should never get called if these functions aren't available -->
<!-- but this test is still necessary so that processors don't choke on the -->
<!-- function calls if they don't support the set: functions -->
<xsl:if test="function-available('set:leading')
and function-available('set:trailing')">
<xsl:choose>
<xsl:when test="$blocks">
<xsl:variable name="leading" select="set:leading($nodes,$block)"/>
<xsl:variable name="trailing" select="set:trailing($nodes,$block)"/>
<xsl:if test="(($wrap/@id or $wrap/@xml:id)
and $first = 1) or $leading">
<xsl:element name="{local-name($wrap)}" namespace="{namespace-uri($wrap)}">
<xsl:for-each select="$wrap/@*">
<xsl:if test="$first != 0 or local-name(.) != 'id'">
<xsl:copy/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates select="$leading" mode="unwrap.p"/>
</xsl:element>
</xsl:if>
<xsl:apply-templates select="$block" mode="unwrap.p"/>
<xsl:if test="$trailing">
<xsl:call-template name="unwrap.p.nodes">
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="nodes" select="$trailing"/>
<xsl:with-param name="blocks" select="$blocks[position() &gt; 1]"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="(($wrap/@id or $wrap/@xml:id) and $first = 1) or $nodes">
<xsl:element name="{local-name($wrap)}" namespace="{namespace-uri($wrap)}">
<xsl:for-each select="$wrap/@*">
<xsl:if test="$first != 0 or local-name(.) != 'id'">
<xsl:copy/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates select="$nodes" mode="unwrap.p"/>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<!-- make.verbatim.mode replaces spaces and newlines -->
<xsl:template match="/" mode="make.verbatim.mode">
<xsl:apply-templates mode="make.verbatim.mode"/>
</xsl:template>
<xsl:template match="*" mode="make.verbatim.mode">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="make.verbatim.mode"/>
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction()|comment()" mode="make.verbatim.mode">
<xsl:copy/>
</xsl:template>
<xsl:template match="text()" mode="make.verbatim.mode">
<xsl:variable name="text" select="translate(., ' ', '&#160;')"/>
<xsl:choose>
<xsl:when test="not(contains($text, '&#xA;'))">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="len" select="string-length($text)"/>
<xsl:choose>
<xsl:when test="$len = 1">
<br/><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="half" select="$len div 2"/>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text" select="substring($text, 1, $half)"/>
</xsl:call-template>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text"
select="substring($text, ($half + 1), $len)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make-verbatim-recursive">
<xsl:param name="text" select="''"/>
<xsl:choose>
<xsl:when test="not(contains($text, '&#xA;'))">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="len" select="string-length($text)"/>
<xsl:choose>
<xsl:when test="$len = 1">
<br/><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="half" select="$len div 2"/>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text" select="substring($text, 1, $half)"/>
</xsl:call-template>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text"
select="substring($text, ($half + 1), $len)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- remove.empty.div mode templates remove empty blocks -->
<xsl:template name="remove.empty.div">
<xsl:param name="div"/>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<xsl:apply-templates select="exsl:node-set($div)" mode="remove.empty.div"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$div"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml"
match="html:p|p|html:div|div" mode="remove.empty.div">
<xsl:if test="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="remove.empty.div"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="remove.empty.div">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="remove.empty.div"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="remove.empty.div">
<xsl:copy/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

698
build/xsl/html/html.xsl Normal file
View File

@ -0,0 +1,698 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: html.xsl 9306 2012-04-28 03:49:00Z 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.
******************************************************************** -->
<!-- These variables set the align attribute value for HTML output based on
the writing-mode specified in the gentext file for the document's lang. -->
<xsl:variable name="direction.align.start">
<xsl:choose>
<xsl:when test="starts-with($writing.mode, 'lr')">left</xsl:when>
<xsl:when test="starts-with($writing.mode, 'rl')">right</xsl:when>
<xsl:otherwise>left</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="direction.align.end">
<xsl:choose>
<xsl:when test="starts-with($writing.mode, 'lr')">right</xsl:when>
<xsl:when test="starts-with($writing.mode, 'rl')">left</xsl:when>
<xsl:otherwise>right</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="direction.mode">
<xsl:choose>
<xsl:when test="starts-with($writing.mode, 'lr')">ltr</xsl:when>
<xsl:when test="starts-with($writing.mode, 'rl')">rtl</xsl:when>
<xsl:otherwise>ltr</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Support switching to <section> for HTML5 stylesheet -->
<!-- This is an internal variable that does not need to be set by a user -->
<xsl:variable name="div.element">div</xsl:variable>
<!-- Support turning off table border with border="" for HTML5 -->
<xsl:variable name="table.border.off">0</xsl:variable>
<!-- The generate.html.title template is currently used for generating HTML -->
<!-- "title" attributes for some inline elements only, but not for any -->
<!-- block elements. It is called in eleven places in the inline.xsl -->
<!-- file. But it's called by all the inline.* templates (e.g., -->
<!-- inline.boldseq), which in turn are called by other (element) -->
<!-- templates, so it results, currently, in supporting generation of the -->
<!-- HTML "title" attribute for a total of about 92 elements. -->
<!-- You can use mode="html.title.attribute" to get a title for -->
<!-- an element specified by a param, including targets of cross references. -->
<xsl:template name="generate.html.title">
<xsl:apply-templates select="." mode="html.title.attribute"/>
</xsl:template>
<xsl:template match="acronym|abbrev" mode="html.title.attribute">
<xsl:if test="alt">
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(alt)"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- Generate a title attribute for the context node -->
<!-- This may be the target of an xref -->
<xsl:template match="*" mode="html.title.attribute">
<xsl:variable name="is.title">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name" select="local-name(.)"/>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="is.title-numbered">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name" select="local-name(.)"/>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="is.title-unnumbered">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name" select="local-name(.)"/>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="has.title.markup">
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="gentext.title">
<xsl:if test="$has.title.markup != '???TITLE???' and
($is.title != 0 or
$is.title-numbered != 0 or
$is.title-unnumbered != 0)">
<xsl:apply-templates select="."
mode="object.title.markup.textonly"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($gentext.title) != 0">
<xsl:attribute name="title">
<xsl:value-of select="$gentext.title"/>
</xsl:attribute>
</xsl:when>
<!-- Fall back to alt if available -->
<xsl:when test="alt">
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(alt)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="qandaentry" mode="html.title.attribute">
<xsl:apply-templates select="question" mode="html.title.attribute"/>
</xsl:template>
<xsl:template match="question" mode="html.title.attribute">
<xsl:variable name="label.text">
<xsl:apply-templates select="." mode="qanda.label"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($label.text) != 0">
<xsl:attribute name="title">
<xsl:value-of select="$label.text"/>
</xsl:attribute>
</xsl:when>
<!-- Fall back to alt if available -->
<xsl:when test="alt">
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(alt)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="dir">
<xsl:param name="inherit" select="0"/>
<xsl:variable name="dir">
<xsl:choose>
<xsl:when test="@dir">
<xsl:value-of select="@dir"/>
</xsl:when>
<xsl:when test="$inherit != 0">
<xsl:value-of select="ancestor::*/@dir[1]"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="$dir != ''">
<xsl:attribute name="dir">
<xsl:value-of select="$dir"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="anchor">
<xsl:param name="node" select="."/>
<xsl:param name="conditional" select="1"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes != 0">
<!-- No named anchors output when this param is set -->
</xsl:when>
<xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
<a>
<xsl:attribute name="name">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$node"/>
</xsl:call-template>
</xsl:attribute>
</a>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="id.attribute">
<xsl:param name="node" select="."/>
<xsl:param name="conditional" select="1"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<!-- No id attributes when this param is zero -->
</xsl:when>
<xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
<xsl:attribute name="id">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$node"/>
</xsl:call-template>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="href.target.uri">
<xsl:param name="context" select="."/>
<xsl:param name="object" select="."/>
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="href.target">
<xsl:param name="context" select="."/>
<xsl:param name="object" select="."/>
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="href.target.with.base.dir">
<xsl:param name="context" select="."/>
<xsl:param name="object" select="."/>
<xsl:if test="$manifest.in.base.dir = 0">
<xsl:value-of select="$chunk.base.dir"/>
</xsl:if>
<xsl:call-template name="href.target">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="dingbat">
<xsl:param name="dingbat">bullet</xsl:param>
<xsl:call-template name="dingbat.characters">
<xsl:with-param name="dingbat" select="$dingbat"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="dingbat.characters">
<!-- now that I'm using the real serializer, all that dingbat malarky -->
<!-- isn't necessary anymore... -->
<xsl:param name="dingbat">bullet</xsl:param>
<xsl:choose>
<xsl:when test="$dingbat='bullet'">&#x2022;</xsl:when>
<xsl:when test="$dingbat='copyright'">&#x00A9;</xsl:when>
<xsl:when test="$dingbat='trademark'">&#x2122;</xsl:when>
<xsl:when test="$dingbat='trade'">&#x2122;</xsl:when>
<xsl:when test="$dingbat='registered'">&#x00AE;</xsl:when>
<xsl:when test="$dingbat='service'">(SM)</xsl:when>
<xsl:when test="$dingbat='nbsp'">&#x00A0;</xsl:when>
<xsl:when test="$dingbat='ldquo'">&#x201C;</xsl:when>
<xsl:when test="$dingbat='rdquo'">&#x201D;</xsl:when>
<xsl:when test="$dingbat='lsquo'">&#x2018;</xsl:when>
<xsl:when test="$dingbat='rsquo'">&#x2019;</xsl:when>
<xsl:when test="$dingbat='em-dash'">&#x2014;</xsl:when>
<xsl:when test="$dingbat='mdash'">&#x2014;</xsl:when>
<xsl:when test="$dingbat='en-dash'">&#x2013;</xsl:when>
<xsl:when test="$dingbat='ndash'">&#x2013;</xsl:when>
<xsl:otherwise>
<xsl:text>&#x2022;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="id.warning">
<xsl:if test="$id.warnings != 0 and not(@id) and not(@xml:id) and parent::*">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="title">
<xsl:value-of select="title[1]"/>
</xsl:when>
<xsl:when test="substring(local-name(*[1]),
string-length(local-name(*[1])-3) = 'info')
and *[1]/title">
<xsl:value-of select="*[1]/title[1]"/>
</xsl:when>
<xsl:when test="refmeta/refentrytitle">
<xsl:value-of select="refmeta/refentrytitle"/>
</xsl:when>
<xsl:when test="refnamediv/refname">
<xsl:value-of select="refnamediv/refname[1]"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:message>
<xsl:text>ID recommended on </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:if test="$title != ''">
<xsl:text>: </xsl:text>
<xsl:choose>
<xsl:when test="string-length($title) &gt; 40">
<xsl:value-of select="substring($title,1,40)"/>
<xsl:text>...</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:message>
</xsl:if>
</xsl:template>
<xsl:template name="generate.class.attribute">
<xsl:param name="class" select="local-name(.)"/>
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="class.attribute">
<xsl:param name="class" select="local-name(.)"/>
<!-- permit customization of class attributes -->
<!-- Use element name by default -->
<xsl:variable name="class.value">
<xsl:apply-templates select="." mode="class.value">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:if test="string-length(normalize-space($class.value)) != 0">
<xsl:attribute name="class">
<xsl:value-of select="$class.value"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="class.value">
<xsl:param name="class" select="local-name(.)"/>
<!-- permit customization of class value only -->
<!-- Use element name by default -->
<xsl:value-of select="$class"/>
</xsl:template>
<!-- Apply common attributes such as class, lang, dir -->
<xsl:template name="common.html.attributes">
<xsl:param name="inherit" select="0"/>
<xsl:param name="class" select="local-name(.)"/>
<xsl:apply-templates select="." mode="common.html.attributes">
<xsl:with-param name="class" select="$class"/>
<xsl:with-param name="inherit" select="$inherit"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="common.html.attributes">
<xsl:param name="class" select="local-name(.)"/>
<xsl:param name="inherit" select="0"/>
<xsl:call-template name="generate.html.lang"/>
<xsl:call-template name="dir">
<xsl:with-param name="inherit" select="$inherit"/>
</xsl:call-template>
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:template>
<!-- Apply common attributes not including class -->
<xsl:template name="locale.html.attributes">
<xsl:apply-templates select="." mode="locale.html.attributes"/>
</xsl:template>
<xsl:template match="*" mode="locale.html.attributes">
<xsl:call-template name="generate.html.lang"/>
<xsl:call-template name="dir"/>
</xsl:template>
<!-- Pass through any lang attributes -->
<xsl:template name="generate.html.lang">
<xsl:apply-templates select="." mode="html.lang.attribute"/>
</xsl:template>
<xsl:template match="*" mode="html.lang.attribute">
<!-- match the attribute name to the output type -->
<xsl:choose>
<xsl:when test="@lang and $stylesheet.result.type = 'html'">
<xsl:attribute name="lang">
<xsl:value-of select="@lang"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@lang and $stylesheet.result.type = 'xhtml'">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@lang"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@xml:lang and $stylesheet.result.type = 'html'">
<xsl:attribute name="lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@xml:lang and $stylesheet.result.type = 'xhtml'">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- Insert link to css or insert literal CSS in head element -->
<xsl:template name="generate.css">
<xsl:choose>
<xsl:when test="$generate.css.header = 0">
<xsl:call-template name="generate.css.links"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generate.css.headers"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="generate.css.headers">
<xsl:call-template name="generate.default.css.header"/>
<xsl:call-template name="generate.custom.css.header"/>
</xsl:template>
<xsl:template name="generate.default.css.header">
<xsl:if test="$make.clean.html != 0 and
$docbook.css.source != ''">
<!-- Select default file relative to stylesheet -->
<xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
<xsl:call-template name="output.css.header">
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.custom.css.header">
<xsl:if test="$custom.css.source != ''">
<!-- Select custom file relative to document -->
<xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
<xsl:call-template name="output.css.header">
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="output.css.header">
<xsl:param name="css.node"/>
<xsl:choose>
<xsl:when test="count($css.node) = 0">
</xsl:when>
<xsl:otherwise>
<style type="text/css">
<xsl:copy-of select="$css.node/text()"/>
</style>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="generate.css.links">
<xsl:call-template name="generate.default.css.link"/>
<xsl:call-template name="generate.custom.css.link"/>
</xsl:template>
<xsl:template name="generate.default.css.link">
<xsl:if test="$make.clean.html != 0 and
$docbook.css.link != 0 and
$docbook.css.source != ''">
<xsl:variable name="filename">
<xsl:call-template name="css.output.filename">
<xsl:with-param name="src" select="$docbook.css.source"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.css.link">
<xsl:with-param name="css.filename" select="$filename"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.custom.css.link">
<xsl:if test="$custom.css.source != ''">
<xsl:variable name="filename">
<xsl:call-template name="css.output.filename">
<xsl:with-param name="src" select="$custom.css.source"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.css.link">
<xsl:with-param name="css.filename" select="$filename"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- a CSS link reference must take into account the relative
path to a CSS file when chunked HTML is output to more than one directory -->
<xsl:template name="make.css.link">
<xsl:param name="css.filename" select="''"/>
<xsl:variable name="href">
<xsl:call-template name="relative.path.link">
<xsl:with-param name="target.pathname" select="$css.filename"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($css.filename) != 0">
<link rel="stylesheet"
type="text/css"
href="{$href}"/>
</xsl:if>
</xsl:template>
<!-- And the same applies to script links -->
<xsl:template name="make.script.link">
<xsl:param name="script.filename" select="''"/>
<xsl:variable name="src">
<xsl:call-template name="relative.path.link">
<xsl:with-param name="target.pathname" select="$script.filename"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($script.filename) != 0">
<script>
<xsl:attribute name="src">
<xsl:value-of select="$src"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="$html.script.type"/>
</xsl:attribute>
<xsl:call-template name="other.script.attributes">
<xsl:with-param name="script.filename" select="$script.filename"/>
</xsl:call-template>
</script>
</xsl:if>
</xsl:template>
<xsl:template name="other.script.attributes">
<xsl:param name="script.filename"/>
<!-- Placeholder template to allow customization to
insert additional script element attributes if needed -->
</xsl:template>
<xsl:template name="relative.path.link">
<xsl:param name="target.pathname"/>
<xsl:variable name="href.to.uri" select="$target.pathname"/>
<xsl:variable name="href.from.uri">
<xsl:call-template name="href.target.uri">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href.to">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="$href.to.uri"/>
<xsl:with-param name="uriB" select="$href.from.uri"/>
<xsl:with-param name="return" select="'A'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href.from">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="$href.to.uri"/>
<xsl:with-param name="uriB" select="$href.from.uri"/>
<xsl:with-param name="return" select="'B'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="depth">
<xsl:call-template name="count.uri.path.depth">
<xsl:with-param name="filename" select="$href.from"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:call-template name="copy-string">
<xsl:with-param name="string" select="'../'"/>
<xsl:with-param name="count" select="$depth"/>
</xsl:call-template>
<xsl:value-of select="$href.to"/>
</xsl:variable>
<xsl:value-of select="$href"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="generate.css.files">
<xsl:call-template name="generate.default.css.file"/>
<xsl:call-template name="generate.custom.css.file"/>
</xsl:template>
<xsl:template name="generate.default.css.file">
<xsl:if test="$make.clean.html != 0 and
$generate.css.header = 0 and
$docbook.css.source != ''">
<!-- Select default file relative to stylesheet -->
<xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
<xsl:call-template name="generate.css.file">
<xsl:with-param name="src" select="$docbook.css.source"/>
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.custom.css.file">
<xsl:if test="$custom.css.source != '' and
$generate.css.header = 0">
<!-- Select custom file relative to document -->
<xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
<xsl:call-template name="generate.css.file">
<xsl:with-param name="src" select="$custom.css.source"/>
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.css.file">
<xsl:param name="css.node"/>
<xsl:param name="src" select="''"/>
<xsl:variable name="css.text" select="$css.node/text()"/>
<xsl:choose>
<xsl:when test="count($css.node) = 0">
<xsl:message>
<xsl:text>ERROR: no root element for CSS source file'</xsl:text>
<xsl:value-of select="$src"/>
<xsl:text>'.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="filename">
<xsl:call-template name="css.output.pathname">
<xsl:with-param name="src" select="$src"/>
<xsl:with-param name="content" select="$css.node"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="content" select="$css.text"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="css.output.filename">
<xsl:param name="content"/>
<xsl:param name="src" select="''"/>
<xsl:variable name="candidate">
<xsl:choose>
<xsl:when test="string-length($src) = 0">
<xsl:message>
<xsl:text>ERROR: missing CSS input filename.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:when test="substring($src,string-length($src)-3) = '.xml'">
<xsl:value-of select="substring($src, 1, string-length($src) - 4)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$src"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$candidate"/>
</xsl:template>
<xsl:template name="css.output.pathname">
<xsl:param name="content"/>
<xsl:param name="src" select="''"/>
<xsl:variable name="file">
<xsl:call-template name="css.output.filename">
<xsl:with-param name="content" select="$content"/>
<xsl:with-param name="src" select="$src"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="path" select="concat($chunk.base.dir, $file)"/>
<xsl:value-of select="$path"/>
</xsl:template>
</xsl:stylesheet>

136
build/xsl/html/htmltbl.xsl Normal file
View File

@ -0,0 +1,136 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- ********************************************************************
$Id: htmltbl.xsl 9140 2011-10-30 03:42:11Z 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="table" mode="htmlTable">
<xsl:element name="table" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
<xsl:call-template name="htmlTable"/>
</xsl:element>
</xsl:template>
<xsl:template match="colgroup" mode="htmlTable">
<xsl:element name="{local-name()}" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:apply-templates mode="htmlTable"/>
</xsl:element>
</xsl:template>
<xsl:template match="col" mode="htmlTable">
<xsl:element name="{local-name()}" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
</xsl:element>
</xsl:template>
<!-- Handled by formal.object.title template -->
<xsl:template match="caption" mode="htmlTable"/>
<xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:apply-templates mode="htmlTable"/>
</xsl:element>
</xsl:template>
<xsl:template match="th|td" mode="htmlTable">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:apply-templates/> <!-- *not* mode=htmlTable -->
</xsl:element>
</xsl:template>
<!-- don't copy through DocBook-specific attributes on HTML table markup -->
<!-- default behavior is to not copy through because there are more
DocBook attributes than HTML attributes -->
<xsl:template mode="htmlTableAtt" match="@*"/>
<!-- copy these through -->
<xsl:template mode="htmlTableAtt"
match="@abbr
| @align
| @axis
| @bgcolor
| @border
| @cellpadding
| @cellspacing
| @char
| @charoff
| @class
| @dir
| @frame
| @headers
| @height
| @lang
| @nowrap
| @onclick
| @ondblclick
| @onkeydown
| @onkeypress
| @onkeyup
| @onmousedown
| @onmousemove
| @onmouseout
| @onmouseover
| @onmouseup
| @rules
| @style
| @summary
| @title
| @valign
| @valign
| @width
| @xml:lang">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="@span|@rowspan|@colspan" mode="htmlTableAtt">
<!-- No need to copy through the DTD's default value "1" of the attribute -->
<xsl:if test="number(.) != 1">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- map floatstyle to HTML float values -->
<xsl:template match="@floatstyle" mode="htmlTableAtt">
<xsl:attribute name="style">
<xsl:text>float: </xsl:text>
<xsl:choose>
<xsl:when test="contains(., 'left')">left</xsl:when>
<xsl:when test="contains(., 'right')">right</xsl:when>
<xsl:when test="contains(., 'start')">
<xsl:value-of select="$direction.align.start"/>
</xsl:when>
<xsl:when test="contains(., 'end')">
<xsl:value-of select="$direction.align.end"/>
</xsl:when>
<xsl:when test="contains(., 'inside')">
<xsl:value-of select="$direction.align.start"/>
</xsl:when>
<xsl:when test="contains(., 'outside')">
<xsl:value-of select="$direction.align.end"/>
</xsl:when>
<xsl:when test="contains(., 'before')">none</xsl:when>
<xsl:when test="contains(., 'none')">none</xsl:when>
</xsl:choose>
<xsl:text>;</xsl:text>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>

279
build/xsl/html/index.xsl Normal file
View File

@ -0,0 +1,279 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: index.xsl 9297 2012-04-22 03:56:16Z 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="index">
<!-- some implementations use completely empty index tags to indicate -->
<!-- where an automatically generated index should be inserted. so -->
<!-- if the index is completely empty, skip it. Unless generate.index -->
<!-- is non-zero, in which case, this is where the automatically -->
<!-- generated index should go. -->
<xsl:call-template name="id.warning"/>
<xsl:if test="count(*)>0 or $generate.index != '0'">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="index.titlepage"/>
<xsl:choose>
<xsl:when test="indexdiv">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[not(self::indexentry)]"/>
<!-- Because it's actually valid for Index to have neither any -->
<!-- Indexdivs nor any Indexentries, we need to check and make -->
<!-- sure that at least one Indexentry exists, and generate a -->
<!-- wrapper dl if there is at least one; otherwise, do nothing. -->
<xsl:if test="indexentry">
<!-- The indexentry template assumes a parent dl wrapper has -->
<!-- been generated; for Indexes that have Indexdivs, the dl -->
<!-- wrapper is generated by the indexdiv template; however, -->
<!-- for Indexes that lack Indexdivs, if we don't generate a -->
<!-- dl here, HTML output will not be valid. -->
<dl>
<xsl:apply-templates select="indexentry"/>
</dl>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
<xsl:call-template name="generate-index">
<xsl:with-param name="scope" select="(ancestor::book|/)[last()]"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="setindex">
<!-- some implementations use completely empty index tags to indicate -->
<!-- where an automatically generated index should be inserted. so -->
<!-- if the index is completely empty, skip it. Unless generate.index -->
<!-- is non-zero, in which case, this is where the automatically -->
<!-- generated index should go. -->
<xsl:call-template name="id.warning"/>
<xsl:if test="count(*)>0 or $generate.index != '0'">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="setindex.titlepage"/>
<xsl:apply-templates/>
<xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
<xsl:call-template name="generate-index">
<xsl:with-param name="scope" select="/"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="index/indexinfo"></xsl:template>
<xsl:template match="index/info"></xsl:template>
<xsl:template match="index/title"></xsl:template>
<xsl:template match="index/subtitle"></xsl:template>
<xsl:template match="index/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="indexdiv">
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="*[not(self::indexentry)]"/>
<dl>
<xsl:apply-templates select="indexentry"/>
</dl>
</div>
</xsl:template>
<xsl:template match="indexdiv/title">
<h3>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</h3>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="indexterm">
<!-- this one must have a name, even if it doesn't have an ID -->
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<a class="indexterm" name="{$id}"/>
</xsl:template>
<xsl:template match="primary|secondary|tertiary|see|seealso">
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="indexentry">
<xsl:apply-templates select="primaryie"/>
</xsl:template>
<xsl:template match="primaryie">
<dt>
<xsl:apply-templates/>
</dt>
<dd>
<xsl:apply-templates select="following-sibling::seeie
[not(preceding-sibling::secondaryie)]"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::seealsoie
[not(preceding-sibling::secondaryie)]"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::secondaryie"
mode="indexentry"/>
</dd>
</xsl:template>
<!-- Handled in mode to convert flat list to structured output -->
<xsl:template match="secondaryie">
</xsl:template>
<xsl:template match="tertiaryie">
</xsl:template>
<xsl:template match="seeie|seealsoie">
</xsl:template>
<xsl:template match="secondaryie" mode="indexentry">
<dl>
<dt>
<xsl:apply-templates/>
</dt>
<dd>
<!-- select following see* elements up to next secondaryie or tertiary or end -->
<xsl:variable name="after.this"
select="following-sibling::*"/>
<xsl:variable name="next.entry"
select="(following-sibling::secondaryie|following-sibling::tertiaryie)[1]"/>
<xsl:variable name="before.entry"
select="$next.entry/preceding-sibling::*"/>
<xsl:variable name="see.intersection"
select="$after.this[count(.|$before.entry) = count($before.entry)]
[self::seeie or self::seealsoie]"/>
<xsl:choose>
<xsl:when test="count($see.intersection) != 0">
<xsl:apply-templates select="$see.intersection" mode="indexentry"/>
</xsl:when>
<xsl:when test="count($next.entry) = 0">
<xsl:apply-templates select="following-sibling::seeie"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::seealsoie"
mode="indexentry"/>
</xsl:when>
</xsl:choose>
<!-- now process any tertiaryie before the next secondaryie -->
<xsl:variable name="before.next.secondary"
select="following-sibling::secondaryie[1]/preceding-sibling::*"/>
<xsl:variable name="tertiary.intersection"
select="$after.this[count(.|$before.next.secondary) =
count($before.next.secondary)]
[not(self::seeie) and not(self::seealsoie)]"/>
<xsl:choose>
<xsl:when test="count($tertiary.intersection) != 0">
<xsl:apply-templates select="$tertiary.intersection"
mode="indexentry"/>
</xsl:when>
<xsl:when test="not(following-sibling::secondaryie)">
<xsl:apply-templates select="following-sibling::tertiaryie"
mode="indexentry"/>
</xsl:when>
</xsl:choose>
</dd>
</dl>
</xsl:template>
<xsl:template match="tertiaryie" mode="indexentry">
<dl>
<dt>
<xsl:apply-templates/>
</dt>
<dd>
<!-- select following see* elements up to next secondaryie or tertiary or end -->
<xsl:variable name="after.this"
select="following-sibling::*"/>
<xsl:variable name="next.entry"
select="(following-sibling::secondaryie|following-sibling::tertiaryie)[1]"/>
<xsl:variable name="before.entry"
select="$next.entry/preceding-sibling::*"/>
<xsl:variable name="see.intersection"
select="$after.this[count(.|$before.entry) = count($before.entry)]
[self::seeie or self::seealsoie]"/>
<xsl:choose>
<xsl:when test="count($see.intersection) != 0">
<xsl:apply-templates select="$see.intersection" mode="indexentry"/>
</xsl:when>
<xsl:when test="count($next.entry) = 0">
<xsl:apply-templates select="following-sibling::seeie"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::seealsoie"
mode="indexentry"/>
</xsl:when>
</xsl:choose>
</dd>
</dl>
</xsl:template>
<xsl:template match="seeie" mode="indexentry">
<dt>
<xsl:text>(</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'see'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
</dt>
</xsl:template>
<xsl:template match="seealsoie" mode="indexentry">
<div>
<xsl:text>(</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'seealso'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
</div>
</xsl:template>
</xsl:stylesheet>

45
build/xsl/html/info.xsl Normal file
View File

@ -0,0 +1,45 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: info.xsl 9297 2012-04-22 03:56:16Z 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.
******************************************************************** -->
<!-- These templates define the "default behavior" for info
elements. Even if you don't process the *info wrappers,
some of these elements are needed because the elements are
processed from named templates that are called with modes.
Since modes aren't sticky, these rules apply.
(TODO: clarify this comment) -->
<!-- ==================================================================== -->
<!-- called from named templates in a given mode -->
<xsl:template match="corpauthor">
<span>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="jobtitle">
<span>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

1518
build/xsl/html/inline.xsl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: keywords.xsl 6910 2007-06-28 23:23:30Z xmldoc $
********************************************************************
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="keywordset"></xsl:template>
<xsl:template match="subjectset"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="keywordset" mode="html.header">
<meta name="keywords">
<xsl:attribute name="content">
<xsl:apply-templates select="keyword" mode="html.header"/>
</xsl:attribute>
</meta>
</xsl:template>
<xsl:template match="keyword" mode="html.header">
<xsl:apply-templates/>
<xsl:if test="following-sibling::keyword">, </xsl:if>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

1287
build/xsl/html/lists.xsl Normal file

File diff suppressed because it is too large Load Diff

271
build/xsl/html/math.xsl Normal file
View File

@ -0,0 +1,271 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="mml"
version='1.0'>
<!-- ********************************************************************
$Id: math.xsl 9297 2012-04-22 03:56:16Z 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="inlineequation">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="alt">
</xsl:template>
<xsl:template match="mathphrase">
<span>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- "Support" for MathML -->
<xsl:template match="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- Support for TeX math in alt -->
<xsl:template match="*" mode="collect.tex.math">
<xsl:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$tex.math.file"/>
<xsl:with-param name="method" select="'text'"/>
<xsl:with-param name="content">
<xsl:choose>
<xsl:when test="$tex.math.in.alt = 'plain'">
<xsl:call-template name="tex.math.plain.head"/>
<xsl:apply-templates select="." mode="collect.tex.math.plain"/>
<xsl:call-template name="tex.math.plain.tail"/>
</xsl:when>
<xsl:when test="$tex.math.in.alt = 'latex'">
<xsl:call-template name="tex.math.latex.head"/>
<xsl:apply-templates select="." mode="collect.tex.math.latex"/>
<xsl:call-template name="tex.math.latex.tail"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Unsupported TeX math notation:
<xsl:value-of select="$tex.math.in.alt"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="encoding" select="$chunker.output.encoding"/>
</xsl:call-template>
</xsl:template>
<!-- PlainTeX -->
<xsl:template name="tex.math.plain.head">
<xsl:text>\nopagenumbers &#xA;</xsl:text>
</xsl:template>
<xsl:template name="tex.math.plain.tail">
<xsl:text>\bye &#xA;</xsl:text>
</xsl:template>
<xsl:template match="inlineequation" mode="collect.tex.math.plain">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="inlinemediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\vfill\eject &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="equation|informalequation" mode="collect.tex.math.plain">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="mediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\vfill\eject &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="text()" mode="collect.tex.math.plain"/>
<!-- LaTeX -->
<xsl:template name="tex.math.latex.head">
<xsl:text>\documentclass{article} &#xA;</xsl:text>
<xsl:text>\pagestyle{empty} &#xA;</xsl:text>
<xsl:text>\begin{document} &#xA;</xsl:text>
</xsl:template>
<xsl:template name="tex.math.latex.tail">
<xsl:text>\end{document} &#xA;</xsl:text>
</xsl:template>
<xsl:template match="inlineequation" mode="collect.tex.math.latex">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="inlinemediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\newpage &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="equation|informalequation" mode="collect.tex.math.latex">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="mediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\newpage &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="text()" mode="collect.tex.math.latex"/>
<!-- Extracting image filename from mediaobject and graphic elements -->
<xsl:template name="select.mediaobject.filename">
<xsl:param name="olist"
select="imageobject|imageobjectco
|videoobject|audioobject|textobject"/>
<xsl:variable name="mediaobject.index">
<xsl:call-template name="select.mediaobject.index">
<xsl:with-param name="olist" select="$olist"/>
<xsl:with-param name="count" select="1"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$mediaobject.index != ''">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object"
select="$olist[position() = $mediaobject.index]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="tex.math.output.delims">
<xsl:variable name="pi.delims">
<xsl:call-template name="pi.dbtex_delims">
<xsl:with-param name="node" select="descendant-or-self::*"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="result">
<xsl:choose>
<xsl:when test="$pi.delims = 'no'">0</xsl:when>
<xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$result"/>
</xsl:template>
</xsl:stylesheet>

447
build/xsl/html/param.xsl Normal file
View File

@ -0,0 +1,447 @@
<?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 9333 2012-05-06 19:41:03Z dcramer $
********************************************************************
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="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="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="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="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.fragid">fragid=</xsl:param>
<xsl:param name="olink.lang.fallback.sequence"/>
<xsl:param name="olink.outline.ext">.olink</xsl:param>
<xsl:attribute-set name="olink.properties">
<xsl:attribute name="show-destination">replace</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="olink.pubid">pubid</xsl:param>
<xsl:param name="olink.resolver">/cgi-bin/olink</xsl:param>
<xsl:param name="olink.sysid">sysid</xsl:param>
<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.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">0.5pt</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">0.5pt</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">true</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:stylesheet>

1296
build/xsl/html/pi.xsl Normal file

File diff suppressed because it is too large Load Diff

456
build/xsl/html/qandaset.xsl Normal file
View File

@ -0,0 +1,456 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: qandaset.xsl 9354 2012-05-12 23:29:36Z 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="qandaset">
<xsl:variable name="title" select="(blockinfo/title|info/title|title)[1]"/>
<xsl:variable name="preamble" select="*[local-name(.) != 'title'
and local-name(.) != 'titleabbrev'
and local-name(.) != 'qandadiv'
and local-name(.) != 'qandaentry']"/>
<xsl:variable name="toc">
<xsl:call-template name="pi.dbhtml_toc"/>
</xsl:variable>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$title"/>
<xsl:if test="not($title)">
<!-- andhor is output on title if there is one -->
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="((contains($toc.params, 'toc') and $toc != '0') or $toc = '1')
and not(ancestor::answer and not($qanda.nested.in.toc=0))">
<xsl:call-template name="process.qanda.toc"/>
</xsl:if>
<xsl:apply-templates select="$preamble"/>
<xsl:call-template name="process.qandaset"/>
</div>
</xsl:template>
<xsl:template match="qandaset/blockinfo/title|
qandaset/info/title|
qandaset/title">
<xsl:variable name="qalevel">
<xsl:call-template name="qanda.section.level"/>
</xsl:variable>
<xsl:element name="h{string(number($qalevel)+1)}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="qandaset/blockinfo|qandaset/info">
<!-- what should this template really do? -->
<xsl:apply-templates select="legalnotice" mode="titlepage.mode"/>
</xsl:template>
<xsl:template match="qandadiv">
<xsl:variable name="preamble" select="*[local-name(.) != 'title'
and local-name(.) != 'titleabbrev'
and local-name(.) != 'qandadiv'
and local-name(.) != 'qandaentry']"/>
<xsl:if test="blockinfo/title|info/title|title">
<tr class="qandadiv">
<td align="{$direction.align.start}" valign="top" colspan="2">
<xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
</td>
</tr>
</xsl:if>
<xsl:variable name="toc">
<xsl:call-template name="pi.dbhtml_toc"/>
</xsl:variable>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
<tr class="toc">
<td align="{$direction.align.start}" valign="top" colspan="2">
<xsl:call-template name="process.qanda.toc"/>
</td>
</tr>
</xsl:if>
<xsl:if test="$preamble">
<tr class="toc">
<td align="{$direction.align.start}" valign="top" colspan="2">
<xsl:apply-templates select="$preamble"/>
</td>
</tr>
</xsl:if>
<xsl:apply-templates select="qandadiv|qandaentry"/>
</xsl:template>
<xsl:template match="qandadiv/blockinfo/title|
qandadiv/info/title|
qandadiv/title">
<xsl:variable name="qalevel">
<xsl:call-template name="qandadiv.section.level"/>
</xsl:variable>
<xsl:element name="h{string(number($qalevel)+1)}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
<xsl:if test="$qandadiv.autolabel != 0">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="qandaentry">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="question">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<tr>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<!-- capture the id of the quandaentry -->
<xsl:call-template name="id.attribute">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<td align="{$direction.align.start}" valign="top">
<!-- and the id of the question too -->
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:variable name="label.content">
<xsl:apply-templates select="." mode="qanda.label"/>
</xsl:variable>
<xsl:if test="string-length($label.content) &gt; 0">
<p><b>
<xsl:copy-of select="$label.content"/>
</b></p>
</xsl:if>
</td>
<td align="{$direction.align.start}" valign="top">
<xsl:choose>
<xsl:when test="$deflabel = 'none' and not(label)">
<b><xsl:apply-templates select="*[local-name(.) != 'label']"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[local-name(.) != 'label']"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<xsl:template match="*" mode="qanda.defaultlabel">
<xsl:choose>
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
/@defaultlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="question" mode="qanda.label">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:if test="contains($deflabel, 'number') and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:template>
<xsl:template match="answer">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<tr>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<td align="{$direction.align.start}" valign="top">
<xsl:call-template name="anchor"/>
<xsl:variable name="answer.label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:if test="string-length($answer.label) &gt; 0">
<p><b>
<xsl:copy-of select="$answer.label"/>
</b></p>
</xsl:if>
</td>
<td align="{$direction.align.start}" valign="top">
<xsl:apply-templates select="*[local-name(.) != 'label'
and local-name(.) != 'qandaentry']"/>
<!-- * handle nested answer/qandaentry instances -->
<!-- * (bug 1509043 from Daniel Leidert) -->
<xsl:if test="descendant::question">
<xsl:call-template name="process.qandaset"/>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template match="answer" mode="qanda.label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:template>
<xsl:template match="label">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="process.qanda.toc">
<!-- * if user wants nested qandaset and qandaentry in main Qandaset TOC, -->
<!-- * then don't also include the nested stuff in the sub TOCs -->
<dl>
<xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
<xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
</dl>
</xsl:template>
<xsl:template match="qandadiv" mode="qandatoc.mode">
<dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
<dd><xsl:call-template name="process.qanda.toc"/></dd>
</xsl:template>
<xsl:template match="qandadiv/blockinfo/title|
qandadiv/info/title|
qandadiv/title" mode="qandatoc.mode">
<xsl:variable name="qalevel">
<xsl:call-template name="qandadiv.section.level"/>
</xsl:variable>
<xsl:variable name="id">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="parent::*"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="div.label">
<xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
</xsl:variable>
<xsl:if test="string-length($div.label) != 0">
<xsl:copy-of select="$div.label"/>
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="parent::*"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template match="qandaset" mode="qandatoc.mode">
<xsl:for-each select="qandaentry">
<xsl:apply-templates select="." mode="qandatoc.mode"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="qandaentry" mode="qandatoc.mode">
<xsl:apply-templates select="question" mode="qandatoc.mode"/>
</xsl:template>
<xsl:template match="question" mode="qandatoc.mode">
<xsl:variable name="firstch">
<!-- Use a titleabbrev or title if available -->
<xsl:choose>
<xsl:when test="../blockinfo/titleabbrev">
<xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
</xsl:when>
<xsl:when test="../blockinfo/title">
<xsl:apply-templates select="../blockinfo/title[1]/node()"/>
</xsl:when>
<xsl:when test="../info/titleabbrev">
<xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
</xsl:when>
<xsl:when test="../titleabbrev">
<xsl:apply-templates select="../titleabbrev[1]/node()"/>
</xsl:when>
<xsl:when test="../info/title">
<xsl:apply-templates select="../info/title[1]/node()"/>
</xsl:when>
<xsl:when test="../title">
<xsl:apply-templates select="../title[1]/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="deflabel">
<xsl:choose>
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
/@defaultlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<dt>
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:if test="contains($deflabel,'number') and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select=".."/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$firstch"/>
</a>
</dt>
<!-- * include nested qandaset/qandaentry in TOC if user wants it -->
<xsl:if test="not($qanda.nested.in.toc = 0)">
<xsl:apply-templates select="following-sibling::answer" mode="qandatoc.mode"/>
</xsl:if>
</xsl:template>
<xsl:template match="answer" mode="qandatoc.mode">
<xsl:if test="descendant::question">
<dd>
<xsl:call-template name="process.qanda.toc"/>
</dd>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="process.qandaset">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<xsl:variable name="label-width">
<xsl:call-template name="pi.dbhtml_label-width"/>
</xsl:variable>
<xsl:variable name="table-summary">
<xsl:call-template name="pi.dbhtml_table-summary"/>
</xsl:variable>
<xsl:variable name="cellpadding">
<xsl:call-template name="pi.dbhtml_cellpadding"/>
</xsl:variable>
<xsl:variable name="cellspacing">
<xsl:call-template name="pi.dbhtml_cellspacing"/>
</xsl:variable>
<table border="{$table.border.off}">
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">width: 100%;</xsl:attribute>
</xsl:if>
<xsl:if test="$table-summary != ''">
<xsl:attribute name="summary">
<xsl:value-of select="$table-summary"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$cellpadding != ''">
<xsl:attribute name="cellpadding">
<xsl:value-of select="$cellpadding"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$cellspacing != ''">
<xsl:attribute name="cellspacing">
<xsl:value-of select="$cellspacing"/>
</xsl:attribute>
</xsl:if>
<colgroup>
<col align="{$direction.align.start}">
<xsl:attribute name="width">
<xsl:choose>
<xsl:when test="$label-width != ''">
<xsl:value-of select="$label-width"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>1%</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</col>
<col/>
</colgroup>
<tbody>
<xsl:apply-templates select="qandaentry|qandadiv"/>
</tbody>
</table>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="*" mode="no.wrapper.mode">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

305
build/xsl/html/refentry.xsl Normal file
View File

@ -0,0 +1,305 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: refentry.xsl 9297 2012-04-22 03:56:16Z 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="reference">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="reference.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="not(partintro) and contains($toc.params, 'toc')">
<xsl:call-template name="division.toc"/>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="reference" mode="division.number">
<xsl:number from="book" count="reference" format="I."/>
</xsl:template>
<xsl:template match="reference/docinfo"></xsl:template>
<xsl:template match="reference/referenceinfo"></xsl:template>
<xsl:template match="reference/title"></xsl:template>
<xsl:template match="reference/subtitle"></xsl:template>
<xsl:template match="reference/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template name="refentry.title">
<xsl:param name="node" select="."/>
<xsl:variable name="refmeta" select="$node//refmeta"/>
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
<xsl:variable name="refnamediv" select="$node//refnamediv"/>
<xsl:variable name="refname" select="$refnamediv//refname"/>
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$refentrytitle">
<xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
</xsl:when>
<xsl:when test="$refdesc">
<xsl:apply-templates select="$refdesc[1]" mode="title"/>
</xsl:when>
<xsl:when test="$refname">
<xsl:apply-templates select="$refname[1]" mode="title"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<h1 class="title">
<xsl:copy-of select="$title"/>
</h1>
</xsl:template>
<xsl:template match="refentry">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:if test="$refentry.separator != 0 and preceding-sibling::refentry">
<div class="refentry.separator">
<hr/>
</div>
</xsl:if>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="refentry.titlepage"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="refentry/docinfo|refentry/refentryinfo"></xsl:template>
<xsl:template match="refentry/info"></xsl:template>
<xsl:template match="refentrytitle|refname|refdescriptor" mode="title">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refmeta">
</xsl:template>
<xsl:template match="manvolnum">
<xsl:if test="$refentry.xref.manvolnum != 0">
<xsl:text>(</xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="refmiscinfo">
</xsl:template>
<xsl:template match="refentrytitle">
<xsl:call-template name="inline.charseq"/>
</xsl:template>
<xsl:template match="refnamediv">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:choose>
<xsl:when test="preceding-sibling::refnamediv">
<!-- no title on secondary refnamedivs! -->
</xsl:when>
<xsl:when test="$refentry.generate.name != 0">
<h2>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefName'"/>
</xsl:call-template>
</h2>
</xsl:when>
<xsl:when test="$refentry.generate.title != 0">
<h2>
<xsl:choose>
<xsl:when test="../refmeta/refentrytitle">
<xsl:apply-templates select="../refmeta/refentrytitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="refname[1]"/>
</xsl:otherwise>
</xsl:choose>
</h2>
</xsl:when>
</xsl:choose>
<p>
<xsl:apply-templates/>
</p>
</div>
</xsl:template>
<xsl:template match="refname">
<xsl:if test="not(preceding-sibling::refdescriptor)">
<xsl:apply-templates/>
<xsl:if test="following-sibling::refname">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="refpurpose">
<xsl:if test="node()">
<xsl:text> </xsl:text>
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">em-dash</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:template match="refdescriptor">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refclass">
<xsl:if test="$refclass.suppress = 0">
<b>
<xsl:if test="@role">
<xsl:value-of select="@role"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</b>
</xsl:if>
</xsl:template>
<xsl:template match="refsynopsisdiv">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<h2>
<xsl:choose>
<xsl:when test="refsynopsisdiv/title|title">
<xsl:apply-templates select="(refsynopsisdiv/title|title)[1]"
mode="titlepage.mode"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefSynopsisDiv'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</h2>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="refsynopsisdivinfo"></xsl:template>
<xsl:template match="refsynopsisdiv/title">
</xsl:template>
<xsl:template match="refsynopsisdiv/title" mode="titlepage.mode">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refsection|refsect1|refsect2|refsect3">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<!-- pick up info title -->
<xsl:apply-templates select="(title|info/title)[1]"/>
<xsl:apply-templates select="node()[not(self::title) and not(self::info)]"/>
</div>
</xsl:template>
<xsl:template match="refsection/title|refsection/info/title">
<!-- the ID is output in the block.object call for refsect1 -->
<xsl:variable name="level" select="count(ancestor-or-self::refsection)"/>
<xsl:variable name="refsynopsisdiv">
<xsl:text>0</xsl:text>
<xsl:if test="ancestor::refsynopsisdiv">1</xsl:if>
</xsl:variable>
<xsl:variable name="hlevel">
<xsl:choose>
<xsl:when test="$level+$refsynopsisdiv &gt; 5">6</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level+1+$refsynopsisdiv"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$hlevel}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="refsect1/title|refsect1/info/title">
<!-- the ID is output in the block.object call for refsect1 -->
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="refsect2/title|refsect2/info/title">
<!-- the ID is output in the block.object call for refsect2 -->
<h3>
<xsl:apply-templates/>
</h3>
</xsl:template>
<xsl:template match="refsect3/title|refsect3/info/title">
<!-- the ID is output in the block.object call for refsect3 -->
<h4>
<xsl:apply-templates/>
</h4>
</xsl:template>
<xsl:template match="refsectioninfo|refsection/info"></xsl:template>
<xsl:template match="refsect1info|refsect1/info"></xsl:template>
<xsl:template match="refsect2info|refsect2/info"></xsl:template>
<xsl:template match="refsect3info|refsect3/info"></xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

636
build/xsl/html/sections.xsl Normal file
View File

@ -0,0 +1,636 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: sections.xsl 9392 2012-06-02 20:10:58Z 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="section">
<xsl:variable name="depth" select="count(ancestor::section)+1"/>
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="section.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and $depth &lt;= $generate.section.toc.level">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template name="section.title">
<!-- the context node should be the title of a section when called -->
<xsl:variable name="section" select="(ancestor::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5)[last()]"/>
<xsl:variable name="renderas">
<xsl:choose>
<xsl:when test="$section/@renderas = 'sect1'">1</xsl:when>
<xsl:when test="$section/@renderas = 'sect2'">2</xsl:when>
<xsl:when test="$section/@renderas = 'sect3'">3</xsl:when>
<xsl:when test="$section/@renderas = 'sect4'">4</xsl:when>
<xsl:when test="$section/@renderas = 'sect5'">5</xsl:when>
<xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="level">
<xsl:choose>
<xsl:when test="$renderas != ''">
<xsl:value-of select="$renderas"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="section.level">
<xsl:with-param name="node" select="$section"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="section.heading">
<xsl:with-param name="section" select="$section"/>
<xsl:with-param name="level" select="$level"/>
<xsl:with-param name="title">
<xsl:apply-templates select="$section" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="section/title
|section/info/title
|sectioninfo/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@renderas = 'sect2'">
<xsl:call-template name="sect2.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect3'">
<xsl:call-template name="sect3.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect4'">
<xsl:call-template name="sect4.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect5'">
<xsl:call-template name="sect5.titlepage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="sect1.titlepage"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and $generate.section.toc.level &gt;= 1">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="sect1/title
|sect1/info/title
|sect1info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect2">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@renderas = 'sect1'">
<xsl:call-template name="sect1.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect3'">
<xsl:call-template name="sect3.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect4'">
<xsl:call-template name="sect4.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect5'">
<xsl:call-template name="sect5.titlepage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="sect2.titlepage"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and $generate.section.toc.level &gt;= 2">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="sect2/title
|sect2/info/title
|sect2info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect3">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@renderas = 'sect1'">
<xsl:call-template name="sect1.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect2'">
<xsl:call-template name="sect2.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect4'">
<xsl:call-template name="sect4.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect5'">
<xsl:call-template name="sect5.titlepage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="sect3.titlepage"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and $generate.section.toc.level &gt;= 3">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="sect3/title
|sect3/info/title
|sect3info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect4">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@renderas = 'sect1'">
<xsl:call-template name="sect1.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect2'">
<xsl:call-template name="sect2.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect3'">
<xsl:call-template name="sect3.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect5'">
<xsl:call-template name="sect5.titlepage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="sect4.titlepage"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and $generate.section.toc.level &gt;= 4">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="sect4/title
|sect4/info/title
|sect4info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect5">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="@renderas = 'sect1'">
<xsl:call-template name="sect1.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect2'">
<xsl:call-template name="sect2.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect3'">
<xsl:call-template name="sect3.titlepage"/>
</xsl:when>
<xsl:when test="@renderas = 'sect4'">
<xsl:call-template name="sect4.titlepage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="sect5.titlepage"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')
and $generate.section.toc.level &gt;= 5">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.chunk.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="sect5/title
|sect5/info/title
|sect5info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="simplesect">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="simplesect.titlepage"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="simplesect/title|simplesect/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="section/title"></xsl:template>
<xsl:template match="section/titleabbrev"></xsl:template>
<xsl:template match="section/subtitle"></xsl:template>
<xsl:template match="sectioninfo"></xsl:template>
<xsl:template match="section/info"></xsl:template>
<xsl:template match="sect1/title"></xsl:template>
<xsl:template match="sect1/titleabbrev"></xsl:template>
<xsl:template match="sect1/subtitle"></xsl:template>
<xsl:template match="sect1info"></xsl:template>
<xsl:template match="sect1/info"></xsl:template>
<xsl:template match="sect2/title"></xsl:template>
<xsl:template match="sect2/subtitle"></xsl:template>
<xsl:template match="sect2/titleabbrev"></xsl:template>
<xsl:template match="sect2info"></xsl:template>
<xsl:template match="sect2/info"></xsl:template>
<xsl:template match="sect3/title"></xsl:template>
<xsl:template match="sect3/subtitle"></xsl:template>
<xsl:template match="sect3/titleabbrev"></xsl:template>
<xsl:template match="sect3info"></xsl:template>
<xsl:template match="sect3/info"></xsl:template>
<xsl:template match="sect4/title"></xsl:template>
<xsl:template match="sect4/subtitle"></xsl:template>
<xsl:template match="sect4/titleabbrev"></xsl:template>
<xsl:template match="sect4info"></xsl:template>
<xsl:template match="sect4/info"></xsl:template>
<xsl:template match="sect5/title"></xsl:template>
<xsl:template match="sect5/subtitle"></xsl:template>
<xsl:template match="sect5/titleabbrev"></xsl:template>
<xsl:template match="sect5info"></xsl:template>
<xsl:template match="sect5/info"></xsl:template>
<xsl:template match="simplesect/title"></xsl:template>
<xsl:template match="simplesect/subtitle"></xsl:template>
<xsl:template match="simplesect/titleabbrev"></xsl:template>
<xsl:template match="simplesect/info"></xsl:template>
<!-- ==================================================================== -->
<xsl:template name="section.heading">
<xsl:param name="section" select="."/>
<xsl:param name="level" select="1"/>
<xsl:param name="allow-anchors" select="1"/>
<xsl:param name="title"/>
<xsl:param name="class" select="'title'"/>
<xsl:variable name="id">
<xsl:choose>
<!-- Make sure the subtitle doesn't get the same id as the title -->
<xsl:when test="self::subtitle">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:when>
<!-- if title is in an *info wrapper, get the grandparent -->
<xsl:when test="contains(local-name(..), 'info')">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="../.."/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select=".."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- HTML H level is one higher than section level -->
<xsl:variable name="hlevel">
<xsl:choose>
<!-- highest valid HTML H level is H6; so anything nested deeper
than 5 levels down just becomes H6 -->
<xsl:when test="$level &gt; 5">6</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$hlevel}">
<xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
<xsl:if test="$css.decoration != '0'">
<xsl:if test="$hlevel&lt;3">
<xsl:attribute name="style">clear: both</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="$allow-anchors != 0">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="$section"/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:if>
<xsl:copy-of select="$title"/>
</xsl:element>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="bridgehead">
<xsl:variable name="container"
select="(ancestor::appendix
|ancestor::article
|ancestor::bibliography
|ancestor::chapter
|ancestor::glossary
|ancestor::glossdiv
|ancestor::index
|ancestor::partintro
|ancestor::preface
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::section
|ancestor::setindex
|ancestor::simplesect)[last()]"/>
<xsl:variable name="clevel">
<xsl:choose>
<xsl:when test="local-name($container) = 'appendix'
or local-name($container) = 'chapter'
or local-name($container) = 'article'
or local-name($container) = 'bibliography'
or local-name($container) = 'glossary'
or local-name($container) = 'index'
or local-name($container) = 'partintro'
or local-name($container) = 'preface'
or local-name($container) = 'setindex'">1</xsl:when>
<xsl:when test="local-name($container) = 'glossdiv'">
<xsl:value-of select="count(ancestor::glossdiv)+1"/>
</xsl:when>
<xsl:when test="local-name($container) = 'sect1'
or local-name($container) = 'sect2'
or local-name($container) = 'sect3'
or local-name($container) = 'sect4'
or local-name($container) = 'sect5'
or local-name($container) = 'refsect1'
or local-name($container) = 'refsect2'
or local-name($container) = 'refsect3'
or local-name($container) = 'section'
or local-name($container) = 'simplesect'">
<xsl:variable name="slevel">
<xsl:call-template name="section.level">
<xsl:with-param name="node" select="$container"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$slevel + 1"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- HTML H level is one higher than section level -->
<xsl:variable name="hlevel">
<xsl:choose>
<xsl:when test="@renderas = 'sect1'">2</xsl:when>
<xsl:when test="@renderas = 'sect2'">3</xsl:when>
<xsl:when test="@renderas = 'sect3'">4</xsl:when>
<xsl:when test="@renderas = 'sect4'">5</xsl:when>
<xsl:when test="@renderas = 'sect5'">6</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$clevel + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$hlevel}">
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="section/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect5/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template name="section.subtitle">
<!-- the context node should be the subtitle of a section when called -->
<xsl:variable name="section" select="(ancestor::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5)[last()]"/>
<xsl:variable name="level">
<xsl:call-template name="section.level">
<xsl:with-param name="node" select="$section"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="section.heading">
<xsl:with-param name="section" select=".."/>
<xsl:with-param name="allow-anchors" select="0"/>
<!-- subtitle heading level one higher than section level -->
<xsl:with-param name="level" select="$level + 1"/>
<xsl:with-param name="class" select="'subtitle'"/>
<xsl:with-param name="title">
<xsl:apply-templates select="$section" mode="object.subtitle.markup">
<xsl:with-param name="allow-anchors" select="0"/>
</xsl:apply-templates>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

1653
build/xsl/html/synop.xsl Normal file

File diff suppressed because it is too large Load Diff

1209
build/xsl/html/table.xsl Normal file

File diff suppressed because it is too large Load Diff

77
build/xsl/html/task.xsl Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- ********************************************************************
$Id: task.xsl 9363 2012-05-12 23:42:32Z 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="task">
<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>
<xsl:variable name="preamble"
select="*[not(self::title
or self::titleabbrev)]"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:if test="(title or info/title) and $placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
<xsl:apply-templates select="$preamble"/>
<xsl:if test="(title or info/title) and $placement != 'before'">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="task/title">
<!-- nop -->
</xsl:template>
<xsl:template match="tasksummary">
<xsl:call-template name="semiformal.object"/>
</xsl:template>
<xsl:template match="tasksummary/title"/>
<xsl:template match="taskprerequisites">
<xsl:call-template name="semiformal.object"/>
</xsl:template>
<xsl:template match="taskprerequisites/title"/>
<xsl:template match="taskrelated">
<xsl:call-template name="semiformal.object"/>
</xsl:template>
<xsl:template match="taskrelated/title"/>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

1123
build/xsl/html/titlepage.xsl Normal file

File diff suppressed because it is too large Load Diff

352
build/xsl/html/toc.xsl Normal file
View File

@ -0,0 +1,352 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: toc.xsl 9297 2012-04-22 03:56:16Z 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="set/toc | book/toc | part/toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<!-- Do not output the toc element if one is already generated
by the use of $generate.toc parameter, or if
generating a source toc is turned off -->
<xsl:if test="not(contains($toc.params, 'toc')) and
($process.source.toc != 0 or $process.empty.source.toc != 0)">
<xsl:variable name="content">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<xsl:apply-templates />
</xsl:when>
<xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
<!-- trick to switch context node to parent element -->
<xsl:for-each select="parent::*">
<xsl:choose>
<xsl:when test="self::set">
<xsl:call-template name="set.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="self::book">
<xsl:call-template name="division.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="self::part">
<xsl:call-template name="division.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="string-length(normalize-space($content)) != 0">
<xsl:copy-of select="$content"/>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="chapter/toc | appendix/toc | preface/toc | article/toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<!-- Do not output the toc element if one is already generated
by the use of $generate.toc parameter, or if
generating a source toc is turned off -->
<xsl:if test="not(contains($toc.params, 'toc')) and
($process.source.toc != 0 or $process.empty.source.toc != 0)">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="title"/>
<dl>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="*[not(self::title)]"/>
</dl>
</div>
<xsl:call-template name="component.toc.separator"/>
</xsl:when>
<xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
<!-- trick to switch context node to section element -->
<xsl:for-each select="parent::*">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:for-each>
<xsl:call-template name="component.toc.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="section/toc
|sect1/toc
|sect2/toc
|sect3/toc
|sect4/toc
|sect5/toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<!-- Do not output the toc element if one is already generated
by the use of $generate.toc parameter, or if
generating a source toc is turned off -->
<xsl:if test="not(contains($toc.params, 'toc')) and
($process.source.toc != 0 or $process.empty.source.toc != 0)">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="title"/>
<dl>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="*[not(self::title)]"/>
</dl>
</div>
<xsl:call-template name="section.toc.separator"/>
</xsl:when>
<xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
<!-- trick to switch context node to section element -->
<xsl:for-each select="parent::*">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:for-each>
<xsl:call-template name="section.toc.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="tocpart|tocchap
|toclevel1|toclevel2|toclevel3|toclevel4|toclevel5">
<xsl:variable name="sub-toc">
<xsl:if test="tocchap|toclevel1|toclevel2|toclevel3|toclevel4|toclevel5">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">
<dd>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocchap|toclevel1|toclevel2|
toclevel3|toclevel4|toclevel5"/>
</xsl:element>
</dd>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocchap|toclevel1|toclevel2|
toclevel3|toclevel4|toclevel5"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:apply-templates select="tocentry[position() != last()]"/>
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">
<dt>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocentry[position() = last()]"/>
</dt>
<xsl:copy-of select="$sub-toc"/>
</xsl:when>
<xsl:otherwise>
<li>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocentry[position() = last()]"/>
<xsl:copy-of select="$sub-toc"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="tocentry|tocdiv|lotentry|tocfront|tocback">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">
<dt>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="tocentry-content"/>
</dt>
</xsl:when>
<xsl:otherwise>
<li>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="tocentry-content"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="tocentry[position() = last()]" priority="2">
<xsl:call-template name="tocentry-content"/>
</xsl:template>
<xsl:template name="tocentry-content">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:choose>
<xsl:when test="@linkend">
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="toc/title">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="toc/subtitle">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="toc/titleabbrev">
</xsl:template>
<!-- ==================================================================== -->
<!-- A lot element must have content, because there is no attribute
to select what kind of list should be generated -->
<xsl:template match="book/lot | part/lot">
<!-- Don't generate a page sequence unless there is content -->
<xsl:variable name="content">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates />
</div>
</xsl:when>
<xsl:when test="not(child::*) and $process.empty.source.toc != 0">
<xsl:call-template name="process.empty.lot"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="string-length(normalize-space($content)) != 0">
<xsl:copy-of select="$content"/>
</xsl:if>
</xsl:template>
<xsl:template match="chapter/lot | appendix/lot | preface/lot | article/lot">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates />
</div>
<xsl:call-template name="component.toc.separator"/>
</xsl:when>
<xsl:when test="not(child::*) and $process.empty.source.toc != 0">
<xsl:call-template name="process.empty.lot"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="section/lot
|sect1/lot
|sect2/lot
|sect3/lot
|sect4/lot
|sect5/lot">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
<xsl:call-template name="section.toc.separator"/>
</xsl:when>
<xsl:when test="not(child::*) and $process.empty.source.toc != 0">
<xsl:call-template name="process.empty.lot"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="process.empty.lot">
<!-- An empty lot element does not provide any information to indicate
what should be included in it. You can customize this
template to generate a lot based on @role or something -->
<xsl:message>
<xsl:text>Warning: don't know what to generate for </xsl:text>
<xsl:text>lot that has no children.</xsl:text>
</xsl:message>
</xsl:template>
<xsl:template match="lot/title">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="lot/subtitle">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="lot/titleabbrev">
</xsl:template>
</xsl:stylesheet>

410
build/xsl/html/verbatim.xsl Normal file
View File

@ -0,0 +1,410 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="sverb xverb lxslt exsl"
version='1.0'>
<!-- ********************************************************************
$Id: verbatim.xsl 9297 2012-04-22 03:56:16Z 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.
******************************************************************** -->
<!-- XSLTHL highlighting is turned off by default. See highlighting/README
for instructions on how to turn on XSLTHL -->
<xsl:template name="apply-highlighting">
<xsl:apply-templates/>
</xsl:template>
<lxslt:component prefix="xverb"
functions="numberLines"/>
<xsl:template match="programlisting|screen|synopsis">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:call-template name="anchor"/>
<xsl:variable name="div.element">pre</xsl:variable>
<xsl:if test="$shade.verbatim != 0">
<xsl:message>
<xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>
<xsl:text>Use CSS instead,</xsl:text>
</xsl:message>
<xsl:message>
<xsl:text>for example: pre.</xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text> { background-color: #E0E0E0; }</xsl:text>
</xsl:message>
</xsl:if>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<xsl:variable name="rtf">
<xsl:choose>
<xsl:when test="$highlight.source != 0">
<xsl:call-template name="apply-highlighting"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:if test="@width != ''">
<xsl:attribute name="width">
<xsl:value-of select="@width"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:if test="@width != ''">
<xsl:attribute name="width">
<xsl:value-of select="@width"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$highlight.source != 0">
<xsl:call-template name="apply-highlighting"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="literallayout">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:variable name="rtf">
<xsl:apply-templates/>
</xsl:variable>
<xsl:if test="$shade.verbatim != 0 and @class='monospaced'">
<xsl:message>
<xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>
<xsl:text>Use CSS instead,</xsl:text>
</xsl:message>
<xsl:message>
<xsl:text>for example: pre.</xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text> { background-color: #E0E0E0; }</xsl:text>
</xsl:message>
</xsl:if>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<xsl:choose>
<xsl:when test="@class='monospaced'">
<pre>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</pre>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@class='monospaced'">
<pre>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:copy-of select="$rtf"/>
</pre>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="address">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:variable name="rtf">
<xsl:apply-templates/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="number.rtf.lines">
<xsl:param name="rtf" select="''"/>
<xsl:param name="pi.context" select="."/>
<!-- Save the global values -->
<xsl:variable name="global.linenumbering.everyNth"
select="$linenumbering.everyNth"/>
<xsl:variable name="global.linenumbering.separator"
select="$linenumbering.separator"/>
<xsl:variable name="global.linenumbering.width"
select="$linenumbering.width"/>
<!-- Extract the <?dbhtml linenumbering.*?> PI values -->
<xsl:variable name="pi.linenumbering.everyNth">
<xsl:call-template name="pi.dbhtml_linenumbering.everyNth">
<xsl:with-param name="node" select="$pi.context"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pi.linenumbering.separator">
<xsl:call-template name="pi.dbhtml_linenumbering.separator">
<xsl:with-param name="node" select="$pi.context"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pi.linenumbering.width">
<xsl:call-template name="pi.dbhtml_linenumbering.width">
<xsl:with-param name="node" select="$pi.context"/>
</xsl:call-template>
</xsl:variable>
<!-- Construct the 'in-context' values -->
<xsl:variable name="linenumbering.everyNth">
<xsl:choose>
<xsl:when test="$pi.linenumbering.everyNth != ''">
<xsl:value-of select="$pi.linenumbering.everyNth"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$global.linenumbering.everyNth"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linenumbering.separator">
<xsl:choose>
<xsl:when test="$pi.linenumbering.separator != ''">
<xsl:value-of select="$pi.linenumbering.separator"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$global.linenumbering.separator"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linenumbering.width">
<xsl:choose>
<xsl:when test="$pi.linenumbering.width != ''">
<xsl:value-of select="$pi.linenumbering.width"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$global.linenumbering.width"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linenumbering.startinglinenumber">
<xsl:choose>
<xsl:when test="$pi.context/@startinglinenumber">
<xsl:value-of select="$pi.context/@startinglinenumber"/>
</xsl:when>
<xsl:when test="$pi.context/@continuation='continues'">
<xsl:variable name="lastLine">
<xsl:choose>
<xsl:when test="$pi.context/self::programlisting">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::programlisting[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::screen">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::screen[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::literallayout">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::literallayout[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::address">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::address[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::synopsis">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::synopsis[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected verbatim environment: </xsl:text>
<xsl:value-of select="local-name($pi.context)"/>
</xsl:message>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$lastLine + 1"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="function-available('sverb:numberLines')">
<xsl:copy-of select="sverb:numberLines($rtf)"/>
</xsl:when>
<xsl:when test="function-available('xverb:numberLines')">
<xsl:copy-of select="xverb:numberLines($rtf)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>No numberLines function available.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make-verbatim">
<xsl:param name="rtf"/>
<!-- I want to make this RTF verbatim. There are two possibilities: either
I have access to the exsl:node-set extension function and I can "do it right"
or I have to rely on CSS. -->
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<xsl:apply-templates select="exsl:node-set($rtf)" mode="make.verbatim.mode"/>
</xsl:when>
<xsl:otherwise>
<span style="white-space: pre;">
<xsl:copy-of select="$rtf"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ======================================================================== -->
<xsl:template name="lastLineNumber">
<xsl:param name="listings"/>
<xsl:param name="number" select="0"/>
<xsl:variable name="lines">
<xsl:call-template name="countLines">
<xsl:with-param name="listing" select="string($listings[1])"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="not($listings)">
<xsl:value-of select="$number"/>
</xsl:when>
<xsl:when test="$listings[1]/@startinglinenumber">
<xsl:value-of select="$number + $listings[1]/@startinglinenumber + $lines - 1"/>
</xsl:when>
<xsl:when test="$listings[1]/@continuation='continues'">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings" select="listings[position() &gt; 1]"/>
<xsl:with-param name="number" select="$number + $lines"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lines"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="countLines">
<xsl:param name="listing"/>
<xsl:param name="count" select="1"/>
<xsl:choose>
<xsl:when test="contains($listing, '&#10;')">
<xsl:call-template name="countLines">
<xsl:with-param name="listing" select="substring-after($listing, '&#10;')"/>
<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:stylesheet>

1402
build/xsl/html/xref.xsl Normal file

File diff suppressed because it is too large Load Diff

531
build/xsl/lib/lib.xsl Normal file
View File

@ -0,0 +1,531 @@
<?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" 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="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>

348
compile
View File

@ -1,348 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

1480
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,367 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* define if dbus service is enabled */
#undef DBUS_SERVICE
/* Location of D-Bus services directory */
#undef DBUS_SERVICES_DIR
/* "SyncML DevInf DevType" */
#undef DEVICE_TYPE
/* use libical's icaltzutil_get_zone_directory() */
#undef DISABLE_ICALTZUTIL_GET_ZONE_DIRECTORY
/* "DLT app ID for syncevo-dbus-helper" */
#undef DLT_SYNCEVO_DBUS_HELPER_ID
/* "DLT app ID for syncevo-dbus-server" */
#undef DLT_SYNCEVO_DBUS_SERVER_ID
/* "DLT app ID for syncevo-local-helper" */
#undef DLT_SYNCEVO_LOCAL_HELPER_ID
/* ActiveSync available */
#undef ENABLE_ACTIVESYNC
/* Akonadi available */
#undef ENABLE_AKONADI
/* define if bluez library is available */
#undef ENABLE_BLUETOOTH
/* DAV available */
#undef ENABLE_DAV
/* overrides the default D-Bus timeout so that synchronous calls never time
out */
#undef ENABLE_DBUS_TIMEOUT_HACK
/* libebook available */
#undef ENABLE_EBOOK
/* libecal available */
#undef ENABLE_ECAL
/* file available */
#undef ENABLE_FILE
/* libical in use */
#undef ENABLE_ICAL
/* use internal icaltz-util.c */
#undef ENABLE_ICALTZ_UTIL
/* enable integration tests inside the final library */
#undef ENABLE_INTEGRATION_TESTS
/* KCalExtended available */
#undef ENABLE_KCALEXTENDED
/* enable libcurl transport */
#undef ENABLE_LIBCURL
/* enable libsoup transport */
#undef ENABLE_LIBSOUP
/* enable Maemo hacks */
#undef ENABLE_MAEMO
/* Maemo 5 calendar available */
#undef ENABLE_MAEMO_CALENDAR
/* enable dynamically opening sync source backends */
#undef ENABLE_MODULES
/* always defined to indicate that i18n is enabled */
#undef ENABLE_NLS
/* define if openobex library is available */
#undef ENABLE_OBEX
/* pbap available */
#undef ENABLE_PBAP
/* QtContacts available */
#undef ENABLE_QTCONTACTS
/* Qt D-Bus bindings available */
#undef ENABLE_QT_DBUS
/* sqlite available */
#undef ENABLE_SQLITE
/* enable SSL certificate check in server templates */
#undef ENABLE_SSL_CERTIFICATE_CHECK
/* SyncML client support available */
#undef ENABLE_SYNCML_CLIENT
/* SyncML engines are linked directly */
#undef ENABLE_SYNCML_LINKED
/* SyncML server support available */
#undef ENABLE_SYNCML_SERVER
/* TDE PIM enabled */
#undef ENABLE_TDEPIM
/* TDE PIM Address Book available */
#undef ENABLE_TDEPIMABC
/* TDE PIM Calendar available */
#undef ENABLE_TDEPIMCAL
/* TDE PIM Address Book available */
#undef ENABLE_TDEPIMNOTES
/* TDE Wallet available */
#undef ENABLE_TDEWALLET
/* enable single-app-instance functionality */
#undef ENABLE_UNIQUE
/* enable unit tests inside the library's source code */
#undef ENABLE_UNIT_TESTS
/* XMLRPC available */
#undef ENABLE_XMLRPC
/* The gettext package name */
#undef GETTEXT_PACKAGE
/* we have GTK+ 2.18 or better */
#undef GTK_2_18
/* define if mlite could be used in dbus service */
#undef HAS_MLITE
/* define if libnotify could be used in dbus service */
#undef HAS_NOTIFY
/* Define to 1 if you have the <Akonadi/Collection> header file. */
#undef HAVE_AKONADI_COLLECTION
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#undef HAVE_BIND_TEXTDOMAIN_CODESET
/* base libbluetooth functions accept bufsize parameter */
#undef HAVE_BLUEZ_BUFSIZE
/* libbluetooth has _safe variants */
#undef HAVE_BLUEZ_SAFE
/* define if the Boost library is available */
#undef HAVE_BOOST
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYCURRENT
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
/* define if the compiler supports basic C++11 syntax */
#undef HAVE_CXX11
/* define if the compiler supports basic C++14 syntax */
#undef HAVE_CXX14
/* Define to 1 if you have the `dcgettext' function. */
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the <dcopclient.h> header file. */
#undef HAVE_DCOPCLIENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* evolution-dataserver available */
#undef HAVE_EDS
/* Define to 1 if you have the <endian.h> header file. */
#undef HAVE_ENDIAN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* use e_book_client_connect_direct_sync */
#undef HAVE_E_BOOK_CLIENT_CONNECT_DIRECT_SYNC
/* use e_book_client_new_direct */
#undef HAVE_E_BOOK_CLIENT_NEW_DIRECT
/* have EBookOperationFlags */
#undef HAVE_E_BOOK_OPERATION_FLAGS
/* have e_contact_inline_local_photos() */
#undef HAVE_E_CONTACT_INLINE_LOCAL_PHOTOS
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* glib found */
#undef HAVE_GLIB
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* some kind of secure credential store is available */
#undef HAVE_KEYRING
/* Define to 1 if you have the <KNotesIface.h> header file. */
#undef HAVE_KNOTESIFACE_H
/* Define to 1 if you have the <kwallet.h> header file. */
#undef HAVE_KWALLET_H
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* libecal 2.0 */
#undef HAVE_LIBECAL_2_0
/* Define to 1 if you have the <libedataserver/eds-version.h> header file. */
#undef HAVE_LIBEDATASERVER_EDS_VERSION_H
/* have recent enough libical with _r variants */
#undef HAVE_LIBICAL_R
/* Define to 1 if you have the <libkcal/calendarresources.h> header file. */
#undef HAVE_LIBKCAL_CALENDARRESOURCES_H
/* ne_options2() and NE_CAP_* defines available */
#undef HAVE_LIBNEON_OPTIONS
/* ne_session_system_proxy() available */
#undef HAVE_LIBNEON_SYSTEM_PROXY
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/endian.h> header file. */
#undef HAVE_SYS_ENDIAN_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <tdeabc/stdaddressbook.h> header file. */
#undef HAVE_TDEABC_STDADDRESSBOOK_H
/* Define to 1 if you have the <tdewallet.h> header file. */
#undef HAVE_TDEWALLET_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
#undef HAVE_VALGRIND_VALGRIND_H
/* compiling for iPhone */
#undef IPHONE
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* we have Mx-Gtk 0.99.1 or better */
#undef MX_GTK_0_99_1
/* dynamically open libneon */
#undef NEON_COMPATIBILITY
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* activate gsso */
#undef STATIC_GSSO
/* activate OAuth2 based on refresh token */
#undef STATIC_OAUTH2
/* activate gsso */
#undef STATIC_SIGNON
/* activate gsso */
#undef STATIC_UOA
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* default value for SSLServerCertificates option */
#undef SYNCEVOLUTION_SSL_SERVER_CERTIFICATES
/* binary is meant for end-users */
#undef SYNCEVOLUTION_STABLE_RELEASE
/* "using Synthesis engine" */
#undef SYNTHESIS
/* "optionally use GENIVI Diagnostic Log and Trace for logging" */
#undef USE_DLT
/* use e_book/cal_client_* calls */
#undef USE_EDS_CLIENT
/* define if gnome keyring should be used in dbus service */
#undef USE_GNOME_KEYRING
/* use GNOME Online Accounts */
#undef USE_GOA
/* KWallet available */
#undef USE_KDE_KWALLET
/* Use Moblin UI widgets */
#undef USE_MOBLIN_UX
/* choose implementation of SHA-256 */
#undef USE_SHA256
/* Version number of package */
#undef VERSION

1801
config.sub vendored

File diff suppressed because it is too large Load Diff

31070
configure vendored

File diff suppressed because it is too large Load Diff

791
depcomp
View File

@ -1,791 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

BIN
docs/Sync4jContribution.pdf Normal file

Binary file not shown.

View File

@ -1,518 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

11251
ltmain.sh

File diff suppressed because it is too large Load Diff

8
m4-repo/README Normal file
View File

@ -0,0 +1,8 @@
This directory contains m4 macros which we store in our own git
repository because they are not necessarily available in a typical
Linux distro.
The m4 directory is created automatically during autogen.sh and
contains temporary copies of system macros. It is wiped out at the
beginning of our autogen.sh because these copies do not always work
when moving between distros: libtool had problems with that.

119
m4-repo/ax_boost_locale.m4 Normal file
View File

@ -0,0 +1,119 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_locale.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_LOCALE
#
# DESCRIPTION
#
# Test for System library from the Boost C++ libraries. The macro requires
# a preceding call to AX_BOOST_BASE. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_LOCALE_LIB)
#
# And sets:
#
# HAVE_BOOST_LOCALE
#
# LICENSE
#
# Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
AC_DEFUN([AX_BOOST_LOCALE],
[
AC_ARG_WITH([boost-locale],
AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@],
[use the Locale library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-locale=boost_locale-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_locale_lib=""
else
want_boost="yes"
ax_boost_user_locale_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_BUILD])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Locale library is available,
ax_cv_boost_locale,
[AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/locale.hpp>]],
[[boost::locale::generator gen;
std::locale::global(gen(""));]])],
ax_cv_boost_locale=yes, ax_cv_boost_locale=no)
CXXFLAGS=$CXXFLAGS_SAVE
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_locale" = "xyes"; then
AC_SUBST(BOOST_CPPFLAGS)
AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
LDFLAGS_SAVE=$LDFLAGS
if test "x$ax_boost_user_locale_lib" = "x"; then
for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
if test "x$link_locale" != "xyes"; then
for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` boost_locale; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
fi
else
for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_locale" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

View File

@ -0,0 +1,78 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_GNU_MAKE()
#
# DESCRIPTION
#
# This macro searches for a GNU version of make. If a match is found, the
# makefile variable `ifGNUmake' is set to the empty string, otherwise it
# is set to "#". This is useful for including a special features in a
# Makefile, which cannot be handled by other versions of make. The
# variable _cv_gnu_make_command is set to the command to invoke GNU make
# if it exists, the empty string otherwise.
#
# Here is an example of its use:
#
# Makefile.in might contain:
#
# # A failsafe way of putting a dependency rule into a makefile
# $(DEPEND):
# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
#
# AX_CHECK_GNU_MAKE()
# AC_OUTPUT(Makefile)
#
# Then perhaps to cause gnu make to override any other make, we could do
# something like this (note that GNU make always looks for GNUmakefile
# first):
#
# if ! test x$_cv_gnu_make_command = x ; then
# mv Makefile GNUmakefile
# echo .DEFAULT: > Makefile ;
# echo \ $_cv_gnu_make_command \$@ >> Makefile;
# fi
#
# Then, if any (well almost any) other make is called, and GNU make also
# exists, then the other make wraps the GNU make.
#
# LICENSE
#
# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
AC_DEFUN([AX_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
_cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
) ;
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
if test "x$_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
else
ifGNUmake='#' ;
AC_MSG_RESULT("Not found");
fi
AC_SUBST(ifGNUmake)
] )

View File

@ -1,212 +0,0 @@
## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*-
## Copyright (C) 2001 Eazel, Inc.
## Author: Maciej Stachowiak <mjs@noisehavoc.org>
## Kenneth Christiansen <kenneth@gnu.org>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
# serial 42 IT_PROG_INTLTOOL
AC_DEFUN([IT_PROG_INTLTOOL], [
AC_PREREQ([2.50])dnl
AC_REQUIRE([AM_NLS])dnl
case "$am__api_version" in
1.[01234])
AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool])
;;
*)
;;
esac
INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
if test -n "$1"; then
AC_MSG_CHECKING([for intltool >= $1])
AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.])
fi
AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update])
AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge])
AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract])
if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.])
fi
if test -z "$AM_DEFAULT_VERBOSITY"; then
AM_DEFAULT_VERBOSITY=1
fi
AC_SUBST([AM_DEFAULT_VERBOSITY])
INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))'
INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))'
INTLTOOL__v_MERGE_0='@echo " ITMRG " [$]@;'
AC_SUBST(INTLTOOL_V_MERGE)
AC_SUBST(INTLTOOL__v_MERGE_)
AC_SUBST(INTLTOOL__v_MERGE_0)
INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))'
intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))'
intltool__v_merge_options_0='-q'
AC_SUBST(INTLTOOL_V_MERGE_OPTIONS)
AC_SUBST(intltool__v_merge_options_)
AC_SUBST(intltool__v_merge_options_0)
INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< [$]@'
INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< [$]@'
else
INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.[$][$]RANDOM && mkdir [$][$]_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u [$][$]_it_tmp_dir $< [$]@ && rmdir [$][$]_it_tmp_dir'
fi
INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
_IT_SUBST(INTLTOOL_DESKTOP_RULE)
_IT_SUBST(INTLTOOL_DIRECTORY_RULE)
_IT_SUBST(INTLTOOL_KEYS_RULE)
_IT_SUBST(INTLTOOL_PROP_RULE)
_IT_SUBST(INTLTOOL_OAF_RULE)
_IT_SUBST(INTLTOOL_PONG_RULE)
_IT_SUBST(INTLTOOL_SERVER_RULE)
_IT_SUBST(INTLTOOL_SHEET_RULE)
_IT_SUBST(INTLTOOL_SOUNDLIST_RULE)
_IT_SUBST(INTLTOOL_UI_RULE)
_IT_SUBST(INTLTOOL_XAM_RULE)
_IT_SUBST(INTLTOOL_KBD_RULE)
_IT_SUBST(INTLTOOL_XML_RULE)
_IT_SUBST(INTLTOOL_XML_NOMERGE_RULE)
_IT_SUBST(INTLTOOL_CAVES_RULE)
_IT_SUBST(INTLTOOL_SCHEMAS_RULE)
_IT_SUBST(INTLTOOL_THEME_RULE)
_IT_SUBST(INTLTOOL_SERVICE_RULE)
_IT_SUBST(INTLTOOL_POLICY_RULE)
# Check the gettext tools to make sure they are GNU
AC_PATH_PROG(XGETTEXT, xgettext)
AC_PATH_PROG(MSGMERGE, msgmerge)
AC_PATH_PROG(MSGFMT, msgfmt)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
fi
xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`"
mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`"
mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`"
if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then
AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
fi
AC_PATH_PROG(INTLTOOL_PERL, perl)
if test -z "$INTLTOOL_PERL"; then
AC_MSG_ERROR([perl not found])
fi
AC_MSG_CHECKING([for perl >= 5.8.1])
$INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1
if test $? -ne 0; then
AC_MSG_ERROR([perl 5.8.1 is required for intltool])
else
IT_PERL_VERSION=`$INTLTOOL_PERL -e "printf '%vd', $^V"`
AC_MSG_RESULT([$IT_PERL_VERSION])
fi
if test "x$2" != "xno-xml"; then
AC_MSG_CHECKING([for XML::Parser])
if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then
AC_MSG_RESULT([ok])
else
AC_MSG_ERROR([XML::Parser perl module is required for intltool])
fi
fi
# Substitute ALL_LINGUAS so we can use it in po/Makefile
AC_SUBST(ALL_LINGUAS)
IT_PO_SUBDIR([po])
])
# IT_PO_SUBDIR(DIRNAME)
# ---------------------
# All po subdirs have to be declared with this macro; the subdir "po" is
# declared by IT_PROG_INTLTOOL.
#
AC_DEFUN([IT_PO_SUBDIR],
[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS.
dnl
dnl The following CONFIG_COMMANDS should be executed at the very end
dnl of config.status.
AC_CONFIG_COMMANDS_PRE([
AC_CONFIG_COMMANDS([$1/stamp-it], [
if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then
AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.])
fi
rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp"
>"$1/stamp-it.tmp"
[sed '/^#/d
s/^[[].*] *//
/^[ ]*$/d
'"s|^| $ac_top_srcdir/|" \
"$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES"
]
[sed '/^POTFILES =/,/[^\\]$/ {
/^POTFILES =/!d
r $1/POTFILES
}
' "$1/Makefile.in" >"$1/Makefile"]
rm -f "$1/Makefile.tmp"
mv "$1/stamp-it.tmp" "$1/stamp-it"
])
])dnl
])
# _IT_SUBST(VARIABLE)
# -------------------
# Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
#
AC_DEFUN([_IT_SUBST],
[
AC_SUBST([$1])
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
]
)
# deprecated macros
AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL])
# A hint is needed for aclocal from Automake <= 1.9.4:
# AC_DEFUN([AC_PROG_INTLTOOL], ...)

8394
m4/libtool.m4 vendored

File diff suppressed because it is too large Load Diff

437
m4/ltoptions.m4 vendored
View File

@ -1,437 +0,0 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 8 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option '$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
[_LT_WITH_AIX_SONAME([aix])])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the 'shared' and
# 'disable-shared' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the 'static' and
# 'disable-static' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the 'fast-install'
# and 'disable-fast-install' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
# the AIX toolchain works better with OBJECT_MODE set (default 32).
if test 64 = "${OBJECT_MODE-32}"; then
shared_archive_member_spec=shr_64
else
shared_archive_member_spec=shr
fi
fi
;;
*)
with_aix_soname=aix
;;
esac
_LT_DECL([], [shared_archive_member_spec], [0],
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
])# _LT_WITH_AIX_SONAME
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])

124
m4/ltsugar.m4 vendored
View File

@ -1,124 +0,0 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59, which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])

23
m4/ltversion.m4 vendored
View File

@ -1,23 +0,0 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 4179 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.6])
m4_define([LT_PACKAGE_REVISION], [2.4.6])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.6'
macro_revision='2.4.6'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

99
m4/lt~obsolete.m4 vendored
View File

@ -1,99 +0,0 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])

215
missing
View File

@ -1,215 +0,0 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,162 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2018-03-07.03; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the 'mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because '.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,27 +0,0 @@
ar
ast
ca
da
de
en_GB
en_US
es
fi
fr
gl
hu
id
it
ja
ko
nl
pl
pt_BR
ro
ru
sk
sv
th
tr
zh_CN
zh_TW

View File

@ -1,221 +0,0 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
#
# This file may be copied and used freely without restrictions. It may
# be used in projects which are not available under a GNU Public License,
# but which still want to provide support for the GNU gettext functionality.
#
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
# instead of PACKAGE and to look for po2tbl in ./ not in intl/
#
# - Modified by jacob berkman <jacob@ximian.com> to install
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
#
# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool
#
# We have the following line for use by intltoolize:
# INTLTOOL_MAKEFILE
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
localedir = @localedir@
subdir = po
install_sh = @install_sh@
# Automake >= 1.8 provides @mkdir_p@.
# Until it can be supposed, use the safe fallback:
mkdir_p = $(install_sh) -d
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
ALL_LINGUAS = @ALL_LINGUAS@
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi)
USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS
POTFILES = \
# This comment gets stripped out
CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
.SUFFIXES:
.SUFFIXES: .po .pox .gmo .mo .msg .cat
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V))
INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@;
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $* $(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
.po.gmo:
$(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && gencat $@ $*.msg
all: all-@USE_NLS@
all-yes: $(CATALOGS)
all-no:
$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(GENPOT)
install: install-data
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $$dir; \
if test -r $$lang.gmo; then \
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
else \
$(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $(srcdir)/$$lang.gmo as" \
"$$dir/$(GETTEXT_PACKAGE).mo"; \
fi; \
if test -r $$lang.gmo.m; then \
$(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
else \
if test -r $(srcdir)/$$lang.gmo.m ; then \
$(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
$$dir/$(GETTEXT_PACKAGE).mo.m; \
echo "installing $(srcdir)/$$lang.gmo.m as" \
"$$dir/$(GETTEXT_PACKAGE).mo.m"; \
else \
true; \
fi; \
fi; \
done
# Empty stubs to satisfy archaic automake needs
dvi info ctags tags CTAGS TAGS ID:
# Define this as empty until I found a useful application.
install-exec installcheck:
uninstall:
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
done
check: all $(GETTEXT_PACKAGE).pot
rm -f missing notexist
srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
if [ -r missing -o -r notexist ]; then \
exit 1; \
fi
mostlyclean:
rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
rm -f .intltool-merge-cache
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES stamp-it
rm -f *.mo *.msg *.cat *.cat.m *.gmo
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f Makefile.in.in
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: $(DISTFILES)
dists="$(DISTFILES)"; \
extra_dists="$(EXTRA_DISTFILES)"; \
for file in $$extra_dists; do \
test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
done; \
for file in $$dists; do \
test -f $$file || file="$(srcdir)/$$file"; \
ln $$file $(distdir) 2> /dev/null \
|| cp -p $$file $(distdir); \
done
update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot
tmpdir=`pwd`; \
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
echo "$$lang:"; \
result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
if $$result; then \
if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$lang.gmo failed!"; \
rm -f $$tmpdir/$$lang.new.po; \
fi; \
done
Makefile POTFILES: stamp-it
@if test ! -f $@; then \
rm -f stamp-it; \
$(MAKE) stamp-it; \
fi
stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
$(SHELL) ./config.status
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

70
po/README Normal file
View File

@ -0,0 +1,70 @@
Translation README
Syncevolution Moblin (GTK+) UI uses standard gettext translations (.po files)
and Transifex for translator web access.
What follows is a very short technical guide to translating. For more extensive
documentation, please refer to the GNOME localisation guide* or even the
gettext manual** (the latter is unfortunately fairly programmer oriented).
Notes to translators
====================
1. Get the strings that need translating
The easiest way to get the po-file is via
http://translate.moblin.org/projects/syncevolution/ . If the file for your
language does not exist yet, take the template file (.pot) and rename it to
xx.po, where xx is the language code).
Alternatively if you have configured SyncEvolution sources, you can get
an up-to-date template (.pot) and .po files by running "make update-po" in
/po source directory.
2. Translate
Simply fill in the empty msgstr strings in the file. Graphical translation
tools such as gtranslator are available in most linux distributions.
Two features a translator must know are c-format strings and plural form handling.
For help with c-format strings, see GNOME Localisation Guide*.
If there are untranslatable strings or you do not understand the context, please
file a bug on moblin bugzilla (product "SyncEvolution", component "GTK UI") or
ask on the mailing list.
3. Upload
Upload the .po file using the webservice: For existing translations click "Send
a translation for this language". For new languages use "Add new translation".
Alternatively you can open a bug on moblin bugzilla and attach the po-file
there.
Notes to developers
===================
1. Testing to-be-translated strings:
The translation webservice produces the translation files but "make update-po"
in /po source directory can still be useful for testing: it will update the
translation template and all translations with new strings. When a translation
is listed in po/LINGUAS, 'make' will build the message catalog (.gmo) and
"make install" will install it.
2. Getting strings translated:
The translation webservice watches 'moblin-transifex' branch. When you want your
new strings to be translated, rebase/merge from master. Depending on the case,
you may want to mention about string changes on the mailing list.
3. Getting translated strings into a release
merge moblin-transifex to master once in a while to get translation updates.
* http://live.gnome.org/TranslationProject/LocalisationGuide
** http://www.gnu.org/software/gettext/manual/gettext.html

41
src/README.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2008 Patrick Ohly <patrick.ohly@gmx.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
/**
* @mainpage Getting Started
*
* This documentation for SyncEvolution and the Funambol C++ Client
* API was generated automatically from the source code.
*
* While most of the classes in SyncEvolution are documented, very
* little effort was spent on organizing this information in a coherent
* way. If you are a developer who wants to write a SyncML client based
* on the SyncEvolution framework, then you should have a look at
* the following classes:
* - TrackingSyncSource is the most convenient class to derive from.
* - EvolutionSyncSource is a bit more general.
* - RegisterSyncSource adds additional sources to the framework.
*
* The following classes help with testing your derived classes:
* - RegisterSyncSourceTest is what you have to use.
* - TestEvolution uses that information.
* - ClientTest, LocalTests, SyncTests are used by TestEvolution.
*
* The FileSyncSource is a good example to get started.
*/

18
src/README.templates Normal file
View File

@ -0,0 +1,18 @@
The configuration templates in "templates" get installed into
$(datadir)/syncevolution/templates.
When adding/changing a new server, then only enter the properties
which need to be changed here so that the default values can
be used for the remaining properties.
An icon can be added here for servers. The file name must start with
"icon".
Server configurations must be kept in sync in three different places:
- here (if a server is installed as files)
- in SyncEvolutionConfig.cpp's EvolutionSyncConfig::createServerTemplate()
- in SyncEvolutionCmdline.cpp's test server configs
- in test/test-dbus.py testGetConfigsTemplates()
Note that server icons must come with a suitable license that allows
redistribution.

View File

@ -0,0 +1,32 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "contactssyncsource.h"
#include "settings.h"
ContactsSyncSource::ContactsSyncSource(TimeTrackingObserver *observer,
ContactsSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: AkonadiSyncSource(observer, config, managerConfig)
{
m_collectionId = Settings::self()->contactsCollectionId();
m_lastSyncTime = Settings::self()->contactsLastSyncTime();
}
#include "moc_contactssyncsource.cpp"

View File

@ -0,0 +1,56 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef CONTACTSSYNCSOURCE_H
#define CONTACTSSYNCSOURCE_H
#include "akonadisyncsource.h"
/**
*
*/
class ContactsSyncSourceConfig : public AkonadiSyncSourceConfig
{
Q_OBJECT
public:
ContactsSyncSourceConfig()
: AkonadiSyncSourceConfig(Settings::self()->contactsLastSyncTime().toTime_t(),
Settings::self()->contactsRemoteDatabaseName().toLatin1())
{
setName(Settings::self()->contactsCollectionName().toLatin1());
setType("text/vcard");
setSupportedTypes("text/x-vcard,text/vcard");
}
};
/**
*
*/
class ContactsSyncSource : public AkonadiSyncSource
{
Q_OBJECT
public:
ContactsSyncSource(TimeTrackingObserver *observer,
ContactsSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
};
#endif

View File

@ -0,0 +1,33 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "eventssyncsource.h"
#include "settings.h"
EventsSyncSource::EventsSyncSource(TimeTrackingObserver *observer,
EventsSyncSourceConfig *config,
SyncManagerConfig *managerConfig)
: AkonadiSyncSource(observer, config, managerConfig)
{
m_collectionId = Settings::self()->eventsCollectionId();
m_lastSyncTime = Settings::self()->eventsLastSyncTime();
}
#include "moc_eventssyncsource.cpp"

View File

@ -0,0 +1,56 @@
/*
Copyright (c) 2009 Sascha Peilicke <sasch.pe@gmx.de>
This application is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This application is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this application; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef EVENTSSYNCSOURCE_H
#define EVENTSSYNCSOURCE_H
#include "akonadisyncsource.h"
/**
*
*/
class EventsSyncSourceConfig : public AkonadiSyncSourceConfig
{
Q_OBJECT
public:
EventsSyncSourceConfig()
: AkonadiSyncSourceConfig(Settings::self()->eventsLastSyncTime().toTime_t(),
Settings::self()->eventsRemoteDatabaseName().toLatin1())
{
setName(Settings::self()->eventsCollectionName().toLatin1());
setType("text/x-vcalendar");
setSupportedTypes("text/x-vcalendar:");
}
};
/**
*
*/
class EventsSyncSource : public AkonadiSyncSource
{
Q_OBJECT
public:
EventsSyncSource(TimeTrackingObserver *observer,
EventsSyncSourceConfig *config,
SyncManagerConfig *managerConfig);
};
#endif

Some files were not shown because too many files have changed in this diff Show More