]> granicus.if.org Git - apache/commitdiff
A first attempt at xslt to create a latex file from our xml docs.
authorJoshua Slive <slive@apache.org>
Wed, 4 Jun 2003 19:38:19 +0000 (19:38 +0000)
committerJoshua Slive <slive@apache.org>
Wed, 4 Jun 2003 19:38:19 +0000 (19:38 +0000)
Lots of things remain to be done here; see TODO for some ideas.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100172 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/style/latex/TODO [new file with mode: 0644]
docs/manual/style/latex/atbeginend.sty [new file with mode: 0644]
docs/manual/style/latex/common.xsl [new file with mode: 0644]
docs/manual/style/latex/html.xsl [new file with mode: 0644]
docs/manual/style/latex/latex.xsl [new file with mode: 0644]
docs/manual/style/latex/manualpage.xsl [new file with mode: 0644]
docs/manual/style/latex/synopsis.xsl [new file with mode: 0644]

diff --git a/docs/manual/style/latex/TODO b/docs/manual/style/latex/TODO
new file mode 100644 (file)
index 0000000..53faedf
--- /dev/null
@@ -0,0 +1,44 @@
+Some things that need to be done with the LaTeX transforms:
+
+- Finish special pages:
+  * module index
+  * directive index
+  * quick reference
+  * faq
+
+- Fix tables
+
+  Perhaps we need to add some xml hints about the size of different
+  columns in the source files.  For example:
+  <table><columnlist><column width="20%"/><column width="80%"/></columnlist>
+  <tr><td>...
+
+- href
+
+  External hrefs should be transformed to \footnote{}s, but it's not
+  working at the moment.  It is easy enough just to <value-of> the @href,
+  but this won't work because the result needs to be run through the
+  escaping routines or LaTeX will barf.
+
+- Images
+
+  A quick search makes me believe that pdftex will not handle gifs.
+  It probably will handle png.
+
+- Fix quotes
+
+  In LaTeX, quotes should be like ``This''.  This may
+  not be feasible for us, in which case we could simply replace
+  " with \texttt{"} or something, so that the quotes are all straight.
+
+- Add hyperlinks for directives and modules (for online use only,
+  not page number references).
+
+- Reduce the size of the pdf (both bytes and pages) in any way possible.
+
+- Hundreds of other little problems with presentation, cross-referencing,
+  etc.
+
+- Fix build system
+
+- Cleanup xsl to make it more readable.
\ No newline at end of file
diff --git a/docs/manual/style/latex/atbeginend.sty b/docs/manual/style/latex/atbeginend.sty
new file mode 100644 (file)
index 0000000..8729fa6
--- /dev/null
@@ -0,0 +1,65 @@
+% atbeginend.sty 
+%
+% defines
+% \BeforeBegin{environment}{code-to-execute}
+% \BeforeEnd  {environment}{code-to-execute}
+% \AfterBegin {environment}{code-to-execute}
+% \AfterEnd   {environment}{code-to-execute}
+%
+% Save \begin and \end to \BeginEnvironment and \EndEnvironment
+\let\BeginEnvironment=\begin
+\let\EndEnvironment=\end
+
+\def\IfUnDef#1{\expandafter\ifx\csname#1\endcsname\relax}
+
+% Null command needed to for \nothing{something}=.nothing.
+\def\NullCom#1{}
+
+\def\begin#1{%
+%
+% if defined \BeforeBeg for this environment, execute it
+\IfUnDef{BeforeBeg#1}\else\csname BeforeBeg#1\endcsname\fi%
+%
+%
+%
+\IfUnDef{AfterBeg#1}% This is done to skip the command for environments
+                    % which can take arguments, like multicols; YOU MUST NOT
+                    % USE \AfterBegin{...}{...} for such environments!
+       \let\SaveBegEng=\BeginEnvironment%
+\else%
+       % Start this environment
+               \BeginEnvironment{#1}%
+       % and execute code after \begin{environment}
+               \csname AfterBeg#1\endcsname%
+       % 
+       \let\SaveBegEng=\NullCom%
+\fi%
+\SaveBegEng{#1}%
+}
+
+
+\def\end#1{%
+%
+% execute code before \end{environment}
+\IfUnDef{BeforeEnd#1}\else\csname BeforeEnd#1\endcsname\fi%
+%
+% close this environment
+\EndEnvironment{#1}%
+%
+% and execute code after \begin{environment}
+\IfUnDef{AfterEnd#1}\else\csname AfterEnd#1\endcsname\fi%
+}
+
+
+%% Now, define commands
+% \BeforeBegin{environment}{code-to-execute}
+% \BeforeEnd  {environment}{code-to-execute}
+% \AfterBegin {environment}{code-to-execute}
+% \AfterEnd   {environment}{code-to-execute}
+
+\def\BeforeBegin#1#2{\expandafter\gdef\csname BeforeBeg#1\endcsname
+{#2}}
+\def\BeforeEnd  #1#2{\expandafter\gdef\csname BeforeEnd#1\endcsname
+{#2}}
+\def\AfterBegin #1#2{\expandafter\gdef\csname AfterBeg#1\endcsname {#2}}
+\def\AfterEnd   #1#2{\expandafter\gdef\csname AfterEnd#1\endcsname{#2}}
diff --git a/docs/manual/style/latex/common.xsl b/docs/manual/style/latex/common.xsl
new file mode 100644 (file)
index 0000000..3ab1872
--- /dev/null
@@ -0,0 +1,172 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                  xmlns="http://www.w3.org/1999/xhtml">
+
+<!-- Constants used for case translation -->
+<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
+<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
+
+<!-- ==================================================================== -->
+<!-- Process a documentation section                                      -->
+<!-- ==================================================================== -->
+<xsl:template match="section">
+<xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="section/title">
+<xsl:text>\subsection*{</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}</xsl:text><xsl:call-template name="label"/>
+<xsl:text>
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="section/section/title">
+<xsl:text>\subsubsection*{</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}</xsl:text><xsl:call-template name="label"/>
+<xsl:text>
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="section/section/section/title">
+<xsl:text>\subsubsection*{</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}</xsl:text><xsl:call-template name="label"/>
+<xsl:text>
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="note/title"></xsl:template>
+<xsl:template match="example/title"></xsl:template>
+
+<xsl:template name="label">
+<xsl:if test="../@id">
+<xsl:variable name="metafile" select="document(/*/@metafile)/metafile" />
+<xsl:text>\label{</xsl:text><xsl:value-of 
+select="$metafile/path"/><xsl:value-of 
+select="$metafile/basename"/>
+<xsl:text>:</xsl:text>
+<xsl:value-of select="../@id"/>
+<xsl:text>}</xsl:text>
+</xsl:if>
+</xsl:template>
+
+
+<!-- ==================================================================== -->
+<!-- <example>                                                            -->
+<!-- ==================================================================== -->
+
+<xsl:template match="example">
+<xsl:text>\par\medskip\begin{center}</xsl:text>
+<xsl:if test="not(pre)"><xsl:text>\fbox{</xsl:text></xsl:if>
+<xsl:text>\begin{minipage}{.8\textwidth}\begin{flushleft}</xsl:text>
+<xsl:apply-templates select="title" mode="print" />
+<xsl:if test="not(pre)"><xsl:text>{\ttfamily </xsl:text></xsl:if>
+<xsl:text>\noindent </xsl:text><xsl:apply-templates/>
+<xsl:if test="not(pre)"><xsl:text>}</xsl:text></xsl:if>
+<xsl:text>\end{flushleft}\end{minipage}</xsl:text>
+<xsl:if test="not(pre)"><xsl:text>}</xsl:text></xsl:if>
+<xsl:text>\end{center}\par\medskip</xsl:text>
+</xsl:template>
+
+<xsl:template match="example/title" mode="print">
+<xsl:text>\textbf{</xsl:text>
+    <xsl:apply-templates/>
+<xsl:text>}\\ </xsl:text>
+</xsl:template>
+
+
+<!-- ==================================================================== -->
+<!-- indentations                                                         -->
+<!-- ==================================================================== -->
+<xsl:template match="indent">
+<xsl:text>\hfill\begin{minipage}{.9\textwidth}{\texttt </xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}\end{minipage}</xsl:text>
+</xsl:template>
+
+<!-- ==================================================================== -->
+<!-- <note>                                                               -->
+<!-- ==================================================================== -->
+<xsl:template match="note">
+<xsl:text>\par\medskip
+{\Huge $\Longrightarrow$}\begin{minipage}[t]{.8\textwidth}
+\noindent </xsl:text>
+<xsl:apply-templates select="title" mode="print" />
+<xsl:apply-templates/>
+<xsl:text>\end{minipage}\par\medskip</xsl:text>
+</xsl:template>
+
+<xsl:template match="note/title" mode="print">
+<xsl:text>\textbf{</xsl:text>
+    <xsl:apply-templates/>
+<xsl:text>} \\
+\noindent </xsl:text>
+</xsl:template>
+
+
+<!-- ==================================================================== -->
+<!-- <directive>                                                          -->
+<!-- Inserts link to another directive, which might be in another module. -->
+<!-- References are converted into lower case.                            -->
+<!-- ==================================================================== -->
+<xsl:template match="directive" name="directive">
+<xsl:text>\textsc{</xsl:text>
+        <xsl:if test="@type='section'">\textless{}</xsl:if>
+        <xsl:apply-templates/>
+        <xsl:if test="@type='section'">\textgreater{}</xsl:if>
+<xsl:text>}</xsl:text>
+</xsl:template>
+<!-- /directive -->
+
+<!-- ==================================================================== -->
+<!-- <module>                                                             -->
+<!-- Inserts a link to refereed module                                    -->
+<!-- ==================================================================== -->
+<xsl:template match="module" name="module">
+<xsl:text>\textsc{</xsl:text>
+    <xsl:apply-templates/>
+<xsl:text>}</xsl:text>
+</xsl:template>
+<!-- /module -->
+
+
+
+<!-- ==================================================================== -->
+<!-- <related>                                                            -->
+<!-- ==================================================================== -->
+<xsl:template match="related">
+<xsl:text>
+\fbox{\begin{tabular}{rr}
+\begin{minipage}[t]{.4\linewidth}
+\textbf{</xsl:text>
+<xsl:value-of select="$messages/message[@name='relatedmodules']" />
+<xsl:text>} \\
+</xsl:text>
+<xsl:for-each select="modulelist/module">
+<xsl:call-template name="module"/>
+<xsl:text> \\
+</xsl:text>
+</xsl:for-each>
+<xsl:text>
+\end{minipage} &amp; 
+\begin{minipage}[t]{.4\linewidth}
+\textbf{</xsl:text>
+<xsl:value-of select="$messages/message[@name='relateddirectives']" />
+<xsl:text>} \\
+</xsl:text>
+<xsl:for-each select="directivelist/directive">
+<xsl:call-template name="directive"/>
+<xsl:text> \\
+</xsl:text>
+</xsl:for-each>
+<xsl:text>
+\end{minipage}
+\end{tabular}}
+\medskip
+</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/docs/manual/style/latex/html.xsl b/docs/manual/style/latex/html.xsl
new file mode 100644 (file)
index 0000000..a4d75ae
--- /dev/null
@@ -0,0 +1,205 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                  xmlns="http://www.w3.org/1999/xhtml">
+
+
+<!-- ==================================================================== -->
+<!-- Ordinary HTML that must be converted to latex                        -->
+<!-- ==================================================================== -->
+
+<xsl:template match="ul">
+<xsl:text>\begin{itemize}
+</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>\end{itemize}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="ol">
+<xsl:text>\begin{enumerate}
+</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>\end{enumerate}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="li">
+<xsl:text>\item </xsl:text>
+<xsl:apply-templates/>
+<xsl:text>
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="dl">
+<xsl:text>\begin{description}
+</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>\end{description}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="dt">
+<xsl:text>\item[</xsl:text><xsl:apply-templates/>
+<xsl:text>] </xsl:text>
+</xsl:template>
+
+<xsl:template match="dd">
+<xsl:apply-templates/>
+</xsl:template>
+
+<!-- Latex doesn't like successive line breaks, so replace any
+     sequence of two or more br separated only by white-space with
+     one line break followed by smallskips. -->
+<xsl:template match="br">
+<xsl:choose>
+<xsl:when test="name(preceding-sibling::node()[1])='br'">
+<xsl:text>\smallskip </xsl:text>
+</xsl:when>
+<xsl:when test="name(preceding-sibling::node()[2])='br'">
+  <xsl:choose>
+  <xsl:when test="normalize-space(preceding-sibling::node()[1])=''">
+    <xsl:text>\smallskip </xsl:text>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:text>\\ </xsl:text>
+  </xsl:otherwise>
+  </xsl:choose>
+</xsl:when>
+<xsl:otherwise>
+<xsl:text>\\ </xsl:text>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+<xsl:template match="p">
+<xsl:apply-templates/>
+<xsl:text>\par
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="code">
+<xsl:text>\texttt{</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="strong">
+<xsl:text>\textbf{</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}</xsl:text>
+</xsl:template>
+
+<xsl:template match="em">
+<xsl:text>\textit{</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>}</xsl:text>
+</xsl:template>
+
+<!-- Value-of used here explicitly because we don't wan't latex-escaping
+performed.  Of course, this will conflict with html where some tags are
+interpreted in pre -->
+<xsl:template match="pre">
+<xsl:text>\begin{verbatim}
+</xsl:text>
+<xsl:value-of select="."/>
+<xsl:text>\end{verbatim}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="blockquote">
+<xsl:text>\begin{quotation}
+</xsl:text>
+<xsl:apply-templates/>
+<xsl:text>\end{quotation}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="table">
+<xsl:text>\begin{tabular}{ll}</xsl:text>
+<xsl:for-each select="tr">
+  <xsl:for-each select="td">
+    <xsl:text>\begin{minipage}{.5\linewidth}</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>\end{minipage}</xsl:text>
+    <xsl:if test="not(last())">
+      <xsl:text> &amp; </xsl:text>
+    </xsl:if>
+  </xsl:for-each>
+  <xsl:text>\\
+</xsl:text>
+</xsl:for-each>
+<xsl:text>\end{tabular}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="a">
+<xsl:apply-templates/>
+<xsl:if test="@href">
+<xsl:variable name="relpath" select="document(/*/@metafile)/metafile/relpath" />
+<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
+<xsl:variable name="fileref">
+  <xsl:choose>
+  <xsl:when test="contains(@href, '.html')">
+    <xsl:value-of select="substring-before(@href, '.html')"/>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:value-of select="concat(@href, 'index')"/>
+  </xsl:otherwise>
+  </xsl:choose>
+</xsl:variable>
+<xsl:choose>
+<xsl:when test="starts-with(@href, 'http:')">
+  <xsl:if test="not(.=@href)">
+    <xsl:text>\footnote{</xsl:text>
+      <xsl:call-template name="ltescape">
+        <xsl:with-param name="string">
+          <xsl:value-of select="string(@href)"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    <xsl:text>}</xsl:text>
+  </xsl:if>
+</xsl:when>
+<xsl:when test="starts-with(@href, '#')">
+<!-- Don't do inter-section references -->
+</xsl:when>
+<xsl:otherwise>
+  <xsl:text> (p.\ \pageref{</xsl:text>
+    <xsl:call-template name="replace-string">
+      <xsl:with-param name="replace" select="'#'"/>
+      <xsl:with-param name="with" select="':'"/>
+      <xsl:with-param name="text">
+      <xsl:choose>
+      <xsl:when test="$relpath='.'">
+        <xsl:value-of select="concat('/',$fileref)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+        <xsl:when test="starts-with($fileref,'..')">
+          <xsl:value-of select="substring-after($fileref,'..')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="concat($path,$fileref)"/>
+        </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+      </xsl:choose>
+      </xsl:with-param>
+     </xsl:call-template>
+  <xsl:text>}) </xsl:text>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:if>
+</xsl:template>
+
+<xsl:template match="img">
+<xsl:text>[Image not coverted]</xsl:text>
+<!--
+<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
+<xsl:text>\includegraphics{</xsl:text>
+<xsl:value-of select="concat('.',$path,@src)"/>
+<xsl:text>}</xsl:text>
+-->
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/docs/manual/style/latex/latex.xsl b/docs/manual/style/latex/latex.xsl
new file mode 100644 (file)
index 0000000..bfbe7ce
--- /dev/null
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output 
+  method="text"
+  encoding="ISO-8859-1"
+  indent="no"
+/>
+
+<!-- Read the localized messages from the specified language file -->
+<xsl:variable name="messages" select="document('../lang/en.xml')/messages"/>
+
+<!-- Get the guts of the stylesheets -->
+<xsl:include href="manualpage.xsl" />
+<xsl:include href="common.xsl" />
+<xsl:include href="html.xsl" />
+<xsl:include href="synopsis.xsl" />
+
+<xsl:template match="sitemap">
+<xsl:text>
+\documentclass[11pt]{book}
+\usepackage{fullpage,hyperref}
+\usepackage{style/latex/atbeginend}
+
+% Let LaTeX be lenient about very-bad line wrapping.
+\tolerance=9999 
+\emergencystretch=40pt
+
+% Keep paragraphs flush left (rather than the default of indenting
+% the first line) and put a space between paragraphs.
+\setlength{\parindent}{0ex}
+\addtolength{\parskip}{1.5ex}
+
+% Shrink the inter-item spaces
+\AfterBegin{itemize}{\addtolength{\itemsep}{-.8\baselineskip}}
+
+\pagestyle{headings}
+
+\title{</xsl:text>
+<xsl:value-of select="$messages/message[@name='apache']" />
+<xsl:text> </xsl:text>
+<xsl:value-of select="$messages/message[@name='http-server']" />
+<xsl:text> </xsl:text>
+<xsl:value-of select="$messages/message[@name='documentation']" />
+<xsl:text> </xsl:text>
+<xsl:value-of select="$messages/message[@name='version']" />
+<xsl:text>}
+\author{Apache Software Foundation}
+\date{\today}
+
+\begin{document}
+\maketitle
+\tableofcontents
+</xsl:text>
+
+<xsl:for-each select="category">
+  <xsl:text>\chapter{</xsl:text>
+  <xsl:apply-templates select="title" mode="printcat"/>
+  <xsl:text>}
+</xsl:text>
+    <xsl:apply-templates/>
+</xsl:for-each>
+
+<xsl:text>\end{document}</xsl:text>
+</xsl:template>
+
+<xsl:template match="page">
+<xsl:text>\include{</xsl:text>
+<xsl:choose>
+<xsl:when test="contains(@href,'.')">
+  <xsl:value-of select="substring-before(@href,'.')"/>
+</xsl:when>
+<xsl:otherwise>
+  <xsl:value-of select="concat(@href,'index')"/>
+</xsl:otherwise>
+</xsl:choose>
+<xsl:text>}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="category/title" mode="printcat">
+<xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="category/title"></xsl:template>
+
+<xsl:template match="modulefilelist">
+<xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="modulefile">
+<xsl:text>\include{mod/</xsl:text>
+<xsl:value-of select="substring-before(.,'.')"/>
+<xsl:text>}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="summary">
+<xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template name="replace-string">
+  <xsl:param name="text"/>
+  <xsl:param name="replace"/>
+  <xsl:param name="with"/>
+    
+  <xsl:choose>
+    <xsl:when test="not(contains($text,$replace))">
+      <xsl:value-of select="$text"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="substring-before($text,$replace)"/>
+      <xsl:value-of select="$with"/>
+      <xsl:call-template name="replace-string">
+        <xsl:with-param name="text" select="substring-after($text,$replace)"/>
+        <xsl:with-param name="replace" select="$replace"/>
+        <xsl:with-param name="with" select="$with"/>
+       </xsl:call-template>
+     </xsl:otherwise>
+   </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+<!-- Take care of all the LaTeX special characters.                       -->
+<!-- Silly multi-variable technique used to avoid deep recursion.         -->
+<!-- ==================================================================== -->
+<xsl:template match="text()">
+<xsl:call-template name="ltescape">
+  <xsl:with-param name="string" select="."/>
+</xsl:call-template>
+</xsl:template>
+
+
+<xsl:template name="ltescape">
+<xsl:param name="string"/>
+
+<xsl:variable name="result1">
+ <xsl:choose>
+ <xsl:when test="contains($string, '\')">
+   <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="'\'"/>
+    <xsl:with-param name="with" select="'\textbackslash '"/>
+    <xsl:with-param name="text" select="normalize-space($string)"/>
+   </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+   <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="result2">
+ <xsl:choose>
+ <xsl:when test="contains($result1, '$')">
+   <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="'$'"/>
+    <xsl:with-param name="with" select="'\$'"/>
+    <xsl:with-param name="text" select="$result1"/>
+   </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+   <xsl:value-of select="$result1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="result3">
+ <xsl:choose>
+ <xsl:when test="contains($result2, '{')">
+   <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="'{'"/>
+    <xsl:with-param name="with" select="'\{'"/>
+    <xsl:with-param name="text" select="$result2"/>
+   </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+   <xsl:value-of select="$result2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="result4">
+ <xsl:choose>
+ <xsl:when test="contains($result3, '}')">
+   <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="'}'"/>
+    <xsl:with-param name="with" select="'\}'"/>
+    <xsl:with-param name="text" select="$result3"/>
+   </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+   <xsl:value-of select="$result3"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="result5">
+ <xsl:choose>
+ <xsl:when test="contains($result4, '[')">
+   <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="'['"/>
+    <xsl:with-param name="with" select="'{[}'"/>
+    <xsl:with-param name="text" select="$result4"/>
+   </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+   <xsl:value-of select="$result4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="result6">
+ <xsl:choose>
+ <xsl:when test="contains($result5, ']')">
+   <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="']'"/>
+    <xsl:with-param name="with" select="'{]}'"/>
+    <xsl:with-param name="text" select="$result5"/>
+   </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+   <xsl:value-of select="$result5"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+    <xsl:call-template name="replace-string">
+    <xsl:with-param name="replace" select="'_'"/>
+    <xsl:with-param name="with" select="'\_'"/>
+    <xsl:with-param name="text">
+      <xsl:call-template name="replace-string">
+      <xsl:with-param name="replace" select="'#'"/>
+      <xsl:with-param name="with" select="'\#'"/>
+      <xsl:with-param name="text">
+        <xsl:call-template name="replace-string">
+        <xsl:with-param name="replace" select="'%'"/>
+        <xsl:with-param name="with" select="'\%'"/>
+        <xsl:with-param name="text">
+          <xsl:call-template name="replace-string">
+          <xsl:with-param name="replace" select="'&gt;'"/>
+          <xsl:with-param name="with" select="'\textgreater{}'"/>
+          <xsl:with-param name="text">
+            <xsl:call-template name="replace-string">
+            <xsl:with-param name="replace" select="'&lt;'"/>
+            <xsl:with-param name="with" select="'\textless{}'"/>
+            <xsl:with-param name="text">
+              <xsl:call-template name="replace-string">
+              <xsl:with-param name="replace" select="'~'"/>
+              <xsl:with-param name="with" select="'\textasciitilde{}'"/>
+              <xsl:with-param name="text">
+                <xsl:call-template name="replace-string">
+                <xsl:with-param name="replace" select="'^'"/>
+                <xsl:with-param name="with" select="'\^{}'"/>
+                <xsl:with-param name="text">
+                    <xsl:call-template name="replace-string">
+                    <xsl:with-param name="replace" select="'&amp;'"/>
+                    <xsl:with-param name="with" select="'\&amp;'"/>
+                    <xsl:with-param name="text" select="$result6"/>
+                    </xsl:call-template>
+                </xsl:with-param>
+                </xsl:call-template>
+              </xsl:with-param>
+              </xsl:call-template>
+            </xsl:with-param>
+            </xsl:call-template>
+          </xsl:with-param>
+          </xsl:call-template>
+        </xsl:with-param>
+        </xsl:call-template>
+      </xsl:with-param>
+      </xsl:call-template>
+    </xsl:with-param>
+    </xsl:call-template>
+
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/docs/manual/style/latex/manualpage.xsl b/docs/manual/style/latex/manualpage.xsl
new file mode 100644 (file)
index 0000000..a5a0237
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                  xmlns="http://www.w3.org/1999/xhtml">
+
+<xsl:template match="manualpage">
+<xsl:variable name="metafile" select="document(/*/@metafile)/metafile" />
+
+<xsl:text>\section{</xsl:text><xsl:apply-templates select="title"/>
+<xsl:text>}</xsl:text>
+<xsl:text>\label{</xsl:text><xsl:value-of 
+select="$metafile/path"/><xsl:value-of 
+select="$metafile/basename"/>
+<xsl:text>}
+</xsl:text>
+<xsl:apply-templates select="summary"/>
+
+
+   <xsl:if test="seealso">
+   <xsl:text>\bigskip\noindent\textbf{</xsl:text>
+   <xsl:value-of select="$messages/message[@name='seealso']" />
+   <xsl:text>}
+   \begin{itemize}</xsl:text>
+   <xsl:for-each select="seealso">
+     <xsl:text>\item </xsl:text><xsl:apply-templates />
+   </xsl:for-each>
+   \end{itemize}
+   </xsl:if>
+
+<xsl:apply-templates select="section"/>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/docs/manual/style/latex/synopsis.xsl b/docs/manual/style/latex/synopsis.xsl
new file mode 100644 (file)
index 0000000..29d31ac
--- /dev/null
@@ -0,0 +1,343 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                  xmlns="http://www.w3.org/1999/xhtml">
+
+
+<!-- ==================================================================== -->
+<!-- <modulesynopsis>                                                     -->
+<!-- ==================================================================== -->
+
+<xsl:template match="modulesynopsis">
+
+<xsl:text>\section{</xsl:text>
+<xsl:choose>
+  <xsl:when test="../status='Core'">
+    <xsl:value-of select="$messages/message [@name='apachecore']" />
+  </xsl:when>
+  <xsl:when test=".='mpm_common'">
+    <xsl:value-of select="$messages/message [@name='apachempmcommon']" />
+  </xsl:when>
+  <xsl:when test="../status='MPM'">
+    <xsl:value-of select="$messages/message [@name='apachempm']" />
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates select="name"/>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:value-of select="$messages/message [@name='apachemodule']" />
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates select="name"/>
+  </xsl:otherwise>
+</xsl:choose>
+<xsl:text>}\label{</xsl:text>
+<xsl:value-of select="concat('/mod/',name)"/>
+<xsl:text>}
+</xsl:text>
+
+<xsl:text>
+\begin{tabular}{lp{.75\linewidth}}
+\hline
+</xsl:text>
+<xsl:value-of select="$messages/message [@name='description']" />
+<xsl:text>: &amp;</xsl:text> 
+<xsl:apply-templates select="description" />
+<xsl:text>\\
+</xsl:text>
+
+<xsl:value-of select="$messages/message [@name='status']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:value-of select="status" />
+<xsl:text>\\
+</xsl:text>
+
+<xsl:if test="identifier">
+<xsl:value-of select="$messages/message [@name='moduleidentifier']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:apply-templates select="identifier" />
+<xsl:text>\\
+</xsl:text>
+</xsl:if>
+
+<xsl:if test="sourcefile">
+<xsl:value-of select="$messages/message [@name='sourcefile']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:apply-templates select="sourcefile" />
+<xsl:text>\\
+</xsl:text>
+</xsl:if>
+
+<xsl:if test="compatibility">
+<xsl:value-of select="$messages/message [@name='compatibility']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:apply-templates select="compatibility" />
+<xsl:text> \\
+</xsl:text>
+</xsl:if>
+<xsl:text>\hline \end{tabular}
+</xsl:text>
+    <!-- Summary of module features/usage (1 to 3 paragraphs, -->
+    <!-- optional)                                            -->
+    <xsl:if test="summary">
+      <xsl:text>\subsection*{</xsl:text>
+      <xsl:value-of select="$messages/message [@name='summary']" />
+      <xsl:text>}
+</xsl:text>
+      <xsl:apply-templates select="summary" />
+     </xsl:if>
+
+     <xsl:text>
+\medskip\textbf{</xsl:text>
+     <xsl:value-of select="$messages/message [@name='directives']" />
+     <xsl:text>}
+</xsl:text>
+
+     <xsl:choose>
+     <xsl:when test="directivesynopsis">
+       <xsl:text>\begin{itemize}</xsl:text>
+       <xsl:for-each select="directivesynopsis">
+         <xsl:sort select="name" />
+         <xsl:text>\item </xsl:text>
+         <xsl:if test="@type='section'">
+           <xsl:text>\textless{}</xsl:text>
+         </xsl:if>
+         <xsl:apply-templates select="name" mode="simple"/>
+         <xsl:if test="@type='section'">
+           <xsl:text>\textgreater{}</xsl:text>
+         </xsl:if>
+         <xsl:if test="@location">
+           <xsl:variable name="lowerlocation"
+            select="translate(@location, $uppercase, $lowercase)" />
+           <xsl:text> (p.\ \pageref{</xsl:text>
+           <xsl:value-of select="concat(translate(@location,$uppercase,$lowercase),':',translate(name,$uppercase,$lowercase))"/>
+           <xsl:text>}) </xsl:text>
+         </xsl:if>
+         <xsl:text>
+</xsl:text>
+       </xsl:for-each>
+       <xsl:text>\end{itemize}
+</xsl:text>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:value-of select="$messages/message [@name='nodirectives']" />
+     <xsl:text>
+</xsl:text>
+     </xsl:otherwise>
+     </xsl:choose>
+
+     <xsl:text>
+</xsl:text>
+
+     <xsl:if test="seealso">
+       <xsl:text>\textbf{</xsl:text>
+        <xsl:value-of select="$messages/message [@name='seealso']" />
+        <xsl:text>}\begin{itemize}</xsl:text>
+        <xsl:for-each select="seealso">
+        <xsl:text>\item </xsl:text>
+          <xsl:apply-templates />
+        <xsl:text>
+</xsl:text>
+        </xsl:for-each>
+<xsl:text>\end{itemize}</xsl:text>
+     </xsl:if>
+
+     <!-- Sections of documentation about the module as a whole -->
+       <xsl:apply-templates select="section" />
+
+     <!-- Directive documentation -->
+       <xsl:apply-templates select="directivesynopsis">
+         <xsl:sort select="name" />
+       </xsl:apply-templates>
+
+</xsl:template>
+<!-- /modulesynopsis -->
+
+
+<!-- ==================================================================== -->
+<!-- Directivesynopsis                                                    -->
+<!-- ==================================================================== -->
+<xsl:template match="directivesynopsis/name" mode="simple" name="simpledirname">
+<xsl:if test="@type='section'"><xsl:text>\textless{}</xsl:text></xsl:if>
+<xsl:apply-templates/>
+<xsl:if test="@type='section'"><xsl:text>\textgreater{}</xsl:text></xsl:if>
+</xsl:template>
+
+<xsl:template match="directivesynopsis/name">
+<xsl:text>\subsection*{</xsl:text>
+<xsl:call-template name="simpledirname"/>
+  <xsl:value-of select="$messages/message
+    [@name='directive']/@replace-space-with"/>
+<xsl:value-of select="$messages/message[@name='directive']" />
+<xsl:text>}\label{</xsl:text>
+<xsl:value-of select="concat('/mod/', //modulesynopsis/name, ':', translate(., $uppercase, $lowercase))"/>
+<xsl:text>}
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="directivesynopsis">
+<xsl:if test="not(@location)">
+  <xsl:apply-templates select="name"/>
+  <!-- Directive header -->
+  <xsl:text>
+\begin{tabular}{lp{.8\linewidth}}
+\hline
+</xsl:text>
+<xsl:value-of select="$messages/message [@name='description']" />
+<xsl:text>: &amp; \begin{minipage}{.8\linewidth}</xsl:text>
+<xsl:apply-templates select="description" />
+<xsl:text>\end{minipage} \\
+</xsl:text>
+
+<xsl:value-of select="$messages/message[@name='syntax']" />
+<xsl:text>: &amp; \begin{minipage}{.8\linewidth}{\ttfamily </xsl:text>
+<xsl:apply-templates select="syntax" />
+<xsl:text>}\end{minipage} \\
+</xsl:text>
+
+<xsl:if test="default">
+<xsl:value-of select="$messages/message[@name='default']" />
+<xsl:text>: &amp; \begin{minipage}{.8\linewidth}{\ttfamily </xsl:text>
+<xsl:apply-templates select="default" />
+<xsl:text>}\end{minipage} \\
+</xsl:text>
+</xsl:if>
+
+<xsl:value-of select="$messages/message[@name='context']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:apply-templates select="contextlist" />
+<xsl:text> \\
+</xsl:text>
+
+<xsl:if test="override">
+<xsl:value-of select="$messages/message[@name='override']"/>
+<xsl:text>: &amp;</xsl:text>
+<xsl:apply-templates select="override" />
+<xsl:text> \\
+</xsl:text>
+</xsl:if>
+
+<xsl:value-of select="$messages/message[@name='status']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:value-of select="../status" />
+<xsl:text> \\
+</xsl:text>
+
+<xsl:value-of select="$messages/message[@name='module']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:choose>
+<xsl:when test="modulelist">
+  <xsl:apply-templates select="modulelist" />
+</xsl:when>
+<xsl:otherwise>
+  <xsl:apply-templates select="../name" />
+</xsl:otherwise>
+</xsl:choose>
+<xsl:text> \\
+</xsl:text>
+
+<xsl:if test="compatibility">
+<xsl:value-of select="$messages/message[@name='compatibility']" />
+<xsl:text>: &amp;</xsl:text>
+<xsl:apply-templates select="compatibility" />
+<xsl:text> \\
+</xsl:text>
+</xsl:if>
+
+<xsl:text>\hline
+\end{tabular}
+
+</xsl:text>
+
+<xsl:apply-templates select="usage" />
+
+<xsl:if test="seealso">
+<xsl:text>\textbf{</xsl:text>
+<xsl:value-of select="$messages/message[@name='seealso']" />
+<xsl:text>}
+
+\begin{itemize}
+</xsl:text>
+<xsl:for-each select="seealso">
+<xsl:text>\item </xsl:text>
+<xsl:apply-templates />
+</xsl:for-each>
+<xsl:text>\end{itemize}
+</xsl:text>
+</xsl:if>
+
+</xsl:if>
+
+</xsl:template>
+<!-- /directivesynopsis -->
+
+
+<!-- ==================================================================== -->
+<!-- <contextlist>                                                        -->
+<!-- ==================================================================== -->
+<xsl:template match="contextlist">
+<xsl:apply-templates select="context" />
+</xsl:template>
+<!-- /contextlist -->
+
+
+<!-- ==================================================================== -->
+<!-- <context>                                                            -->
+<!-- Each entry is separeted with a comma                                 -->
+<!-- ==================================================================== -->
+<xsl:template match="context">
+<xsl:choose>
+<xsl:when test="normalize-space(.) = 'server config'">
+    <xsl:value-of select="$messages/message[@name='serverconfig']" />
+</xsl:when>
+<xsl:when test="normalize-space(.) = 'virtual host'">
+    <xsl:value-of select="$messages/message[@name='virtualhost']" />
+</xsl:when>
+<xsl:when test="normalize-space(.) = 'directory'">
+    <xsl:value-of select="$messages/message[@name='directory']" />
+</xsl:when>
+<xsl:when test="normalize-space(.) = '.htaccess'">
+    <xsl:value-of select="$messages/message[@name='htaccess']" />
+</xsl:when>
+<xsl:otherwise> <!-- error -->
+    <xsl:message terminate="yes">
+        unknown context: <xsl:value-of select="." />
+    </xsl:message>
+</xsl:otherwise>
+</xsl:choose>
+
+<xsl:if test="position() != last()">
+    <xsl:text>, </xsl:text>
+</xsl:if>
+</xsl:template>
+<!-- /context -->
+
+
+<!-- ==================================================================== -->
+<!-- <modulelist>                                                         -->
+<!-- ==================================================================== -->
+<xsl:template match="modulelist">
+<xsl:for-each select="module">
+    <xsl:call-template name="module" />
+    <xsl:if test="position() != last()">
+        <xsl:text>, </xsl:text>
+    </xsl:if>
+</xsl:for-each>
+</xsl:template>
+<!-- /modulelist -->
+
+
+<!-- ==================================================================== -->
+<!-- modulesynopsis/compatibility                                         -->
+<!-- ==================================================================== -->
+<xsl:template match="modulesynopsis/compatibility">
+<xsl:apply-templates />
+</xsl:template>
+
+
+<!-- ==================================================================== -->
+<!-- directivesynopsis/compatibility                                      -->
+<!-- ==================================================================== -->
+<xsl:template match="directivesynopsis/compatibility">
+<xsl:apply-templates />
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file