diff options
author | Alexander Bokovoy <ab@samba.org> | 2007-11-27 15:47:55 +0000 |
---|---|---|
committer | Gerald W. Carter <jerry@samba.org> | 2008-04-23 08:47:40 -0500 |
commit | 0a6fea6796e0da0d5c8690c851f2723e4b385ba7 (patch) | |
tree | 18a0bf743f818490dbbce188b06796d4f1d3eec4 /docs/xslt/db2latex-xsl/xsl/qandaset.mod.xsl | |
parent | 754a2e1494f14fd5d0f157b0f0eada0d13fb80c0 (diff) | |
download | samba-0a6fea6796e0da0d5c8690c851f2723e4b385ba7.tar.gz samba-0a6fea6796e0da0d5c8690c851f2723e4b385ba7.tar.bz2 samba-0a6fea6796e0da0d5c8690c851f2723e4b385ba7.zip |
Embed db2latex as interim solution before migration to dblatex
(This used to be commit 166c61077bc5c6ca238865f71687369ad7c35a07)
Diffstat (limited to 'docs/xslt/db2latex-xsl/xsl/qandaset.mod.xsl')
-rw-r--r-- | docs/xslt/db2latex-xsl/xsl/qandaset.mod.xsl | 415 |
1 files changed, 415 insertions, 0 deletions
diff --git a/docs/xslt/db2latex-xsl/xsl/qandaset.mod.xsl b/docs/xslt/db2latex-xsl/xsl/qandaset.mod.xsl new file mode 100644 index 0000000000..3cf6fb9de4 --- /dev/null +++ b/docs/xslt/db2latex-xsl/xsl/qandaset.mod.xsl @@ -0,0 +1,415 @@ +<?xml version="1.0"?> +<!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]> +<!--############################################################################# +| $Id: qandaset.mod.xsl,v 1.13 2004/01/04 13:22:27 j-devenish Exp $ +|- ############################################################################# +| $Author: j-devenish $ +| PURPOSE: +| Portions (c) Norman Walsh, official DocBook XSL stylesheets. +| See docbook.sf.net ++ ############################################################################## --> + +<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"> + + <doc:reference id="qandaset" xmlns=""> + <referenceinfo> + <releaseinfo role="meta"> + $Id: qandaset.mod.xsl,v 1.13 2004/01/04 13:22:27 j-devenish Exp $ + </releaseinfo> + <authorgroup> + &ramon; + &james; + </authorgroup> + <copyright> + <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year> + <holder>Ramon Casellas</holder> + </copyright> + <revhistory> + <doc:revision rcasver="1.11">&rev_2003_05;</doc:revision> + </revhistory> + </referenceinfo> + <title>QandaSet <filename>qandaset.mod.xsl</filename></title> + <partintro> + <para> + + Portions (c) Norman Walsh, official DocBook XSL stylesheets. See docbook.sf.net + + </para> + </partintro> + </doc:reference> + + <doc:template xmlns=""> + <refpurpose>Process <doc:db>qandadiv</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> +<xsl:template match="qandaset"> + <!-- get all children that are not the following --> + <xsl:variable name="preamble" select="*[name(.) != 'title' + and name(.) != 'titleabbrev' + and name(.) != 'blockinfo' + and name(.) != 'qandadiv' + and name(.) != 'qandaentry']"/> + <xsl:variable name="label-width"/> + <xsl:variable name="table-summary"/> + <xsl:variable name="cellpadding"/> + <xsl:variable name="cellspacing"/> + <xsl:variable name="toc"/> + <xsl:variable name="toc.params"/> + <xsl:variable name="qalevel"> + <xsl:call-template name="qanda.section.level"/> + </xsl:variable> + <xsl:text>% ------------------------------------------------------------- </xsl:text> + <xsl:text>% QandASet </xsl:text> + <xsl:text>% ------------------------------------------------------------- </xsl:text> + <xsl:choose> + <xsl:when test="ancestor::sect2"> + <xsl:text>\subsubsection*{</xsl:text> + </xsl:when> + <xsl:when test="ancestor::sect1"> + <xsl:text>\subsection*{</xsl:text> + </xsl:when> + <xsl:when test="ancestor::article | ancestor::appendix"> + <xsl:text>\section*{</xsl:text> + </xsl:when> + <xsl:when test="ancestor::book"> + <xsl:text>\chapter*{</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="title"> + <xsl:apply-templates select="title"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>F.A.Q.</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>} </xsl:text> + <xsl:call-template name="label.id"/> + <xsl:text> </xsl:text> + + <!-- process toc --> + <xsl:if test="contains($toc.params, 'toc') and $toc != '0'"> + <xsl:call-template name="process.qanda.toc"/> + </xsl:if> + <!-- process preamble --> + <xsl:apply-templates select="$preamble"/> + <!-- process divs and entries --> + <xsl:apply-templates select="qandaentry|qandadiv"/> +</xsl:template> + + <doc:template basename="qandaentry" xmlns=""> + <refpurpose>Process <doc:db>qandadiv</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="qandaset/qandaentry"> + <xsl:text>\vspace{1em} </xsl:text> + <xsl:text>\noindent{}</xsl:text> + <xsl:value-of select="position()"/> + <xsl:text>.~</xsl:text> + <xsl:apply-templates select="question"/> + <xsl:text>\newline </xsl:text> + <xsl:apply-templates select="answer"/> + <xsl:text>\vspace{1em} </xsl:text> + </xsl:template> + + <doc:template xmlns=""> + <refpurpose>Process <doc:db>qandadiv</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> +<xsl:template match="qandadiv"> + <!-- get the preamble --> + <xsl:variable name="preamble" select="*[name(.) != 'title' + and name(.) != 'titleabbrev' + and name(.) != 'qandadiv' + and name(.) != 'qandaentry']"/> + <xsl:variable name="qalevel"> + <xsl:call-template name="qandadiv.section.level"/> + </xsl:variable> + <!-- process the title if it exists --> + <xsl:text>% ----------- </xsl:text> + <xsl:text>% QandADiv </xsl:text> + <xsl:text>% ----------- </xsl:text> + <xsl:text>\noindent\begin{minipage}{\linewidth} </xsl:text> + <xsl:text>\vspace{0.25em}\hrule\vspace{0.25em} </xsl:text> + <xsl:choose> + <xsl:when test="ancestor::sect2"> + <xsl:text>\paragraph*{</xsl:text> + </xsl:when> + <xsl:when test="ancestor::sect1"> + <xsl:text>\subsubsection*{</xsl:text> + </xsl:when> + <xsl:when test="ancestor::article | ancestor::appendix"> + <xsl:text>\subsection*{</xsl:text> + </xsl:when> + <xsl:when test="ancestor::book"> + <xsl:text>\section*{</xsl:text> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="title"> + <xsl:apply-templates select="title"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>F.A.Q. Part</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>}</xsl:text> + <xsl:call-template name="label.id"/> + <xsl:text> </xsl:text> + <xsl:text>\hrule\vspace{0.25em} </xsl:text> + <xsl:text>\end{minipage} </xsl:text> + +<!-- + <xsl:text>\begin{toc} </xsl:text> + <xsl:for-each select="qandaentry"> + <xsl:text>\tocref{</xsl:text> + <xsl:value-of select="@id"/> + <xsl:text>} </xsl:text> + </xsl:for-each> + <xsl:text>\end{toc} </xsl:text> +--> + +<!-- pseudo table of contents --> + <!-- + <xsl:choose> + <xsl:when test="title"> + <xsl:text>\caption{</xsl:text> + <xsl:apply-templates select="title"/> + <xsl:text>} </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>\caption{</xsl:text> + <xsl:text>F.A.Q. Part</xsl:text> + <xsl:text>} </xsl:text> + </xsl:otherwise> + </xsl:choose> + --> + <xsl:for-each select="qandaentry"> + <xsl:text>\noindent{}</xsl:text> + <xsl:value-of select="position()"/> + <xsl:text>.~</xsl:text> + <xsl:apply-templates select="question"/> + <xsl:if test="position()!=last()"><xsl:text>\newline </xsl:text></xsl:if> + </xsl:for-each> + <xsl:text>\vspace{0.25em}\hrule </xsl:text> + + <xsl:for-each select="qandaentry"> + <xsl:text>\vspace{1em} </xsl:text> + <xsl:text>\noindent{}</xsl:text> + <xsl:value-of select="position()"/> + <xsl:text>.~</xsl:text> + <xsl:apply-templates select="question"/> + <xsl:text>\newline </xsl:text> + <xsl:apply-templates select="answer"/> + </xsl:for-each> + <xsl:text>\vspace{1em} </xsl:text> +</xsl:template> + + <doc:template xmlns=""> + <refpurpose>Process <doc:db>question</doc:db> elements</refpurpose> + <doc:description> + <para> + Applies templates as a italicised block, preceded by a bold + letter <quote>Q</quote>. + </para> + </doc:description> + <doc:variables> + &no_var; + </doc:variables> + <doc:notes> + <para>defaultlabel attributes are not honoured.</para> + </doc:notes> + </doc:template> + <xsl:template match="question"> + <!-- get the default label + <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="latex.qanda.defaultlabel"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + --> + <!-- process the question itself + <xsl:apply-templates select="." mode="label.markup"/> + <xsl:choose> + <xsl:when test="$deflabel = 'none' and not(label)"> + <xsl:apply-templates select="*[name(.) != 'label']"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*[name(.) != 'label']"/> + </xsl:otherwise> + </xsl:choose> + --> + <xsl:text>\textbf{Q:}~\textit{</xsl:text> + <xsl:apply-templates/> + <xsl:text>} </xsl:text> + </xsl:template> + + <doc:template xmlns=""> + <refpurpose>Process <doc:db>answer</doc:db> elements</refpurpose> + <doc:description> + <para> + Applies templates as a block, preceded by a bold + letter <quote>A</quote>. + </para> + </doc:description> + <doc:variables> + &no_var; + </doc:variables> + </doc:template> + <xsl:template match="answer"> + <xsl:text>\noindent\textbf{A:}~</xsl:text> + <xsl:apply-templates/> + <xsl:text> </xsl:text> + </xsl:template> + + <doc:template xmlns=""> + <refpurpose>Process <doc:db>label</doc:db> elements</refpurpose> + <doc:description> + <para> + Applies templates. + </para> + </doc:description> + <doc:variables> + &no_var; + </doc:variables> + </doc:template> + <xsl:template match="label"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template name="process.qanda.toc"> + <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/> + <xsl:apply-templates select="qandaentry" mode="qandatoc.mode"/> + </xsl:template> + + <doc:template basename="qandadiv" xmlns=""> + <refpurpose>Process <doc:db>qandadiv</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="qandadiv" mode="qandatoc.mode"> + <xsl:apply-templates select="title" mode="qandatoc.mode"/> + <xsl:call-template name="process.qanda.toc"/> + </xsl:template> + + <doc:template basename="title" xmlns=""> + <refpurpose>Process a <doc:db>qandadiv</doc:db>'s <doc:db>title</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="qandadiv/title" mode="qandatoc.mode"> + <xsl:variable name="qalevel"> + <xsl:call-template name="qandadiv.section.level"/> + </xsl:variable> + <xsl:call-template name="label.id"> + <xsl:with-param name="object" select="parent::*"/> + </xsl:call-template> + <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/> + <xsl:value-of select="$autotoc.label.separator"/> + <xsl:apply-templates/> + </xsl:template> + + <doc:template xmlns="" basename="qandaentry"> + <refpurpose>Process <doc:db>qandaentry</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="qandaentry" mode="qandatoc.mode"> + <xsl:apply-templates mode="qandatoc.mode"/> + </xsl:template> + + <doc:template basename="question" xmlns=""> + <refpurpose>Process <doc:db>question</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="question" mode="qandatoc.mode"> + <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/> + <xsl:apply-templates select="." mode="label.markup"/> + <xsl:text> </xsl:text> + </xsl:template> + + <doc:template xmlns="" basename="answer"> + <refpurpose>Process <doc:db>answer</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="answer" mode="qandatoc.mode"/> + + <doc:template xmlns="" basename="revhistory"> + <refpurpose>Process <doc:db>revhistory</doc:db> elements</refpurpose> + <doc:description> + <para><doc:todo>Undocumented.</doc:todo></para> + </doc:description> + </doc:template> + <xsl:template match="revhistory" mode="qandatoc.mode"/> + +<xsl:template name="question.answer.label"> + <!-- variable: deflabel --> + <xsl:variable name="deflabel"> + <!-- chck whether someone has a defaultlabel attribute --> + <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="latex.qanda.defaultlabel"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="label" select="@label"/> + <xsl:choose> + <xsl:when test="$deflabel = 'qanda'"> + <xsl:call-template name="gentext"> + <xsl:with-param name="key"> + <xsl:choose> + <xsl:when test="local-name(.) = 'question'">question</xsl:when> + <xsl:when test="local-name(.) = 'answer'">answer</xsl:when> + <xsl:when test="local-name(.) = 'qandadiv'">qandadiv</xsl:when> + <xsl:otherwise>qandaset</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:when test="$deflabel = 'label'"> + <xsl:value-of select="$label"/> + </xsl:when> + <xsl:when test="$deflabel = 'number' and local-name(.) = 'question'"> + <xsl:apply-templates select="ancestor::qandaset[1]" mode="number"/> + <xsl:choose> + <xsl:when test="ancestor::qandadiv"> + <xsl:apply-templates select="ancestor::qandadiv[1]" mode="number"/> + <xsl:apply-templates select="ancestor::qandaentry" mode="number"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="ancestor::qandaentry" mode="number"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- nothing --> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> |