docbook2latex.xsl revision dd1de51db071be42f2acdf532c49c851b78b0812
<?xml version="1.0"?>
<!--
translates a DocBook XML source into a LaTeX source file,
which can be processed with pdflatex to produce a
pretty PDF file.
Note: In the LaTeX output, this XSLT encodes all quotes
with \QUOTE{} commands, which are not defined in this
file. This is because XSLT does not support regular
expressions natively and therefore it is rather difficult
to implement proper "pretty quotes" (different glyphs for
makefile solves this by running sed over the LaTeX source
once more, replacing all \QUOTE{} commands with
\OQ{} and \CQ{} commands, which _are_ defined to the
pretty quotes for English in the LaTeX output generated
by this XSLT (see below).
Copyright (C) 2006-2012 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
General Public License (GPL) as published by the Free Software
Foundation, in version 2 as it comes in the "COPYING" file of the
VirtualBox OSE distribution. VirtualBox OSE is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:str="http://xsltsl.org/string"
>
<xsl:variable name="g_nlsChapter">
<xsl:choose>
<xsl:when test="$TARGETLANG='de_DE'">Kapitel</xsl:when>
<xsl:when test="$TARGETLANG='fr_FR'">chapitre</xsl:when>
<xsl:when test="$TARGETLANG='en_US'">chapter</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="g_nlsPage">
<xsl:choose>
<xsl:when test="$TARGETLANG='de_DE'">auf Seite</xsl:when>
<xsl:when test="$TARGETLANG='fr_FR'">page</xsl:when>
<xsl:when test="$TARGETLANG='en_US'">page</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="g_nlsNote">
<xsl:choose>
<xsl:when test="$TARGETLANG='de_DE'">Hinweis</xsl:when>
<xsl:when test="$TARGETLANG='fr_FR'">Note</xsl:when>
<xsl:when test="$TARGETLANG='en_US'">Note</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="g_nlsWarning">
<xsl:choose>
<xsl:when test="$TARGETLANG='de_DE'">Warnung</xsl:when>
<xsl:when test="$TARGETLANG='fr_FR'">Avertissement</xsl:when>
<xsl:when test="$TARGETLANG='en_US'">Warning</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="para"/>
<xsl:template match="/book">
<xsl:text>
\documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
\usepackage{geometry}
\geometry{top=3cm,bottom=4cm}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabulary}
\usepackage[pdftex,
a4paper,
colorlinks=true,
linkcolor=blue,
urlcolor=darkgreen,
bookmarksnumbered,
bookmarksopen=true,
bookmarksopenlevel=0,
hyperfootnotes=false,
plainpages=false,
pdfpagelabels
]{hyperref}
\usepackage{nameref}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{fancyvrb}
\usepackage{alltt}
\usepackage{color}
\definecolor{darkgreen}{rgb}{0,0.6,0}
</xsl:text>
<xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel} \PrerenderUnicode{ü}</xsl:if>
<!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel} \FrenchItemizeSpacingfalse \renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
this command is no longer understood by TexLive2008
-->
<xsl:text>
% use Palatino as serif font:
% \usepackage{mathpazo}
\usepackage{charter}
% use Helvetica as sans-serif font:
\usepackage{helvet}
% use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
% (requires texlive-fontsextra)
\usepackage[scaled]{beramono}
% previously: use Courier as typewriter font:
% \usepackage{courier}
\definecolor{colNote}{rgb}{0,0,0}
\definecolor{colWarning}{rgb}{0,0,0}
\definecolor{colScreenFrame}{rgb}{0,0,0}
\definecolor{colScreenText}{rgb}{0,0,0}
% number headings down to this level
\setcounter{secnumdepth}{3}
% more space for the section numbers
\makeatletter
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
\renewcommand*\@pnumwidth{1.7em}
\renewcommand*\@tocrmarg{5.0em}
\makeatother
% more tolerance at 2nd wrap stage:
\tolerance = 1000
% allow 3rd wrap stage:
\emergencystretch = 10pt
% no Schusterjungen:
\clubpenalty = 10000
% no Hurenkinder:
\widowpenalty = 10000
\displaywidowpenalty = 10000
% max pdf compression:
\pdfcompresslevel9
% opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
</xsl:text>
<xsl:choose>
<xsl:when test="$TARGETLANG='de_DE'">
<xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}} \newcommand\CQ{\texorpdfstring{\grqq}{"}} </xsl:text>
</xsl:when>
<xsl:when test="$TARGETLANG='fr_FR'">
<xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
</xsl:when>
<xsl:when test="$TARGETLANG='en_US'">
<xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates />
<xsl:text>
\end{document}
</xsl:text>
</xsl:template>
<xsl:template match="bookinfo">
<xsl:apply-templates />
<xsl:text>
\newcommand\docbookbookinfocopyright{\copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}

\author{ \docbooktitleedition \\ %
\\ %
</xsl:text>
<xsl:text>\docbookbookinfoaddress \\ %
\\ %
</xsl:text>
</xsl:if>
<xsl:text>\docbookbookinfocopyright \\ %
}
\title{\docbooktitle \\
\docbooksubtitle}
% \subtitle{\docbooksubtitle}
\hypersetup{pdfauthor=\docbookcorpauthor}
\hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
\hyphenation{da-ta-ba-ses}
\hyphenation{deb-conf}
\hyphenation{VirtualBox}
\begin{document}
% \maketitle
%\begin{titlepage}
\thispagestyle{empty}
\begin{minipage}{\textwidth}
\begin{center}
\includegraphics[width=4cm]{images/vboxlogo.png}
\end{center}%
\vspace{10mm}
{\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
\begin{center}
\docbooktitle
\end{center}%
\vspace{10mm}
}
{\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
\begin{center}
\docbooksubtitle
\end{center}%
\vspace{10mm}
}
{\fontsize{16pt}{20pt}\selectfont\rmfamily%
\begin{center}
\docbooktitleedition
\vspace{2mm}
\docbookbookinfocopyright
\vspace{2mm}
\docbookbookinfoaddress
\end{center}%
}
%\end{titlepage}
\end{minipage}
\tableofcontents
</xsl:text>
</xsl:template>
<xsl:template match="subtitle">
<xsl:choose>
<xsl:when test="name(..)='bookinfo'">
<xsl:text>\newcommand\docbooksubtitle{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="title">
<xsl:choose>
<xsl:when test="name(..)='bookinfo'">
<xsl:text>\newcommand\docbooktitle{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='chapter'">
<xsl:text>

\chapter{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='sect1'">
<xsl:text>

\section{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='sect2'">
<xsl:text>

\subsection{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='sect3'">
<xsl:text>

\subsubsection{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='sect4'">
<xsl:text>

\paragraph{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='sect5'">
<xsl:text>

\subparagraph{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='appendix'">
<xsl:text>

\chapter{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="name(..)='glossdiv'">
<xsl:text>

\section*{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:variable name="refid" select="../@id" />
<xsl:if test="$refid">
<xsl:value-of select="concat('
\label{', $refid, '}')" />
</xsl:if>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="edition">
<xsl:choose>
<xsl:when test="name(..)='bookinfo'">
<xsl:text>\newcommand\docbooktitleedition{</xsl:text>
<xsl:apply-templates />
<xsl:text>}
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="corpauthor">
<xsl:choose>
<xsl:when test="name(..)='bookinfo'">
<xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
<xsl:apply-templates />
<xsl:text>}
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="address">
<xsl:choose>
<xsl:when test="name(..)='bookinfo'">
<xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
<xsl:apply-templates />
<xsl:text>}
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="year">
<xsl:choose>
<xsl:when test="name(..)='copyright'">
<xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
<xsl:apply-templates />
<xsl:text>}
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="holder">
<xsl:choose>
<xsl:when test="name(..)='copyright'">
<xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
<xsl:apply-templates />
<xsl:text>}
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="glossary">
<xsl:text>

\backmatter
\chapter{Glossary}
</xsl:text>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="para">
<xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning')">
<xsl:text>

</xsl:text>
</xsl:if>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="note">
<xsl:value-of select="concat('

\vspace{.2cm}

\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colNote}\textbf{', $g_nlsNote, ':} ')" />
<xsl:apply-templates />
<xsl:text>\end{minipage}}\end{center}

\vspace{.2cm}

</xsl:text>
</xsl:template>
<xsl:template match="warning">
<xsl:value-of select="concat('

\vspace{.2cm}

\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colWarning}\textbf{', $g_nlsWarning, ':} ')" />
<xsl:apply-templates />
<xsl:text>\end{minipage}}\end{center}

\vspace{.2cm}

</xsl:text>
</xsl:template>
<xsl:template match="screen">
<xsl:text>

\begin{Verbatim}[fontsize=\footnotesize]
</xsl:text>
<xsl:apply-templates />
<xsl:text>
\end{Verbatim}
</xsl:text>
</xsl:template>
<xsl:template match="programlisting">
<xsl:text>

{\small\begin{alltt}
</xsl:text>
<xsl:apply-templates />
<xsl:text>
\end{alltt}}
</xsl:text>
</xsl:template>
<xsl:template match="footnote">
<xsl:text>\footnote{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="tgroup">
<xsl:choose>
<xsl:when test="@style='verywide'">
<xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]{|L|L|L|}
\hline
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>

{\small\begin{center}
\begin{tabulary}{.9\textwidth}[]{|L|L|L|}
\hline
</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates />
<xsl:text>
\end{tabulary}
\end{center}}
</xsl:text>
</xsl:template>
<xsl:template match="row">
<xsl:apply-templates />
<xsl:text>
\\ \hline
</xsl:text>
</xsl:template>
<xsl:template match="entry">
<xsl:if test="not(position()=1)">
<xsl:text> & </xsl:text>
</xsl:if>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="itemizedlist">
<xsl:text>

\begin{itemize}
</xsl:text>
<xsl:apply-templates />
<xsl:text>
\end{itemize}
</xsl:text>
</xsl:template>
<xsl:template match="orderedlist">
<xsl:text>

\begin{enumerate}
</xsl:text>
<xsl:apply-templates />
<xsl:text>
\end{enumerate}
</xsl:text>
</xsl:template>
<xsl:template match="listitem">
<xsl:text>

\item </xsl:text>
<xsl:apply-templates />
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="glossterm">
<xsl:variable name="refid" select="(@id)" />
<xsl:if test="$refid">
<xsl:value-of select="concat('
\label{', $refid, '}')" />
</xsl:if>
<xsl:text>

\item[</xsl:text>
<xsl:apply-templates />
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="glosslist | glossdiv">
<xsl:text>

\begin{description}
</xsl:text>
<xsl:apply-templates />
<xsl:text>
\end{description}
</xsl:text>
</xsl:template>
<xsl:template match="superscript">
<xsl:variable name="contents">
<xsl:apply-templates />
</xsl:variable>
<xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
</xsl:template>
<xsl:template match="emphasis">
<xsl:choose>
<xsl:when test="@role='bold'">
<xsl:text>\textbf{</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\textit{</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="computeroutput | code">
<xsl:text>\texttt{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="ulink">
<xsl:text>\url{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="xref">
<xsl:choose>
<xsl:when test="@xreflabel">
<xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @xreflabel, '}}')" />
</xsl:when>
<xsl:when test="@apiref='yes'">
<xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
<xsl:apply-templates />
<xsl:value-of select="'}}'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- for some reason, DocBook insists of having image data nested this way always:
mediaobject -> imageobject -> imagedata
but only imagedata is interesting -->
<xsl:template match="imagedata">
<xsl:if test="@align='center'">
<xsl:text>\begin{center}</xsl:text>
</xsl:if>
<xsl:value-of select="concat('
\includegraphics[width=', @width, ']{', @fileref, '}
')" />
<xsl:apply-templates />
<xsl:if test="@align='center'">
<xsl:text>\end{center}</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="//text()">
<xsl:variable name="subst1">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="." />
<xsl:with-param name="replace" select="'\'" />
<xsl:with-param name="with" select="'\textbackslash{}'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="(name(..)='screen') or (name(../..)='screen')">
<xsl:value-of select="." />
</xsl:when>
<xsl:when test="(name(..)='computeroutput') or (name(../..)='computeroutput') or (name(..)='code') or (name(../..)='code')">
<xsl:variable name="subst2">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst1" />
<xsl:with-param name="replace" select="'--'" />
<xsl:with-param name="with" select="'-{}-'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst3">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst2" />
<xsl:with-param name="replace" select="'_'" />
<xsl:with-param name="with" select="'\_'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst4">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst3" />
<xsl:with-param name="replace" select="'$'" />
<xsl:with-param name="with" select="'\$'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst5">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst4" />
<xsl:with-param name="replace" select="'%'" />
<xsl:with-param name="with" select="'\%'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst6">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst5" />
<xsl:with-param name="replace" select="'#'" />
<xsl:with-param name="with" select="'\#'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst7">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst6" />
<xsl:with-param name="replace" select="'~'" />
<xsl:with-param name="with" select="'\textasciitilde '" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst8">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst7" />
<xsl:with-param name="replace" select="'&'" />
<xsl:with-param name="with" select="'\&'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$subst8" />
</xsl:when>
<xsl:when test="(name(..)='address') or (name(../..)='address')">
<xsl:variable name="subst2">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst1" />
<xsl:with-param name="replace" select="'
'" />
<xsl:with-param name="with" select="' \\'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$subst2" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="subst2">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst1" />
<xsl:with-param name="replace" select="'_'" />
<xsl:with-param name="with" select="'\_'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst3">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst2" />
<xsl:with-param name="replace" select="'$'" />
<xsl:with-param name="with" select="'\$'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst4">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst3" />
<xsl:with-param name="replace" select="'%'" />
<xsl:with-param name="with" select="'\%'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst5">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst4" />
<xsl:with-param name="replace" select="'#'" />
<xsl:with-param name="with" select="'\#'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst6">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst5" />
<xsl:with-param name="replace" select="'µ'" />
<xsl:with-param name="with" select="'$\mu$'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst7">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst6" />
<xsl:with-param name="replace" select="'®'" />
<xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="quote">"</xsl:variable>
<!-- preparation for pretty quotes: replace all double quotes _outside_ screen
sections with "\QUOTE{}" strings, which the makefile will then replace
with pretty quotes by invoking sed a few times. Unfortunately there are
no regular expressions in XSLT so there's no other way. -->
<xsl:variable name="subst8">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst7" />
<xsl:with-param name="replace" select="$quote" />
<xsl:with-param name="with" select="'\QUOTE{}'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst9">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst8" />
<xsl:with-param name="replace" select="'~'" />
<xsl:with-param name="with" select="'\textasciitilde '" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="subst10">
<xsl:call-template name="str:subst">
<xsl:with-param name="text" select="$subst9" />
<xsl:with-param name="replace" select="'&'" />
<xsl:with-param name="with" select="'\&'" />
<xsl:with-param name="disable-output-escaping" select="no" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$subst10" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>