GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
1
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
XML
Browse code
- Added an XSLT "math" mode to some of the relevant templates.
- Added "approximately equal to" symbol.
master
OLD_GRAPHICS_HANDLING
1 parent
95a7e70
commit
79d8061bbfd793bf4d7f60668627c4b55a2216f1
cedwards
authored
on 7 Jan 2004
Patch
Showing
3 changed files
format-master.xml
xml2html.xsl
xml2latex.xsl
Ignore Space
Show notes
View
format-master.xml
<?xml version="1.0"?> <!-- This will mostly be a list of element names to match, along with the corresponding HTML and LaTeX handling XSLT code. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <hyperlink> <element>OraAdmin</element> <url>http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96521/toc.htm</url> <label>test<!--<xsl:call-template name="OracleServer"/> Database Administrator<xsl:call-template name="apostrophe"/>s Guide--></label> </hyperlink> <template name="PaperCode" match="PaperCode"> <latex><xsl:value-of select="$department"/>~<xsl:value-of select="$paper"/></latex> <html> <xsl:value-of select="$department"/> <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> <xsl:value-of select="$paper"/> </html> </template> <template name="OracleServer" match="OracleServer"> <latex>Oracle9\textit{i}</latex> <html>Oracle9<I>i</I></html> </template> <!-- Plain paragraph. @indent: Whether or not to indent this paragraph (probably only relevant in LaTeX). 'no' => don't indent. otherwise => apply standard paragraph formatting. [default] --> <template name="paragraph" match="paragraph"> <latex><xsl:text> </xsl:text><xsl:if test="@indent = 'no'">\noindent </xsl:if><xsl:apply-templates/><xsl:text> </xsl:text></latex> <!-- HTML is weird about what things you cannot include inside paragraphs (e.g. lists of any kind). However, the end P tag is optional, so one option might simply be not to output it. --> <html><P><xsl:apply-templates/></P></html> </template> <alias source="para" target="paragraph"/> <alias source="p" target="paragraph"/> <!-- Special characters (should maybe all be named, in case they need to be called explicitly with xsl:call-template) --> <!-- I'd like to use the Unicode names for these; will look them up some time! --> <template name="newline" match="newline"> <latex> \\</latex> <html><BR/></html> </template> <template name="page-break" match="page-break"> <latex>\newpage</latex> </template> <alias source="new-page" target="page-break"/> <template name="non-breaking-space" match="non-breaking-space"> <latex>~</latex> <html><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></html> </template> <alias source="nbsp" target="non-breaking-space"/> <!-- Technically we don't need to disable output escaping for all of these, but it's probably better to code them all consistently, rather than trying to figure out which ones do need it (e.g.,   for a non-breaking space) and which ones don't (e.g., &). --> <template name="ellipsis-sign" match="ellipsis-sign"> <latex>{\ldots}</latex> <html><xsl:text disable-output-escaping="yes">&#8230;</xsl:text></html> </template> <alias source="etc" target="ellipsis-sign"/> <alias source="ellipsis" target="ellipsis-sign"/> <alias source="dots" target="ellipsis-sign"/> <!-- Misc typographic symbols --> <template name="endash" match="endash"> <latex>--</latex> <html><xsl:text disable-output-escaping="yes">&#8211;</xsl:text></html> </template> <alias source="en-dash" target="endash"/> <template name="emdash" match="emdash"> <latex>---</latex> <html><xsl:text disable-output-escaping="yes">&#8212;</xsl:text></html> </template> <alias source="em-dash" target="emdash"/> <template name="apostrophe" match="apostrophe"> <latex>'</latex> <html><xsl:text disable-output-escaping="yes">&#8217;</xsl:text></html> </template> <template name="dollar" match="dollar"> <latex>\$</latex> <html>$</html> </template> <template name="percent-sign" match="percent-sign"> <latex>\%</latex> <html>%</html> </template> <template name="ampersand" match="ampersand"> <latex>\&</latex> <html><xsl:text disable-output-escaping="yes">&amp;</xsl:text></html> </template> <template name="trademark-sign" match="trademark-sign"> <latex>\texttrademark</latex> <html><xsl:text disable-output-escaping="yes">&#8482;</xsl:text></html> </template> <alias source="trademark" target="trademark-sign"/> <alias source="TM" target="trademark-sign"/> <template name="copyright-sign" match="copyright-sign"> <latex>\copyright</latex> <html><xsl:text disable-output-escaping="yes">&#169;</xsl:text></html> </template> <template name="degree-sign" match="degree-sign"> <latex>$^{\circ}$</latex> <html><xsl:text disable-output-escaping="yes">&#176;</xsl:text></html> </template> <alias source="degrees" target="degree-sign"/> <template name="section-sign" match="section-sign"> <latex>{\S}</latex> <html><xsl:text disable-output-escaping="yes">&#167;</xsl:text></html> </template> <template name="paragraph-sign" match="paragraph-sign"> <latex>{\P}</latex> <html><xsl:text disable-output-escaping="yes">&#182;</xsl:text></html> </template> <!-- I think the pi symbol is only available in LaTeX in math mode, but if we're already in math mode, the extra $ signs will mess things up... --> <!-- Can we use XSLT modes to deal with this? --> <!-- Looks like a "yes": --> <template name="pi-math" match="pi" mode="math"> <latex>\pi</latex> <html><xsl:text disable-output-escaping="yes">&#960;</xsl:text></html> </template> <!-- Not in math mode: --> <template name="pi-normal" match="pi"> <latex>$\pi$</latex> <html><xsl:text disable-output-escaping="yes">&#960;</xsl:text></html> </template> <template name="LaTeX" match="LaTeX"> <latex>{\LaTeX}</latex> <html>L<SUP>A</SUP>T<SUB>E</SUB>X</html> </template> <alias source="latex" target="LaTeX"/> <!-- Note: no equivalent of \triangleright in HTML, use right arrow instead. --> <template name="menu-separator" match="menu-separator"> <latex>$\triangleright$</latex> <html><xsl:text disable-output-escaping="yes">&#8594;</xsl:text></html> </template> <alias source="menusep" target="menu-separator"/> <template name="menu-item" match="menu/item"> <latex>\menuitem{<xsl:apply-templates/>}</latex> <html><B><xsl:apply-templates/></B></html> </template> <!-- Special styles --> <template name="emph" match="emph"> <latex>\emph{<xsl:apply-templates/>}</latex> <html><EM><xsl:apply-templates/></EM></html> </template> <template name="italic" match="italic"> <latex>\textit{<xsl:apply-templates/>}</latex> <html><I><xsl:apply-templates/></I></html> </template> <template name="strong" match="strong"> <latex>\textbf{<xsl:apply-templates/>}</latex> <html><STRONG><xsl:apply-templates/></STRONG></html> </template> <template name="bold" match="bold"> <latex>\textbf{<xsl:apply-templates/>}</latex> <html><B><xsl:apply-templates/></B></html> </template> <template name="term" match="term"> <latex>\term{<xsl:apply-templates/>}</latex> <html><I CLASS="term"><xsl:apply-templates/></I></html> </template> <template name="foreign" match="foreign"> <latex>\foreign{<xsl:apply-templates/>}</latex> <html><I CLASS="foreign"><xsl:apply-templates/></I></html> </template> <template name="code" match="code"> <!-- <latex>\code{<xsl:apply-templates/>}</latex> --> <latex>\verb+<xsl:apply-templates/>+</latex> <html><CODE><xsl:apply-templates/></CODE></html> </template> <!-- We can decide later whether to use plain verbatim or listings. --> <template name="code-block" match="code-block"> <latex> \begin{verbatim} <xsl:apply-templates/> \end{verbatim} </latex> <html> <PRE CLASS="code"><xsl:apply-templates/></PRE> </html> </template> <!-- This is for stuff that should unequivocally be treated verbatim (e.g. problem code). --> <template name="verbatim" match="verbatim"> <latex> \begin{verbatim} <xsl:apply-templates/> \end{verbatim} </latex> <html> <PRE><xsl:apply-templates/></PRE> </html> </template> <!-- Quoted text. Handles nested quotes correctly. @single: Whether to enclose the text in single or double quotes. 'yes' => single quotes (''). otherwise => double quotes (""). [default] --> <template name="single-quote" match="quote[@single='yes']"> <latex>`<xsl:apply-templates/>'</latex> <html> <xsl:text disable-output-escaping="yes">&#8216;</xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes">&#8217;</xsl:text> </html> </template> <template name="double-quote" match="quote"> <latex>``<xsl:apply-templates/>''</latex> <html> <xsl:text disable-output-escaping="yes">&#8220;</xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes">&#8221;</xsl:text> </html> </template> <!-- With nested quotes, we need to figure out what depth of nesting we're at, then call the appropriate template depending on the initial quoting style (single or double). --> <template name="nested-double-quote" match="quote//quote"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote"/> </xsl:otherwise> </xsl:choose> </common> </template> <template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote"/> </xsl:otherwise> </xsl:choose> </common> </template> <alias source="q" target="single-quote"/> <alias source="qq" target="double-quote"/> <!-- Environments (in the LaTeX terminology): enumerated, ordered, and numbered lists. --> <!-- Unordered lists --> <template name="itemised-list" match="itemised-list"> <latex> \begin{itemize} <xsl:apply-templates/> \end{itemize} </latex> <html> <UL> <xsl:apply-templates/> </UL> </html> </template> <alias source="itemize" target="itemised-list"/> <alias source="unordered-list" target="itemised-list"/> <alias source="bulleted-list" target="itemised-list"/> <alias source="bullet-list" target="itemised-list"/> <alias source="bullet-points" target="itemised-list"/> <!-- Ordered lists --> <template name="enumerated-list" match="enumerated-list"> <latex> \begin{enumerate} <xsl:apply-templates/> \end{enumerate} </latex> <html> <OL> <xsl:apply-templates/> </OL> </html> </template> <alias source="enumerate" target="enumerated-list"/> <alias source="ordered-list" target="enumerated-list"/> <alias source="numbered-list" target="enumerated-list"/> <alias source="question-list" target="enumerated-list"/> <!-- Definition or description lists. --> <template name="definition-list" match="definition-list"> <latex> \begin{description} <xsl:apply-templates/> \end{description} </latex> <html> <!-- Hmm, <DL>s in HTML tend to come out with the spacing a bit wrong (or maybe it's just my browser?). Might using a table be better? Messy if the keyword is long, though, and you don't get a proper hanging indent... Maybe this is something that could be handled in CSS instead. --> <DL> <xsl:apply-templates/> </DL> <!-- <TABLE BORDER="0" CELLPADDING="10"> --> <!-- <xsl:apply-templates/> --> <!-- </TABLE> --> </html> </template> <alias source="description-list" target="definition-list"/> <!-- List elements --> <template name="item" match="item"> <latex>\item <xsl:apply-templates/></latex> <html> <xsl:choose> <xsl:when test="count(paragraph|para|p) != 0"> <LI><xsl:apply-templates/></LI> </xsl:when> <xsl:otherwise> <LI><P><xsl:apply-templates/></P></LI> </xsl:otherwise> </xsl:choose> </html> </template> <template name="definition-item" match="definition-list/item"> <latex>\item[<xsl:apply-templates select="keyword"/>] <xsl:apply-templates select="definition"/></latex> <html> <DT><P><xsl:apply-templates select="keyword"/></P></DT> <DD><xsl:apply-templates select="definition|description|discourse"/></DD> <!-- <TR VALIGN="TOP"> --> <!-- <TD><P><xsl:apply-templates select="keyword"/></P></TD> --> <!-- <TD><xsl:apply-templates select="definition|description|discourse"/></TD> --> <!-- </TR> --> </html> </template> <template name="keyword" match="keyword"> <latex><xsl:apply-templates/></latex> <html><STRONG><xsl:apply-templates/></STRONG></html> </template> <alias source="topic" target="keyword"/> <!-- Need to provide some context here as, e.g., <description> is also used within <image>. --> <template name="definition" match="item/definition|item/description|item/discourse"> <html> <xsl:choose> <xsl:when test="count(paragraph|para|p) != 0"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> <P><xsl:apply-templates/></P> </xsl:otherwise> </xsl:choose> </html> </template> <!-- Sections, subsections, subsubsections, ... @label: A label that can be used for cross referencing. Any value can be used, as long as it's a legal identifier in both LaTeX and HTML. --> <template name="section" match="section"> <latex> <xsl:apply-templates> <xsl:with-param name="label"> <xsl:value-of select="@label"/> <xsl:if test="not(@label)">THERE_IS_NO_LABEL</xsl:if> </xsl:with-param> </xsl:apply-templates> </latex> <html> <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> <xsl:apply-templates/> <!-- Since HTML doesn't really support footnotes as such, include them as "section notes" instead. --> <xsl:if test="count(.//footnote) > 0"> <P><STRONG>Notes:</STRONG></P> <xsl:apply-templates select=".//footnote" mode="list"/> </xsl:if> </html> </template> <!-- Footnotes. --> <template name="footnote" match="footnote"> <latex>\footnote{<xsl:apply-templates/>}</latex> <html> <A> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> </html> </template> <!-- This is only required for HTML, as LaTeX does it all for you. --> <template name="footnote-list" match="footnote" mode="list"> <html> <P> <A> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> <xsl:text> </xsl:text> <xsl:apply-templates/> <xsl:text> </xsl:text> <!-- Provide a back link to the original footnote marker. --> <A> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:text>[Back]</xsl:text> </A> </P> </html> </template> <!-- Document preamble stuff: title, author, date. --> <template name="preamble-title" match="document/title" mode="preamble"> <latex>\title{<xsl:apply-templates/>}</latex> <html> <xsl:apply-templates/> </html> </template> <template name="preamble-author" match="document/author" mode="preamble"> <latex>\author{<xsl:apply-templates/>}</latex> </template> <template name="preamble-date" match="document/date" mode="preamble"> <latex>\date{<xsl:apply-templates/>}</latex> </template> <template name="document-title" match="document/title"> <!-- Need to do something sensible for LaTeX here. --> <latex><xsl:if test="$standalone = 'no'"></xsl:if></latex> <html> <H1><xsl:apply-templates/></H1> </html> </template> <template name="document-author" match="document/author"/> <template name="document-date" match="document/date"/> <!-- Generate some number of "sub"s so we can produce, e.g., "subsubsection" for LaTeX. $depth: the number of repetitions (0 <= $depth <= 2, but there's no need to do bounds checking at the upper end, because that's already dealt with in the "section-title" template below). --> <template name="generate-subs"> <latex> <xsl:param name="depth">1</xsl:param> <xsl:if test="$depth > 1"> <xsl:text>sub</xsl:text> <xsl:call-template name="generate-subs"> <xsl:with-param name="depth"><xsl:value-of select="$depth - 1"/></xsl:with-param> </xsl:call-template> </xsl:if> </latex> </template> <!-- Generate section title with nested numbering, e.g., 1.1.3. --> <template name="section-title" match="section/title"> <latex> <xsl:param name="label"/> <xsl:text>\</xsl:text> <!-- Generate the correct number of "sub"s for LaTeX. --> <xsl:call-template name="generate-subs"> <xsl:with-param name="depth"> <xsl:number value="count(ancestor::section)"/> <xsl:if test="count(ancestor::section) > 3">3</xsl:if> </xsl:with-param> </xsl:call-template> <xsl:text>section{</xsl:text> <xsl:apply-templates/><xsl:text>}</xsl:text> <xsl:if test="$label != 'THERE_IS_NO_LABEL'"> \label{<xsl:value-of select="$label"/>} </xsl:if> </latex> <html> <!-- The depth is used in a couple of places, so we pre-calculate it. --> <xsl:variable name="depth"> <xsl:number value="1 + count(ancestor::section)"/> <xsl:if test="1 + count(ancestor::section) > 6">6</xsl:if> </xsl:variable> <xsl:text disable-output-escaping="yes"><H</xsl:text><xsl:number value="$depth"/><xsl:text disable-output-escaping="yes">></xsl:text> <xsl:number count="section" level="multiple" format="1.1.1.1.1.1"/> <xsl:text> </xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes"></H</xsl:text><xsl:number value="$depth"/><xsl:text disable-output-escaping="yes">></xsl:text> </html> </template> <!-- A quotation. @align: The alignment of the quotation paragraph. 'left' [default] 'center' 'right' --> <template name="quotation" match="quotation"> <!-- Should we be using a quotation environment? --> <latex> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> \begin{flush<xsl:value-of select="@align"/>}\itshape <xsl:apply-templates/>\end{flush<xsl:value-of select="@align"/>} </xsl:when> <xsl:when test="@align = 'center'"> \begin{center}\itshape <xsl:apply-templates/>\end{center} </xsl:when> <xsl:otherwise> \begin{quote}\itshape <xsl:apply-templates/>\end{quote} </xsl:otherwise> </xsl:choose> </latex> <!-- Nominally we should use <BLOCKQUOTE>, but it doesn't have alignment. --> <html> <P> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <I><xsl:apply-templates/></I> </P> </html> </template> <!-- Anything inside a <metadata> is ignored completely. (More accurately, we pick bits out of it manually as required; it's only ignored by apply-templates.) --> <template name="metadata" match="metadata"/> <!-- Anything inside an <omit> is also ignored completely. --> <template name="omit" match="omit"/> <!-- Comments are not quite ignored completely, as they're carried through to the output document (kind of: "It is an error if instantiating the content of xsl:comment creates nodes other than text nodes.") --> <template name="comment" match="comment"> <latex> <xsl:text> \begin{comment}</xsl:text> <xsl:apply-templates/> <xsl:text>\end{comment} </xsl:text> </latex> <html> <xsl:comment> <xsl:apply-templates/> </xsl:comment> </html> </template> <!-- Tabular structures (LaTeX {tabular}, HTML <TABLE>). @align: The alignment of the table as a whole. 'left' [default] 'center' 'right' @border: Width of cell border for HTML tables. --> <template name="tabular" match="tabular"> <latex> <!-- Overall table alignment. --> <xsl:text>\begin{</xsl:text> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> \begin{tabular}{<xsl:apply-templates select="columns"/>} <xsl:apply-templates select="tabular-header"/> <xsl:apply-templates select="tabular-body"/> <xsl:apply-templates select="tabular-footer"/> \end{tabular} <xsl:text>\end{</xsl:text> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> </latex> <html> <TABLE> <xsl:attribute name="BORDER"> <xsl:value-of select="@border"/> <xsl:if test="not(@border)">0</xsl:if> </xsl:attribute> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <!-- Note different ordering of tabular components: HTML requires THEAD and TFOOT to precede TBODY. --> <xsl:apply-templates select="tabular-header"/> <xsl:apply-templates select="tabular-footer"/> <xsl:apply-templates select="tabular-body"/> </TABLE> </html> </template> <!-- Specify column formatting, mainly for LaTeX, although HTML does get <TD> ALIGN values from here. @align: The alignment of this particular column. 'left' [default] 'center' 'right' @left-border: Set to '|' to include a column separator to the left of this column. @right-border: Set to '|' to include a column separator to the right of this column. Careful: including a right-border on a cell and a left-border on the next cell will produce '||', not '|'. BUT, when doing multi-column or multi-row cells, always include both borders if required, because \multicolumn overrides the default border specification. --> <template name="aligned-column" match="column[@align]"> <latex> <xsl:value-of select="@left-border"/> <xsl:value-of select="substring(@align, 1, 1)"/> <xsl:value-of select="@right-border"/> </latex> </template> <template name="unaligned-column" match="column[not(@align)]"> <latex> <xsl:value-of select="@left-border"/> <xsl:text>l</xsl:text> <xsl:value-of select="@right-border"/> </latex> </template> <template name="tabular-header" match="tabular-header"> <latex></latex> <html> <THEAD> <xsl:apply-templates/> </THEAD> </html> </template> <template name="tabular-footer" match="tabular-footer"> <latex></latex> <html> <TFOOT> <xsl:apply-templates/> </TFOOT> </html> </template> <template name="tabular-body" match="tabular-body"> <latex><xsl:apply-templates/></latex> <html> <TBODY> <xsl:apply-templates/> </TBODY> </html> </template> <!-- @no-page-break: Inhibit page breaks after this row (LaTeX only). --> <template name="row" match="row"> <latex><xsl:apply-templates/> \\<xsl:if test="@no-page-break = 'yes'">*</xsl:if><xsl:text> </xsl:text></latex> <html> <TR> <xsl:apply-templates/> </TR> </html> </template> <!-- Horizontal rules (LaTeX only). @columns: The column range to draw the rule across. Specify as you would for a \cline in LaTeX, e.g., '3-5'. If omitted, the rule is drawn across all columns. --> <template name="row-rule-full" match="row-rule[not(@columns)]"> <latex><xsl:text>\hline </xsl:text></latex> </template> <template name="row-rule-partial" match="row-rule[@columns]"> <latex>\cline{<xsl:value-of select="@columns"/>}</latex> </template> <!-- Hmm, the multi-row stuff is somewhat broken in LaTeX, oops. Need to insert missing columns (as was done in the calendar XSL) when a multi-row cell is encountered. Also need to sort out \hlines in the presence of multi-row cells and also what happens to vertical cell borders :( This probably needs reworking. --> <!-- Multi-row cells (LaTeX only, as this is pretty trivial to achieve in HTML). @rows: The number of rows this cell spans. --> <template name="multirow-cell" match="cell" mode="multi-row"> <latex> <xsl:text>\multirow{</xsl:text> <xsl:value-of select="@rows"/> <xsl:text>}{*}{</xsl:text> <xsl:apply-templates/> <xsl:text>}</xsl:text> </latex> </template> <!-- Multi-column cells (LaTeX only, as this is pretty trivial to achieve in HTML). $num-columns: The number of rows this cell spans. --> <template name="multicolumn-cell" match="cell" mode="multi-column"> <latex> <xsl:param name="num-columns">1</xsl:param> <xsl:text>\multicolumn{</xsl:text> <xsl:value-of select="$num-columns"/> <xsl:text>}{</xsl:text> <xsl:value-of select="@left-border"/> <xsl:choose> <xsl:when test="@align"> <xsl:value-of select="substring(@align, 1, 1)"/> </xsl:when> <xsl:otherwise> <xsl:text>l</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="@right-border"/> <xsl:text>}{</xsl:text> <xsl:choose> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> </latex> </template> <template match="cell"> <common> <!-- position() doesn't seem to work very well in this context. --> <xsl:variable name="column-no"><xsl:number/></xsl:variable> </common> <!-- Doing this sensibly for LaTeX is actually pretty ugly, because different attribute combinations produce different code :( This is the sort of algorithm that can only really be clearly described by a flow chart :) --> <latex> <xsl:choose> <xsl:when test="@columns"> <xsl:apply-templates select="." mode="multi-column"> <xsl:with-param name="num-columns" select="@columns"/> </xsl:apply-templates> </xsl:when> <xsl:when test="@align"> <xsl:apply-templates select="." mode="multi-column"/> </xsl:when> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:if test="$column-no != last()"> & </xsl:if> </latex> <!-- It's much easier in HTML, because a <TD> is a <TD> is a <TD>, regardless of the attributes supplied. --> <html> <TD> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> <xsl:if test="not(@align)"> <xsl:value-of select="ancestor::tabular/columns/column[position() = $column-no]/@align"/> <xsl:if test="not(ancestor::tabular/columns/column[position() = $column-no]/@align)">left</xsl:if> </xsl:if> </xsl:attribute> <xsl:attribute name="COLSPAN"> <xsl:value-of select="@columns"/> <xsl:if test="not(@columns)">1</xsl:if> </xsl:attribute> <xsl:attribute name="ROWSPAN"> <xsl:value-of select="@rows"/> <xsl:if test="not(@rows)">1</xsl:if> </xsl:attribute> <xsl:apply-templates/> </TD> </html> </template> <!-- Hyperlinks. The content of the element is the hyperlink text. @label: A label that the hyperlink links to. The value should be an acceptable label in both LaTeX and HTML. [optional] @url: A URL that the hyperlink links to. If no link text is provided, the URL is used as the link text. [optional] --> <template name="hyperlink-label" match="hyperlink[@label]"> <latex>\hyperref[<xsl:value-of select="@label"/>]{<xsl:apply-templates/>}</latex> <html><A HREF="#{@label}"><xsl:apply-templates/></A></html> </template> <template name="hyperlink-url" match="hyperlink[@url and node()]"> <latex>\href{<xsl:value-of select="@url"/>}{<xsl:apply-templates/>}</latex> <html><A HREF="{@url}"><xsl:apply-templates/></A></html> </template> <template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"> <!-- Maybe we should be using the url package and \url{...}? --> <latex>\href{<xsl:value-of select="@url"/>}{\texttt{<xsl:value-of select="@url"/>}}</latex> <html><A HREF="{@url}"><CODE><xsl:value-of select="@url"/></CODE></A></html> </template> <!-- A plain URL (i.e., not necessarily a hyperlink). --> <template name="url" match="url"> <!-- Maybe we should be using the url package and \url{...}? --> <latex>\texttt{<xsl:apply-templates/>}</latex> <html><CODE><xsl:apply-templates/></CODE></html> </template> <alias source="uri" target="url"/> <alias source="email" target="url"/> <alias source="email-address" target="url"/> <!-- References. Note the distinction betwen these and hyperlinks: a reference is merely something like "see Section 2.3", and doesn't necessarily imply a hyperlink, or vice versa. @label: The label of the item that we're referencing. It must be a valid label in both LaTeX and HTML. [required] --> <template name="reference" match="reference"> <common> <!-- Find the element whose label is the same as our label. --> <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference"/> </common> </template> <!-- Do a separate template for each type of reference; easier. --> <template name="section-reference" match="section" mode="reference"> <!-- It's probably more consistent to just use \ref* and insert "Section" ourselves rather than let LaTeX do it. --> <latex>Section~\ref*{<xsl:value-of select="@label"/>}</latex> <html> <xsl:text disable-output-escaping="yes">Section&#160;</xsl:text> <xsl:number count="figure" level="multiple" format="1.1.1.1.1.1"/> </html> </template> <template name="figure-reference" match="figure" mode="reference"> <latex>Figure~\ref*{<xsl:value-of select="@label"/>}</latex> <html> <xsl:text disable-output-escaping="yes">Figure&#160;</xsl:text> <xsl:number count="figure" level="any" format="1"/> </html> </template> <template name="table-reference" match="table" mode="reference"> <latex>Table~\ref*{<xsl:value-of select="@label"/>}</latex> <html> <xsl:text disable-output-escaping="yes">Table&#160;</xsl:text> <xsl:number count="table" level="any" format="1"/> </html> </template> <!-- Figures & tables (in the LaTeX sense, i.e., "floating" items). --> <template name="figure" match="figure"> <latex> \begin{figure} \centering <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{figure} </latex> <html> <DIV CLASS="figure"> <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </html> </template> <template name="table" match="table"> <latex> \begin{table} \centering <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{table} </latex> <html> <DIV CLASS="table"> <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </html> </template> <template name="figure-caption" match="figure/caption"> <latex><xsl:apply-templates/></latex> <html> <STRONG>Figure <xsl:number count="figure" level="any" format="1"/>. </STRONG><xsl:apply-templates/> </html> </template> <template name="table-caption" match="table/caption"> <latex><xsl:apply-templates/></latex> <html> <STRONG>Table <xsl:number count="table" level="any" format="1"/>. </STRONG><xsl:apply-templates/> </html> </template> <!-- Images. Includes a scaling factor for LaTeX. To do: alternatively, allow defining the scaling factor by specifying what proportion of the page width the image should occupy (a la LaTeX [width] parameter). How about a <latex-attributes> element that can be used to specify \includegraphics arguments? <width keepaspectratio="yes">0.5\columnwidth</width> <height>2cm</height> <scale>0.5</scale> etc. To do: if no description is given, use the basename as the content of the ALT element. Ideally, I think we should be able to define two image formats (PDF, EPS, PNG, ...) when marking up an image: one for LaTeX output, another for HTML. --> <!-- LaTeX images are always handled the same way regardless. --> <template match="image" mode="latex"> <latex> <xsl:text>\includegraphics</xsl:text> <xsl:if test="count(latex-scaling) != 0"> <xsl:text>[scale=</xsl:text> <xsl:value-of select="latex-scaling"/> <xsl:text>]</xsl:text> </xsl:if> <!-- Use whatever standard image folder is appropriate for the context. --> <xsl:choose> <!-- Could possibly change this to test="/document/@class = 'tutorial'" or similar? --> <xsl:when test="name(/child::node()[1])='tutorial'"> <xsl:text>{\tutroot/</xsl:text><xsl:value-of select="/tutorial/metadata/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/tutorial/metadata/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:when test="name(/child::node()[1])='laboratory'"> <xsl:text>{\labroot/</xsl:text><xsl:value-of select="/laboratory/metadata/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/laboratory/metadata/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>{images/</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$image-format"/> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> </latex> </template> <template match="image[count(provide-large-version) = 0]"> <latex><xsl:apply-templates select="." mode="latex"/></latex> <html> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:choose> <xsl:when test="(name(/child::node()[1])='tutorial') or (name(/child::node()[1])='laboratory')"> <xsl:text>Graphics/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-72dpi.png</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"><xsl:apply-templates select="description"/></xsl:attribute> </IMG> </html> </template> <template match="image[count(provide-large-version) != 0]"> <latex><xsl:apply-templates select="." mode="latex"/></latex> <html> <A> <xsl:attribute name="HREF"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-zoom.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"> <xsl:apply-templates select="description"/> </xsl:attribute> </IMG> <BR CLEAR="right"/> <xsl:text>(Larger version)</xsl:text> </A> </html> </template> <!-- Include another XML document into the current one. Including LaTeX should be done using <latex-input>. Nothing for HTML includes at present, although this may not actually be necessary anyway given that HTML doesn't natively support this in the first place. You're probably better off just generating a separate document and linking to it. It's difficult to produce HTML fragments because the XSLT processor seems to always generate a DOCTYPE when producing HTML, whether you want it or not. Maybe you can turn this off? @file: Name of file to include. [required] --> <template name="include-xml" match="include-document"> <common> <xsl:apply-templates select="document(@file)"/> </common> </template> <!-- Environment setup. This enables you to load environment settings (e.g., required LaTeX packages, etc.) from an external configuration file. The master style sheet automatically loads a file called "environment.xml"; you don't need to do anything for this file to be loaded. Multiple configuration files may be loaded, as long as they all have different names. You can also define environment entries inline by omitting the file attribute. @file: Name of environment file. [optional] --> <template name="environment" match="environment[@file]"> <xsl:apply-templates select="document(@file)/environment/*"/> </template> <!-- Load a LaTeX package. @options: Any arguments to the package. [optional] --> <template name="latex-package" match="latex-packages/package"> <latex>\usepackage<xsl:if test="@options">[<xsl:value-of select="@options"/>]</xsl:if>{<xsl:value-of select="."/>}</latex> </template> <template name="latex-command" match="latex-packages/command"> <latex><xsl:value-of select="."/></latex> </template> <!-- Sometimes we might need to embed raw code to handle something tricky. --> <template name="raw-latex" match="raw-code[@format = 'latex']"> <latex><xsl:apply-templates/></latex> </template> <template name="raw-html" match="raw-code[@format = 'html']"> <html><xsl:copy-of select="*"/></html> </template> <!-- Generate a LaTeX \input{} macro. --> <template name="latex-input" match="latex-input"> <latex>\input{<xsl:value-of select="."/>}</latex> </template> <!-- Conditional processing depending on the format. It may appear redundant to have two templates, but this is the only way to ensure that the LaTeX template is empty in the HTML style sheet, and vice versa. @format: the format under which this XML is to be processed. [required] --> <template name="process-when-latex" match="process-when[@format = 'latex']"> <latex><xsl:apply-templates/></latex> </template> <template name="process-when-html" match="process-when[@format = 'html']"> <html><xsl:apply-templates/></html> </template> <!-- Basic maths stuff. Anything more complicated is... complicated. We should probably be using MathML, but we still have to mangle it into HTML regardless. A <math> inside a <paragraph> is assumed to be inline, while a <math> on its own is assumed to be displayed in its own paragraph. --> <template name="math-inline" match="paragraph//math|para//math|p//math"> <latex>\(<xsl:apply-templates mode="math"/>\)</latex> <html><xsl:apply-templates/></html> </template> <template name="math-display" match="math"> <latex>\[<xsl:apply-templates mode="math"/>\]</latex> <html><P ALIGN="center"><xsl:apply-templates/></P></html> </template> <!-- Equation arrays --> <template name="equation-array" match="equation-array"> <latex> <xsl:text>\begin{eqnarray*} </xsl:text> <xsl:apply-templates mode="math"/> <xsl:text> \end{eqnarray*}</xsl:text> </latex> <html> <TABLE CLASS="equation" BORDER="0" ALIGN="CENTER"><xsl:apply-templates/></TABLE> </html> </template> <!-- Hmm, LaTeX uses "&" as separators: how do we know if there's another cell coming? Ah, but the LaTeX eqnarray can have no more than three columns, so there's no need to generalise. --> <template match="equation-array/row"> <latex> <xsl:apply-templates select="left"/><xsl:text disable-output-escaping="yes"> & </xsl:text><xsl:apply-templates select="middle"/><xsl:text disable-output-escaping="yes"> & </xsl:text><xsl:apply-templates select="right"/><xsl:text> \\ \\ </xsl:text> </latex> <html> <TR><TD ALIGN="RIGHT"><xsl:apply-templates select="left"/></TD><TD ALIGN="CENTER"><xsl:apply-templates select="middle"/></TD><TD ALIGN="LEFT"><xsl:apply-templates select="right"/></TD></TR> </html> </template> <!-- Digit grouping separator character for large numbers. SI conventions say this should be a space (but we could make it a comma if desired). --> <template name="digit-group-separator" match="digit-group-separator"> <common> <xsl:call-template name="non-breaking-space"/> </common> </template> <alias source="digitsep" target="digit-group-separator"/> <!-- Super- and subscript. --> <template name="superscript" match="math//superscript"> <latex>^{<xsl:apply-templates/>}</latex> <html><SUP><xsl:apply-templates/></SUP></html> </template> <template name="subscript" match="math//subscript"> <latex>_{<xsl:apply-templates/>}</latex> <html><SUB><xsl:apply-templates/></SUB></html> </template> <!-- Basic mathematical operators. --> <template name="plus-operator" match="math//plus"> <common>+</common> </template> <template name="minus-operator" match="math//minus"> <common>-</common> </template> <template name="times-operator" match="math//times"> <latex>\times</latex> <html><xsl:text disable-output-escaping="yes"> &#215; </xsl:text></html> </template> <alias source="times" target="times-operator"/> <template name="divide-operator" match="math//divide"> <common>/</common> </template> <template name="equals-operator" match="math//equals"> <common> = </common> </template> <template name="approximately-equals-operator" match="approximately-equals-operator"> <latex>{\approx}</latex> <html><xsl:text disable-output-escaping="yes">≈</xsl:text></html> </template> <alias source="approximately-equals" target="approximately-equals-operator"/> <alias source="approximately-equal-to" target="approximately-equals-operator"/> <!-- The equivalent of LaTeX's "log-like functions". @name: The name of the function. We assume the names used by LaTeX here, as they work out correct anyway. There's actually nothing to stop you using any name you like, except that it'll probably die horribly in LaTeX :) [required] --> <template name="log-like-function" match="math//function"> <latex>\<xsl:value-of select="@name"/></latex> <html><xsl:value-of select="@name"/></html> </template> <!-- Any mathematical variable names. --> <template name="math-variable" match="math//variable"> <latex><xsl:apply-templates/></latex> <html><I><xsl:apply-templates/></I></html> </template> <!-- A displayed fraction. Is there a nicer way of doing this in HTML? --> <template name="math-fraction" match="math//fraction"> <latex>\frac{<xsl:apply-templates select="numerator"/>}{<xsl:apply-templates select="denominator"/>}</latex> <html><xsl:apply-templates select="numerator"/><BIG> / </BIG><xsl:apply-templates select="denominator"/></html> </template> </stylesheet>
<?xml version="1.0"?> <!-- This will mostly be a list of element names to match, along with the corresponding HTML and LaTeX handling XSLT code. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <hyperlink> <element>OraAdmin</element> <url>http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96521/toc.htm</url> <label>test<!--<xsl:call-template name="OracleServer"/> Database Administrator<xsl:call-template name="apostrophe"/>s Guide--></label> </hyperlink> <template name="PaperCode" match="PaperCode"> <latex><xsl:value-of select="$department"/>~<xsl:value-of select="$paper"/></latex> <html> <xsl:value-of select="$department"/> <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> <xsl:value-of select="$paper"/> </html> </template> <template name="OracleServer" match="OracleServer"> <latex>Oracle9\textit{i}</latex> <html>Oracle9<I>i</I></html> </template> <!-- Plain paragraph. @indent: Whether or not to indent this paragraph (probably only relevant in LaTeX). 'no' => don't indent. otherwise => apply standard paragraph formatting. [default] --> <template name="paragraph" match="paragraph"> <latex><xsl:text> </xsl:text><xsl:if test="@indent = 'no'">\noindent </xsl:if><xsl:apply-templates/><xsl:text> </xsl:text></latex> <!-- HTML is weird about what things you cannot include inside paragraphs (e.g. lists of any kind). However, the end P tag is optional, so one option might simply be not to output it. --> <html><P><xsl:apply-templates/></P></html> </template> <alias source="para" target="paragraph"/> <alias source="p" target="paragraph"/> <!-- Special characters (should maybe all be named, in case they need to be called explicitly with xsl:call-template) --> <!-- I'd like to use the Unicode names for these; will look them up some time! --> <template name="newline" match="newline"> <latex> \\</latex> <html><BR/></html> </template> <template name="page-break" match="page-break"> <latex>\newpage</latex> </template> <alias source="new-page" target="page-break"/> <template name="non-breaking-space" match="non-breaking-space"> <latex>~</latex> <html><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></html> </template> <alias source="nbsp" target="non-breaking-space"/> <!-- Technically we don't need to disable output escaping for all of these, but it's probably better to code them all consistently, rather than trying to figure out which ones do need it (e.g.,   for a non-breaking space) and which ones don't (e.g., &). --> <template name="ellipsis-sign" match="ellipsis-sign"> <latex>{\ldots}</latex> <html><xsl:text disable-output-escaping="yes">&#8230;</xsl:text></html> </template> <alias source="etc" target="ellipsis-sign"/> <alias source="ellipsis" target="ellipsis-sign"/> <alias source="dots" target="ellipsis-sign"/> <!-- Misc typographic symbols --> <template name="endash" match="endash"> <latex>--</latex> <html><xsl:text disable-output-escaping="yes">&#8211;</xsl:text></html> </template> <alias source="en-dash" target="endash"/> <template name="emdash" match="emdash"> <latex>---</latex> <html><xsl:text disable-output-escaping="yes">&#8212;</xsl:text></html> </template> <alias source="em-dash" target="emdash"/> <template name="apostrophe" match="apostrophe"> <latex>'</latex> <html><xsl:text disable-output-escaping="yes">&#8217;</xsl:text></html> </template> <template name="dollar" match="dollar"> <latex>\$</latex> <html>$</html> </template> <template name="percent-sign" match="percent-sign"> <latex>\%</latex> <html>%</html> </template> <template name="ampersand" match="ampersand"> <latex>\&</latex> <html><xsl:text disable-output-escaping="yes">&amp;</xsl:text></html> </template> <template name="trademark-sign" match="trademark-sign"> <latex>\texttrademark</latex> <html><xsl:text disable-output-escaping="yes">&#8482;</xsl:text></html> </template> <alias source="trademark" target="trademark-sign"/> <alias source="TM" target="trademark-sign"/> <template name="copyright-sign" match="copyright-sign"> <latex>\copyright</latex> <html><xsl:text disable-output-escaping="yes">&#169;</xsl:text></html> </template> <template name="degree-sign" match="degree-sign"> <latex>$^{\circ}$</latex> <html><xsl:text disable-output-escaping="yes">&#176;</xsl:text></html> </template> <alias source="degrees" target="degree-sign"/> <template name="section-sign" match="section-sign"> <latex>{\S}</latex> <html><xsl:text disable-output-escaping="yes">&#167;</xsl:text></html> </template> <template name="paragraph-sign" match="paragraph-sign"> <latex>{\P}</latex> <html><xsl:text disable-output-escaping="yes">&#182;</xsl:text></html> </template> <!-- I think the pi symbol is only available in LaTeX in math mode, but if we're already in math mode, the extra $ signs will mess things up... --> <!-- Can we use XSLT modes to deal with this? --> <template name="pi" match="pi"> <!-- <latex>$\pi$</latex> --> <latex>\pi</latex> <html><xsl:text disable-output-escaping="yes">&#960;</xsl:text></html> </template> <template name="LaTeX" match="LaTeX"> <latex>{\LaTeX}</latex> <html>L<SUP>A</SUP>T<SUB>E</SUB>X</html> </template> <alias source="latex" target="LaTeX"/> <!-- Note: no equivalent of \triangleright in HTML, use right arrow instead. --> <template name="menu-separator" match="menu-separator"> <latex>$\triangleright$</latex> <html><xsl:text disable-output-escaping="yes">&#8594;</xsl:text></html> </template> <alias source="menusep" target="menu-separator"/> <template name="menu-item" match="menu/item"> <latex>\menuitem{<xsl:apply-templates/>}</latex> <html><B><xsl:apply-templates/></B></html> </template> <!-- Special styles --> <template name="emph" match="emph"> <latex>\emph{<xsl:apply-templates/>}</latex> <html><EM><xsl:apply-templates/></EM></html> </template> <template name="italic" match="italic"> <latex>\textit{<xsl:apply-templates/>}</latex> <html><I><xsl:apply-templates/></I></html> </template> <template name="strong" match="strong"> <latex>\textbf{<xsl:apply-templates/>}</latex> <html><STRONG><xsl:apply-templates/></STRONG></html> </template> <template name="bold" match="bold"> <latex>\textbf{<xsl:apply-templates/>}</latex> <html><B><xsl:apply-templates/></B></html> </template> <template name="term" match="term"> <latex>\term{<xsl:apply-templates/>}</latex> <html><I CLASS="term"><xsl:apply-templates/></I></html> </template> <template name="foreign" match="foreign"> <latex>\foreign{<xsl:apply-templates/>}</latex> <html><I CLASS="foreign"><xsl:apply-templates/></I></html> </template> <template name="code" match="code"> <!-- <latex>\code{<xsl:apply-templates/>}</latex> --> <latex>\verb+<xsl:apply-templates/>+</latex> <html><CODE><xsl:apply-templates/></CODE></html> </template> <!-- We can decide later whether to use plain verbatim or listings. --> <template name="code-block" match="code-block"> <latex> \begin{verbatim} <xsl:apply-templates/> \end{verbatim} </latex> <html> <PRE CLASS="code"><xsl:apply-templates/></PRE> </html> </template> <!-- This is for stuff that should unequivocally be treated verbatim (e.g. problem code). --> <template name="verbatim" match="verbatim"> <latex> \begin{verbatim} <xsl:apply-templates/> \end{verbatim} </latex> <html> <PRE><xsl:apply-templates/></PRE> </html> </template> <!-- Quoted text. Handles nested quotes correctly. @single: Whether to enclose the text in single or double quotes. 'yes' => single quotes (''). otherwise => double quotes (""). [default] --> <template name="single-quote" match="quote[@single='yes']"> <latex>`<xsl:apply-templates/>'</latex> <html> <xsl:text disable-output-escaping="yes">&#8216;</xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes">&#8217;</xsl:text> </html> </template> <template name="double-quote" match="quote"> <latex>``<xsl:apply-templates/>''</latex> <html> <xsl:text disable-output-escaping="yes">&#8220;</xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes">&#8221;</xsl:text> </html> </template> <!-- With nested quotes, we need to figure out what depth of nesting we're at, then call the appropriate template depending on the initial quoting style (single or double). --> <template name="nested-double-quote" match="quote//quote"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote"/> </xsl:otherwise> </xsl:choose> </common> </template> <template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote"/> </xsl:otherwise> </xsl:choose> </common> </template> <alias source="q" target="single-quote"/> <alias source="qq" target="double-quote"/> <!-- Environments (in the LaTeX terminology): enumerated, ordered, and numbered lists. --> <!-- Unordered lists --> <template name="itemised-list" match="itemised-list"> <latex> \begin{itemize} <xsl:apply-templates/> \end{itemize} </latex> <html> <UL> <xsl:apply-templates/> </UL> </html> </template> <alias source="itemize" target="itemised-list"/> <alias source="unordered-list" target="itemised-list"/> <alias source="bulleted-list" target="itemised-list"/> <alias source="bullet-list" target="itemised-list"/> <alias source="bullet-points" target="itemised-list"/> <!-- Ordered lists --> <template name="enumerated-list" match="enumerated-list"> <latex> \begin{enumerate} <xsl:apply-templates/> \end{enumerate} </latex> <html> <OL> <xsl:apply-templates/> </OL> </html> </template> <alias source="enumerate" target="enumerated-list"/> <alias source="ordered-list" target="enumerated-list"/> <alias source="numbered-list" target="enumerated-list"/> <alias source="question-list" target="enumerated-list"/> <!-- Definition or description lists. --> <template name="definition-list" match="definition-list"> <latex> \begin{description} <xsl:apply-templates/> \end{description} </latex> <html> <!-- Hmm, <DL>s in HTML tend to come out with the spacing a bit wrong (or maybe it's just my browser?). Might using a table be better? Messy if the keyword is long, though, and you don't get a proper hanging indent... Maybe this is something that could be handled in CSS instead. --> <DL> <xsl:apply-templates/> </DL> <!-- <TABLE BORDER="0" CELLPADDING="10"> --> <!-- <xsl:apply-templates/> --> <!-- </TABLE> --> </html> </template> <alias source="description-list" target="definition-list"/> <!-- List elements --> <template name="item" match="item"> <latex>\item <xsl:apply-templates/></latex> <html> <xsl:choose> <xsl:when test="count(paragraph|para|p) != 0"> <LI><xsl:apply-templates/></LI> </xsl:when> <xsl:otherwise> <LI><P><xsl:apply-templates/></P></LI> </xsl:otherwise> </xsl:choose> </html> </template> <template name="definition-item" match="definition-list/item"> <latex>\item[<xsl:apply-templates select="keyword"/>] <xsl:apply-templates select="definition"/></latex> <html> <DT><P><xsl:apply-templates select="keyword"/></P></DT> <DD><xsl:apply-templates select="definition|description|discourse"/></DD> <!-- <TR VALIGN="TOP"> --> <!-- <TD><P><xsl:apply-templates select="keyword"/></P></TD> --> <!-- <TD><xsl:apply-templates select="definition|description|discourse"/></TD> --> <!-- </TR> --> </html> </template> <template name="keyword" match="keyword"> <latex><xsl:apply-templates/></latex> <html><STRONG><xsl:apply-templates/></STRONG></html> </template> <alias source="topic" target="keyword"/> <!-- Need to provide some context here as, e.g., <description> is also used within <image>. --> <template name="definition" match="item/definition|item/description|item/discourse"> <html> <xsl:choose> <xsl:when test="count(paragraph|para|p) != 0"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> <P><xsl:apply-templates/></P> </xsl:otherwise> </xsl:choose> </html> </template> <!-- Sections, subsections, subsubsections, ... @label: A label that can be used for cross referencing. Any value can be used, as long as it's a legal identifier in both LaTeX and HTML. --> <template name="section" match="section"> <latex> <xsl:apply-templates> <xsl:with-param name="label"> <xsl:value-of select="@label"/> <xsl:if test="not(@label)">THERE_IS_NO_LABEL</xsl:if> </xsl:with-param> </xsl:apply-templates> </latex> <html> <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> <xsl:apply-templates/> <!-- Since HTML doesn't really support footnotes as such, include them as "section notes" instead. --> <xsl:if test="count(.//footnote) > 0"> <P><STRONG>Notes:</STRONG></P> <xsl:apply-templates select=".//footnote" mode="list"/> </xsl:if> </html> </template> <!-- Footnotes. --> <template name="footnote" match="footnote"> <latex>\footnote{<xsl:apply-templates/>}</latex> <html> <A> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> </html> </template> <!-- This is only required for HTML, as LaTeX does it all for you. --> <template name="footnote-list" match="footnote" mode="list"> <html> <P> <A> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> <xsl:text> </xsl:text> <xsl:apply-templates/> <xsl:text> </xsl:text> <!-- Provide a back link to the original footnote marker. --> <A> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:text>[Back]</xsl:text> </A> </P> </html> </template> <!-- Document preamble stuff: title, author, date. --> <template name="preamble-title" match="document/title" mode="preamble"> <latex>\title{<xsl:apply-templates/>}</latex> <html> <xsl:apply-templates/> </html> </template> <template name="preamble-author" match="document/author" mode="preamble"> <latex>\author{<xsl:apply-templates/>}</latex> </template> <template name="preamble-date" match="document/date" mode="preamble"> <latex>\date{<xsl:apply-templates/>}</latex> </template> <template name="document-title" match="document/title"> <!-- Need to do something sensible for LaTeX here. --> <latex><xsl:if test="$standalone = 'no'"></xsl:if></latex> <html> <H1><xsl:apply-templates/></H1> </html> </template> <template name="document-author" match="document/author"/> <template name="document-date" match="document/date"/> <!-- Generate some number of "sub"s so we can produce, e.g., "subsubsection" for LaTeX. $depth: the number of repetitions (0 <= $depth <= 2, but there's no need to do bounds checking at the upper end, because that's already dealt with in the "section-title" template below). --> <template name="generate-subs"> <latex> <xsl:param name="depth">1</xsl:param> <xsl:if test="$depth > 1"> <xsl:text>sub</xsl:text> <xsl:call-template name="generate-subs"> <xsl:with-param name="depth"><xsl:value-of select="$depth - 1"/></xsl:with-param> </xsl:call-template> </xsl:if> </latex> </template> <!-- Generate section title with nested numbering, e.g., 1.1.3. --> <template name="section-title" match="section/title"> <latex> <xsl:param name="label"/> <xsl:text>\</xsl:text> <!-- Generate the correct number of "sub"s for LaTeX. --> <xsl:call-template name="generate-subs"> <xsl:with-param name="depth"> <xsl:number value="count(ancestor::section)"/> <xsl:if test="count(ancestor::section) > 3">3</xsl:if> </xsl:with-param> </xsl:call-template> <xsl:text>section{</xsl:text> <xsl:apply-templates/><xsl:text>}</xsl:text> <xsl:if test="$label != 'THERE_IS_NO_LABEL'"> \label{<xsl:value-of select="$label"/>} </xsl:if> </latex> <html> <!-- The depth is used in a couple of places, so we pre-calculate it. --> <xsl:variable name="depth"> <xsl:number value="1 + count(ancestor::section)"/> <xsl:if test="1 + count(ancestor::section) > 6">6</xsl:if> </xsl:variable> <xsl:text disable-output-escaping="yes"><H</xsl:text><xsl:number value="$depth"/><xsl:text disable-output-escaping="yes">></xsl:text> <xsl:number count="section" level="multiple" format="1.1.1.1.1.1"/> <xsl:text> </xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes"></H</xsl:text><xsl:number value="$depth"/><xsl:text disable-output-escaping="yes">></xsl:text> </html> </template> <!-- A quotation. @align: The alignment of the quotation paragraph. 'left' [default] 'center' 'right' --> <template name="quotation" match="quotation"> <!-- Should we be using a quotation environment? --> <latex> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> \begin{flush<xsl:value-of select="@align"/>}\itshape <xsl:apply-templates/>\end{flush<xsl:value-of select="@align"/>} </xsl:when> <xsl:when test="@align = 'center'"> \begin{center}\itshape <xsl:apply-templates/>\end{center} </xsl:when> <xsl:otherwise> \begin{quote}\itshape <xsl:apply-templates/>\end{quote} </xsl:otherwise> </xsl:choose> </latex> <!-- Nominally we should use <BLOCKQUOTE>, but it doesn't have alignment. --> <html> <P> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <I><xsl:apply-templates/></I> </P> </html> </template> <!-- Anything inside a <metadata> is ignored completely. (More accurately, we pick bits out of it manually as required; it's only ignored by apply-templates.) --> <template name="metadata" match="metadata"/> <!-- Anything inside an <omit> is also ignored completely. --> <template name="omit" match="omit"/> <!-- Comments are not quite ignored completely, as they're carried through to the output document (kind of: "It is an error if instantiating the content of xsl:comment creates nodes other than text nodes.") --> <template name="comment" match="comment"> <latex> <xsl:text> \begin{comment}</xsl:text> <xsl:apply-templates/> <xsl:text>\end{comment} </xsl:text> </latex> <html> <xsl:comment> <xsl:apply-templates/> </xsl:comment> </html> </template> <!-- Tabular structures (LaTeX {tabular}, HTML <TABLE>). @align: The alignment of the table as a whole. 'left' [default] 'center' 'right' @border: Width of cell border for HTML tables. --> <template name="tabular" match="tabular"> <latex> <!-- Overall table alignment. --> <xsl:text>\begin{</xsl:text> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> \begin{tabular}{<xsl:apply-templates select="columns"/>} <xsl:apply-templates select="tabular-header"/> <xsl:apply-templates select="tabular-body"/> <xsl:apply-templates select="tabular-footer"/> \end{tabular} <xsl:text>\end{</xsl:text> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> </latex> <html> <TABLE> <xsl:attribute name="BORDER"> <xsl:value-of select="@border"/> <xsl:if test="not(@border)">0</xsl:if> </xsl:attribute> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <!-- Note different ordering of tabular components: HTML requires THEAD and TFOOT to precede TBODY. --> <xsl:apply-templates select="tabular-header"/> <xsl:apply-templates select="tabular-footer"/> <xsl:apply-templates select="tabular-body"/> </TABLE> </html> </template> <!-- Specify column formatting, mainly for LaTeX, although HTML does get <TD> ALIGN values from here. @align: The alignment of this particular column. 'left' [default] 'center' 'right' @left-border: Set to '|' to include a column separator to the left of this column. @right-border: Set to '|' to include a column separator to the right of this column. Careful: including a right-border on a cell and a left-border on the next cell will produce '||', not '|'. BUT, when doing multi-column or multi-row cells, always include both borders if required, because \multicolumn overrides the default border specification. --> <template name="aligned-column" match="column[@align]"> <latex> <xsl:value-of select="@left-border"/> <xsl:value-of select="substring(@align, 1, 1)"/> <xsl:value-of select="@right-border"/> </latex> </template> <template name="unaligned-column" match="column[not(@align)]"> <latex> <xsl:value-of select="@left-border"/> <xsl:text>l</xsl:text> <xsl:value-of select="@right-border"/> </latex> </template> <template name="tabular-header" match="tabular-header"> <latex></latex> <html> <THEAD> <xsl:apply-templates/> </THEAD> </html> </template> <template name="tabular-footer" match="tabular-footer"> <latex></latex> <html> <TFOOT> <xsl:apply-templates/> </TFOOT> </html> </template> <template name="tabular-body" match="tabular-body"> <latex><xsl:apply-templates/></latex> <html> <TBODY> <xsl:apply-templates/> </TBODY> </html> </template> <!-- @no-page-break: Inhibit page breaks after this row (LaTeX only). --> <template name="row" match="row"> <latex><xsl:apply-templates/> \\<xsl:if test="@no-page-break = 'yes'">*</xsl:if><xsl:text> </xsl:text></latex> <html> <TR> <xsl:apply-templates/> </TR> </html> </template> <!-- Horizontal rules (LaTeX only). @columns: The column range to draw the rule across. Specify as you would for a \cline in LaTeX, e.g., '3-5'. If omitted, the rule is drawn across all columns. --> <template name="row-rule-full" match="row-rule[not(@columns)]"> <latex><xsl:text>\hline </xsl:text></latex> </template> <template name="row-rule-partial" match="row-rule[@columns]"> <latex>\cline{<xsl:value-of select="@columns"/>}</latex> </template> <!-- Hmm, the multi-row stuff is somewhat broken in LaTeX, oops. Need to insert missing columns (as was done in the calendar XSL) when a multi-row cell is encountered. Also need to sort out \hlines in the presence of multi-row cells and also what happens to vertical cell borders :( This probably needs reworking. --> <!-- Multi-row cells (LaTeX only, as this is pretty trivial to achieve in HTML). @rows: The number of rows this cell spans. --> <template name="multirow-cell" match="cell" mode="multi-row"> <latex> <xsl:text>\multirow{</xsl:text> <xsl:value-of select="@rows"/> <xsl:text>}{*}{</xsl:text> <xsl:apply-templates/> <xsl:text>}</xsl:text> </latex> </template> <!-- Multi-column cells (LaTeX only, as this is pretty trivial to achieve in HTML). $num-columns: The number of rows this cell spans. --> <template name="multicolumn-cell" match="cell" mode="multi-column"> <latex> <xsl:param name="num-columns">1</xsl:param> <xsl:text>\multicolumn{</xsl:text> <xsl:value-of select="$num-columns"/> <xsl:text>}{</xsl:text> <xsl:value-of select="@left-border"/> <xsl:choose> <xsl:when test="@align"> <xsl:value-of select="substring(@align, 1, 1)"/> </xsl:when> <xsl:otherwise> <xsl:text>l</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="@right-border"/> <xsl:text>}{</xsl:text> <xsl:choose> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> </latex> </template> <template match="cell"> <common> <!-- position() doesn't seem to work very well in this context. --> <xsl:variable name="column-no"><xsl:number/></xsl:variable> </common> <!-- Doing this sensibly for LaTeX is actually pretty ugly, because different attribute combinations produce different code :( This is the sort of algorithm that can only really be clearly described by a flow chart :) --> <latex> <xsl:choose> <xsl:when test="@columns"> <xsl:apply-templates select="." mode="multi-column"> <xsl:with-param name="num-columns" select="@columns"/> </xsl:apply-templates> </xsl:when> <xsl:when test="@align"> <xsl:apply-templates select="." mode="multi-column"/> </xsl:when> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:if test="$column-no != last()"> & </xsl:if> </latex> <!-- It's much easier in HTML, because a <TD> is a <TD> is a <TD>, regardless of the attributes supplied. --> <html> <TD> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> <xsl:if test="not(@align)"> <xsl:value-of select="ancestor::tabular/columns/column[position() = $column-no]/@align"/> <xsl:if test="not(ancestor::tabular/columns/column[position() = $column-no]/@align)">left</xsl:if> </xsl:if> </xsl:attribute> <xsl:attribute name="COLSPAN"> <xsl:value-of select="@columns"/> <xsl:if test="not(@columns)">1</xsl:if> </xsl:attribute> <xsl:attribute name="ROWSPAN"> <xsl:value-of select="@rows"/> <xsl:if test="not(@rows)">1</xsl:if> </xsl:attribute> <xsl:apply-templates/> </TD> </html> </template> <!-- Hyperlinks. The content of the element is the hyperlink text. @label: A label that the hyperlink links to. The value should be an acceptable label in both LaTeX and HTML. [optional] @url: A URL that the hyperlink links to. If no link text is provided, the URL is used as the link text. [optional] --> <template name="hyperlink-label" match="hyperlink[@label]"> <latex>\hyperref[<xsl:value-of select="@label"/>]{<xsl:apply-templates/>}</latex> <html><A HREF="#{@label}"><xsl:apply-templates/></A></html> </template> <template name="hyperlink-url" match="hyperlink[@url and node()]"> <latex>\href{<xsl:value-of select="@url"/>}{<xsl:apply-templates/>}</latex> <html><A HREF="{@url}"><xsl:apply-templates/></A></html> </template> <template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"> <!-- Maybe we should be using the url package and \url{...}? --> <latex>\href{<xsl:value-of select="@url"/>}{\texttt{<xsl:value-of select="@url"/>}}</latex> <html><A HREF="{@url}"><CODE><xsl:value-of select="@url"/></CODE></A></html> </template> <!-- A plain URL (i.e., not necessarily a hyperlink). --> <template name="url" match="url"> <!-- Maybe we should be using the url package and \url{...}? --> <latex>\texttt{<xsl:apply-templates/>}</latex> <html><CODE><xsl:apply-templates/></CODE></html> </template> <alias source="uri" target="url"/> <alias source="email" target="url"/> <alias source="email-address" target="url"/> <!-- References. Note the distinction betwen these and hyperlinks: a reference is merely something like "see Section 2.3", and doesn't necessarily imply a hyperlink, or vice versa. @label: The label of the item that we're referencing. It must be a valid label in both LaTeX and HTML. [required] --> <template name="reference" match="reference"> <common> <!-- Find the element whose label is the same as our label. --> <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference"/> </common> </template> <!-- Do a separate template for each type of reference; easier. --> <template name="section-reference" match="section" mode="reference"> <!-- It's probably more consistent to just use \ref* and insert "Section" ourselves rather than let LaTeX do it. --> <latex>Section~\ref*{<xsl:value-of select="@label"/>}</latex> <html> <xsl:text disable-output-escaping="yes">Section&#160;</xsl:text> <xsl:number count="figure" level="multiple" format="1.1.1.1.1.1"/> </html> </template> <template name="figure-reference" match="figure" mode="reference"> <latex>Figure~\ref*{<xsl:value-of select="@label"/>}</latex> <html> <xsl:text disable-output-escaping="yes">Figure&#160;</xsl:text> <xsl:number count="figure" level="any" format="1"/> </html> </template> <template name="table-reference" match="table" mode="reference"> <latex>Table~\ref*{<xsl:value-of select="@label"/>}</latex> <html> <xsl:text disable-output-escaping="yes">Table&#160;</xsl:text> <xsl:number count="table" level="any" format="1"/> </html> </template> <!-- Figures & tables (in the LaTeX sense, i.e., "floating" items). --> <template name="figure" match="figure"> <latex> \begin{figure} \centering <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{figure} </latex> <html> <DIV CLASS="figure"> <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </html> </template> <template name="table" match="table"> <latex> \begin{table} \centering <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{table} </latex> <html> <DIV CLASS="table"> <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </html> </template> <template name="figure-caption" match="figure/caption"> <latex><xsl:apply-templates/></latex> <html> <STRONG>Figure <xsl:number count="figure" level="any" format="1"/>. </STRONG><xsl:apply-templates/> </html> </template> <template name="table-caption" match="table/caption"> <latex><xsl:apply-templates/></latex> <html> <STRONG>Table <xsl:number count="table" level="any" format="1"/>. </STRONG><xsl:apply-templates/> </html> </template> <!-- Images. Includes a scaling factor for LaTeX. To do: alternatively, allow defining the scaling factor by specifying what proportion of the page width the image should occupy (a la LaTeX [width] parameter). How about a <latex-attributes> element that can be used to specify \includegraphics arguments? <width keepaspectratio="yes">0.5\columnwidth</width> <height>2cm</height> <scale>0.5</scale> etc. To do: if no description is given, use the basename as the content of the ALT element. Ideally, I think we should be able to define two image formats (PDF, EPS, PNG, ...) when marking up an image: one for LaTeX output, another for HTML. --> <!-- LaTeX images are always handled the same way regardless. --> <template match="image" mode="latex"> <latex> <xsl:text>\includegraphics</xsl:text> <xsl:if test="count(latex-scaling) != 0"> <xsl:text>[scale=</xsl:text> <xsl:value-of select="latex-scaling"/> <xsl:text>]</xsl:text> </xsl:if> <!-- Use whatever standard image folder is appropriate for the context. --> <xsl:choose> <!-- Could possibly change this to test="/document/@class = 'tutorial'" or similar? --> <xsl:when test="name(/child::node()[1])='tutorial'"> <xsl:text>{\tutroot/</xsl:text><xsl:value-of select="/tutorial/metadata/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/tutorial/metadata/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:when test="name(/child::node()[1])='laboratory'"> <xsl:text>{\labroot/</xsl:text><xsl:value-of select="/laboratory/metadata/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/laboratory/metadata/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>{images/</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$image-format"/> </xsl:otherwise> </xsl:choose> <xsl:text>}</xsl:text> </latex> </template> <template match="image[count(provide-large-version) = 0]"> <latex><xsl:apply-templates select="." mode="latex"/></latex> <html> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:choose> <xsl:when test="(name(/child::node()[1])='tutorial') or (name(/child::node()[1])='laboratory')"> <xsl:text>Graphics/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-72dpi.png</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"><xsl:apply-templates select="description"/></xsl:attribute> </IMG> </html> </template> <template match="image[count(provide-large-version) != 0]"> <latex><xsl:apply-templates select="." mode="latex"/></latex> <html> <A> <xsl:attribute name="HREF"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-zoom.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"> <xsl:apply-templates select="description"/> </xsl:attribute> </IMG> <BR CLEAR="right"/> <xsl:text>(Larger version)</xsl:text> </A> </html> </template> <!-- Include another XML document into the current one. Including LaTeX should be done using <latex-input>. Nothing for HTML includes at present, although this may not actually be necessary anyway given that HTML doesn't natively support this in the first place. You're probably better off just generating a separate document and linking to it. It's difficult to produce HTML fragments because the XSLT processor seems to always generate a DOCTYPE when producing HTML, whether you want it or not. Maybe you can turn this off? @file: Name of file to include. [required] --> <template name="include-xml" match="include-document"> <common> <xsl:apply-templates select="document(@file)"/> </common> </template> <!-- Environment setup. This enables you to load environment settings (e.g., required LaTeX packages, etc.) from an external configuration file. The master style sheet automatically loads a file called "environment.xml"; you don't need to do anything for this file to be loaded. Multiple configuration files may be loaded, as long as they all have different names. You can also define environment entries inline by omitting the file attribute. @file: Name of environment file. [optional] --> <template name="environment" match="environment[@file]"> <xsl:apply-templates select="document(@file)/environment/*"/> </template> <!-- Load a LaTeX package. @options: Any arguments to the package. [optional] --> <template name="latex-package" match="latex-packages/package"> <latex>\usepackage<xsl:if test="@options">[<xsl:value-of select="@options"/>]</xsl:if>{<xsl:value-of select="."/>}</latex> </template> <template name="latex-command" match="latex-packages/command"> <latex><xsl:value-of select="."/></latex> </template> <!-- Sometimes we might need to embed raw code to handle something tricky. --> <template name="raw-latex" match="raw-code[@format = 'latex']"> <latex><xsl:apply-templates/></latex> </template> <template name="raw-html" match="raw-code[@format = 'html']"> <html><xsl:copy-of select="*"/></html> </template> <!-- Generate a LaTeX \input{} macro. --> <template name="latex-input" match="latex-input"> <latex>\input{<xsl:value-of select="."/>}</latex> </template> <!-- Conditional processing depending on the format. It may appear redundant to have two templates, but this is the only way to ensure that the LaTeX template is empty in the HTML style sheet, and vice versa. @format: the format under which this XML is to be processed. [required] --> <template name="process-when-latex" match="process-when[@format = 'latex']"> <latex><xsl:apply-templates/></latex> </template> <template name="process-when-html" match="process-when[@format = 'html']"> <html><xsl:apply-templates/></html> </template> <!-- Basic maths stuff. Anything more complicated is... complicated. We should probably be using MathML, but we still have to mangle it into HTML regardless. A <math> inside a <paragraph> is assumed to be inline, while a <math> on its own is assumed to be displayed in its own paragraph. --> <template name="math-inline" match="paragraph//math|para//math|p//math"> <latex>\(<xsl:apply-templates/>\)</latex> <html><xsl:apply-templates/></html> </template> <template name="math-display" match="math"> <latex>\[<xsl:apply-templates/>\]</latex> <html><P ALIGN="center"><xsl:apply-templates/></P></html> </template> <!-- Equation arrays --> <template name="equation-array" match="equation-array"> <latex> <xsl:text>\begin{eqnarray*} </xsl:text> <xsl:apply-templates/> <xsl:text> \end{eqnarray*}</xsl:text> </latex> <html> <TABLE CLASS="equation" BORDER="0" ALIGN="CENTER"><xsl:apply-templates/></TABLE> </html> </template> <!-- No, don't put in an alias, because you'd also need one for eqnarray//row. <xsl:template match="eqnarray"><xsl:call-template name="equation-array"/></xsl:template> --> <!-- Hmm, LaTeX uses & as separators: how do we know if there's another cell coming? Ah, but the LaTeX eqnarray can have no more than three columns, so there's no need to generalise. --> <template match="equation-array/row"> <latex> <xsl:apply-templates select="left"/><xsl:text disable-output-escaping="yes"> & </xsl:text><xsl:apply-templates select="middle"/><xsl:text disable-output-escaping="yes"> & </xsl:text><xsl:apply-templates select="right"/><xsl:text> \\ \\ </xsl:text> </latex> <html> <TR><TD ALIGN="RIGHT"><xsl:apply-templates select="left"/></TD><TD ALIGN="CENTER"><xsl:apply-templates select="middle"/></TD><TD ALIGN="LEFT"><xsl:apply-templates select="right"/></TD></TR> </html> </template> <!-- Digit grouping separator character for large numbers. --> <template name="digit-group-separator" match="digit-group-separator"> <common> <xsl:call-template name="non-breaking-space"/> </common> </template> <alias source="digitsep" target="digit-group-separator"/> <!-- Super- and subscript. --> <template name="superscript" match="math//superscript"> <latex>^{<xsl:apply-templates/>}</latex> <html><SUP><xsl:apply-templates/></SUP></html> </template> <template name="subscript" match="math//subscript"> <latex>_{<xsl:apply-templates/>}</latex> <html><SUB><xsl:apply-templates/></SUB></html> </template> <!-- Basic mathematical operators. --> <template name="plus-operator" match="math//plus"> <common>+</common> </template> <template name="minus-operator" match="math//minus"> <common>-</common> </template> <template name="times-operator" match="math//times"> <latex>\times</latex> <html><xsl:text disable-output-escaping="yes"> &#215; </xsl:text></html> </template> <alias source="times" target="times-operator"/> <template name="divide-operator" match="math//divide"> <common>/</common> </template> <template name="equals-operator" match="math//equals"> <common> = </common> </template> <!-- The equivalent of LaTeX's "log-like functions". @name: The name of the function. We assume the names used by LaTeX here, as they work out correct anyway. There's actually nothing to stop you using any name you like, except that it'll probably die horribly in LaTeX :) [required] --> <template name="log-like-function" match="math//function"> <latex>\<xsl:value-of select="@name"/></latex> <html><xsl:value-of select="@name"/></html> </template> <!-- Any mathematical variable names. --> <template name="math-variable" match="math//variable"> <latex><xsl:apply-templates/></latex> <html><I><xsl:apply-templates/></I></html> </template> <!-- A displayed fraction. Is there a nicer way of doing this in HTML? --> <template name="math-fraction" match="math//fraction"> <latex>\frac{<xsl:apply-templates select="numerator"/>}{<xsl:apply-templates select="denominator"/>}</latex> <html><xsl:apply-templates select="numerator"/><BIG> / </BIG><xsl:apply-templates select="denominator"/></html> </template> </stylesheet>
Ignore Space
Show notes
View
xml2html.xsl
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl-out:stylesheet xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl-out:strip-space elements="*"/><xsl-out:param name="department">INFO</xsl-out:param><xsl-out:param name="paper"/><xsl-out:output method="html" encoding="ISO-8859-1" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/><xsl-out:template match="/document"><xsl-out:comment> THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:comment><HTML><HEAD><LINK REL="Stylesheet" HREF="http://info-nts-05.otago.ac.nz/info321/styles.css" TYPE="text/css"/><TITLE><xsl-out:apply-templates select="title" mode="preamble"/></TITLE></HEAD><BODY><xsl-out:apply-templates/><HR/><ADDRESS><xsl-out:apply-templates select="copyright"/><xsl-out:apply-templates select="document-metadata/cvs-id"/></ADDRESS></BODY></HTML></xsl-out:template> <xsl-out:template name="PaperCode" match="PaperCode"> <xsl:value-of select="$department" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&nbsp;</xsl:text> <xsl:value-of select="$paper" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="OracleServer" match="OracleServer">Oracle9<I xmlns:xsl="http://www.w3.org/1999/XSL/Transform">i</I></xsl-out:template> <xsl-out:template name="paragraph" match="paragraph"><P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template> <xsl-out:template name="para" match="para"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="p" match="p"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="newline" match="newline"><BR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="page-break" match="page-break"/> <xsl-out:template name="new-page" match="new-page"><xsl-out:call-template name="page-break"/></xsl-out:template> <xsl-out:template name="non-breaking-space" match="non-breaking-space"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&nbsp;</xsl:text></xsl-out:template> <xsl-out:template name="nbsp" match="nbsp"><xsl-out:call-template name="non-breaking-space"/></xsl-out:template> <xsl-out:template name="ellipsis-sign" match="ellipsis-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8230;</xsl:text></xsl-out:template> <xsl-out:template name="etc" match="etc"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="ellipsis" match="ellipsis"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="dots" match="dots"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="endash" match="endash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8211;</xsl:text></xsl-out:template> <xsl-out:template name="en-dash" match="en-dash"><xsl-out:call-template name="endash"/></xsl-out:template> <xsl-out:template name="emdash" match="emdash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8212;</xsl:text></xsl-out:template> <xsl-out:template name="em-dash" match="em-dash"><xsl-out:call-template name="emdash"/></xsl-out:template> <xsl-out:template name="apostrophe" match="apostrophe"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8217;</xsl:text></xsl-out:template> <xsl-out:template name="dollar" match="dollar">$</xsl-out:template> <xsl-out:template name="percent-sign" match="percent-sign">%</xsl-out:template> <xsl-out:template name="ampersand" match="ampersand"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;</xsl:text></xsl-out:template> <xsl-out:template name="trademark-sign" match="trademark-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8482;</xsl:text></xsl-out:template> <xsl-out:template name="trademark" match="trademark"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="TM" match="TM"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="copyright-sign" match="copyright-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#169;</xsl:text></xsl-out:template> <xsl-out:template name="degree-sign" match="degree-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#176;</xsl:text></xsl-out:template> <xsl-out:template name="degrees" match="degrees"><xsl-out:call-template name="degree-sign"/></xsl-out:template> <xsl-out:template name="section-sign" match="section-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#167;</xsl:text></xsl-out:template> <xsl-out:template name="paragraph-sign" match="paragraph-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#182;</xsl:text></xsl-out:template> <xsl-out:template name="pi-math" match="pi" mode="math"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#960;</xsl:text></xsl-out:template> <xsl-out:template name="pi-normal" match="pi"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#960;</xsl:text></xsl-out:template> <xsl-out:template name="LaTeX" match="LaTeX">L<SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform">A</SUP>T<SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform">E</SUB>X</xsl-out:template> <xsl-out:template name="latex" match="latex"><xsl-out:call-template name="LaTeX"/></xsl-out:template> <xsl-out:template name="menu-separator" match="menu-separator"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8594;</xsl:text></xsl-out:template> <xsl-out:template name="menusep" match="menusep"><xsl-out:call-template name="menu-separator"/></xsl-out:template> <xsl-out:template name="menu-item" match="menu/item"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template> <xsl-out:template name="emph" match="emph"><EM xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></EM></xsl-out:template> <xsl-out:template name="italic" match="italic"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="strong" match="strong"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template> <xsl-out:template name="bold" match="bold"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template> <xsl-out:template name="term" match="term"><I CLASS="term" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="foreign" match="foreign"><I CLASS="foreign" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="code" match="code"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template> <xsl-out:template name="code-block" match="code-block"> <PRE CLASS="code" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE> </xsl-out:template> <xsl-out:template name="verbatim" match="verbatim"> <PRE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE> </xsl-out:template> <xsl-out:template name="single-quote" match="quote[@single='yes']"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8216;</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8217;</xsl:text> </xsl-out:template> <xsl-out:template name="double-quote" match="quote"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8220;</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8221;</xsl:text> </xsl-out:template> <xsl-out:template name="nested-double-quote" match="quote//quote"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="q" match="q"><xsl-out:call-template name="single-quote"/></xsl-out:template> <xsl-out:template name="qq" match="qq"><xsl-out:call-template name="double-quote"/></xsl-out:template> <xsl-out:template name="itemised-list" match="itemised-list"> <UL xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </UL> </xsl-out:template> <xsl-out:template name="itemize" match="itemize"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="unordered-list" match="unordered-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bulleted-list" match="bulleted-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-list" match="bullet-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-points" match="bullet-points"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="enumerated-list" match="enumerated-list"> <OL xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </OL> </xsl-out:template> <xsl-out:template name="enumerate" match="enumerate"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="ordered-list" match="ordered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="numbered-list" match="numbered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="question-list" match="question-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="definition-list" match="definition-list"> <!-- Hmm, <DL>s in HTML tend to come out with the spacing a bit wrong (or maybe it's just my browser?). Might using a table be better? Messy if the keyword is long, though, and you don't get a proper hanging indent... Maybe this is something that could be handled in CSS instead. --> <DL xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </DL> <!-- <TABLE BORDER="0" CELLPADDING="10"> --> <!-- <xsl:apply-templates/> --> <!-- </TABLE> --> </xsl-out:template> <xsl-out:template name="description-list" match="description-list"><xsl-out:call-template name="definition-list"/></xsl-out:template> <xsl-out:template name="item" match="item"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="count(paragraph|para|p) != 0"> <LI><xsl:apply-templates/></LI> </xsl:when> <xsl:otherwise> <LI><P><xsl:apply-templates/></P></LI> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="definition-item" match="definition-list/item"> <DT xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><P><xsl:apply-templates select="keyword"/></P></DT> <DD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="definition|description|discourse"/></DD> <!-- <TR VALIGN="TOP"> --> <!-- <TD><P><xsl:apply-templates select="keyword"/></P></TD> --> <!-- <TD><xsl:apply-templates select="definition|description|discourse"/></TD> --> <!-- </TR> --> </xsl-out:template> <xsl-out:template name="keyword" match="keyword"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template> <xsl-out:template name="topic" match="topic"><xsl-out:call-template name="keyword"/></xsl-out:template> <xsl-out:template name="definition" match="item/definition|item/description|item/discourse"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="count(paragraph|para|p) != 0"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> <P><xsl:apply-templates/></P> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="section" match="section"> <xsl:if test="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><A NAME="{@label}"/></xsl:if> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <!-- Since HTML doesn't really support footnotes as such, include them as "section notes" instead. --> <xsl:if test="count(.//footnote) > 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <P><STRONG>Notes:</STRONG></P> <xsl:apply-templates select=".//footnote" mode="list"/> </xsl:if> </xsl-out:template> <xsl-out:template name="footnote" match="footnote"> <A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> </xsl-out:template> <xsl-out:template name="footnote-list" match="footnote" mode="list"> <P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <A> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> <xsl:text> </xsl:text> <xsl:apply-templates/> <xsl:text> </xsl:text> <!-- Provide a back link to the original footnote marker. --> <A> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:text>[Back]</xsl:text> </A> </P> </xsl-out:template> <xsl-out:template name="preamble-title" match="document/title" mode="preamble"> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="preamble-author" match="document/author" mode="preamble"/> <xsl-out:template name="preamble-date" match="document/date" mode="preamble"/> <xsl-out:template name="document-title" match="document/title"> <H1 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></H1> </xsl-out:template> <xsl-out:template name="document-author" match="document/author"/> <xsl-out:template name="document-date" match="document/date"/> <xsl-out:template name="generate-subs"/> <xsl-out:template name="section-title" match="section/title"> <!-- The depth is used in a couple of places, so we pre-calculate it. --> <xsl:variable name="depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:number value="1 + count(ancestor::section)"/> <xsl:if test="1 + count(ancestor::section) > 6">6</xsl:if> </xsl:variable> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">></xsl:text> <xsl:number count="section" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">></xsl:text> </xsl-out:template> <xsl-out:template name="quotation" match="quotation"> <P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <I><xsl:apply-templates/></I> </P> </xsl-out:template> <xsl-out:template name="metadata" match="metadata"/> <xsl-out:template name="omit" match="omit"/> <xsl-out:template name="comment" match="comment"> <xsl:comment xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </xsl:comment> </xsl-out:template> <xsl-out:template name="tabular" match="tabular"> <TABLE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="BORDER"> <xsl:value-of select="@border"/> <xsl:if test="not(@border)">0</xsl:if> </xsl:attribute> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <!-- Note different ordering of tabular components: HTML requires THEAD and TFOOT to precede TBODY. --> <xsl:apply-templates select="tabular-header"/> <xsl:apply-templates select="tabular-footer"/> <xsl:apply-templates select="tabular-body"/> </TABLE> </xsl-out:template> <xsl-out:template name="aligned-column" match="column[@align]"/> <xsl-out:template name="unaligned-column" match="column[not(@align)]"/> <xsl-out:template name="tabular-header" match="tabular-header"> <THEAD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </THEAD> </xsl-out:template> <xsl-out:template name="tabular-footer" match="tabular-footer"> <TFOOT xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </TFOOT> </xsl-out:template> <xsl-out:template name="tabular-body" match="tabular-body"> <TBODY xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </TBODY> </xsl-out:template> <xsl-out:template name="row" match="row"> <TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </TR> </xsl-out:template> <xsl-out:template name="row-rule-full" match="row-rule[not(@columns)]"/> <xsl-out:template name="row-rule-partial" match="row-rule[@columns]"/> <xsl-out:template name="multirow-cell" match="cell" mode="multi-row"/> <xsl-out:template name="multicolumn-cell" match="cell" mode="multi-column"/> <xsl-out:template match="cell"> <!-- position() doesn't seem to work very well in this context. --> <xsl:variable name="column-no" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:number/></xsl:variable> <TD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> <xsl:if test="not(@align)"> <xsl:value-of select="ancestor::tabular/columns/column[position() = $column-no]/@align"/> <xsl:if test="not(ancestor::tabular/columns/column[position() = $column-no]/@align)">left</xsl:if> </xsl:if> </xsl:attribute> <xsl:attribute name="COLSPAN"> <xsl:value-of select="@columns"/> <xsl:if test="not(@columns)">1</xsl:if> </xsl:attribute> <xsl:attribute name="ROWSPAN"> <xsl:value-of select="@rows"/> <xsl:if test="not(@rows)">1</xsl:if> </xsl:attribute> <xsl:apply-templates/> </TD> </xsl-out:template> <xsl-out:template name="hyperlink-label" match="hyperlink[@label]"><A HREF="#{@label}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template> <xsl-out:template name="hyperlink-url" match="hyperlink[@url and node()]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template> <xsl-out:template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><CODE><xsl:value-of select="@url"/></CODE></A></xsl-out:template> <xsl-out:template name="url" match="url"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template> <xsl-out:template name="uri" match="uri"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email" match="email"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email-address" match="email-address"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="reference" match="reference"> <!-- Find the element whose label is the same as our label. --> <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="section-reference" match="section" mode="reference"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Section&#160;</xsl:text> <xsl:number count="figure" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="figure-reference" match="figure" mode="reference"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure&#160;</xsl:text> <xsl:number count="figure" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="table-reference" match="table" mode="reference"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table&#160;</xsl:text> <xsl:number count="table" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="figure" match="figure"> <DIV CLASS="figure" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:if test="@label"><A NAME="{@label}"/></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </xsl-out:template> <xsl-out:template name="table" match="table"> <DIV CLASS="table" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:if test="@label"><A NAME="{@label}"/></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </xsl-out:template> <xsl-out:template name="figure-caption" match="figure/caption"> <STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure <xsl:number count="figure" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="table-caption" match="table/caption"> <STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table <xsl:number count="table" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template match="image" mode="latex"/> <xsl-out:template match="image[count(provide-large-version) = 0]"> <IMG BORDER="0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="SRC"> <xsl:choose> <xsl:when test="(name(/child::node()[1])='tutorial') or (name(/child::node()[1])='laboratory')"> <xsl:text>Graphics/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-72dpi.png</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"><xsl:apply-templates select="description"/></xsl:attribute> </IMG> </xsl-out:template> <xsl-out:template match="image[count(provide-large-version) != 0]"> <A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="HREF"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-zoom.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"> <xsl:apply-templates select="description"/> </xsl:attribute> </IMG> <BR CLEAR="right"/> <xsl:text>(Larger version)</xsl:text> </A> </xsl-out:template> <xsl-out:template name="include-xml" match="include-document"> <xsl:apply-templates select="document(@file)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="environment" match="environment[@file]"/> <xsl-out:template name="latex-package" match="latex-packages/package"/> <xsl-out:template name="latex-command" match="latex-packages/command"/> <xsl-out:template name="raw-latex" match="raw-code[@format = 'latex']"/> <xsl-out:template name="raw-html" match="raw-code[@format = 'html']"><xsl:copy-of select="*" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="latex-input" match="latex-input"/> <xsl-out:template name="process-when-latex" match="process-when[@format = 'latex']"/> <xsl-out:template name="process-when-html" match="process-when[@format = 'html']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-inline" match="paragraph//math|para//math|p//math"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-display" match="math"><P ALIGN="center" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template> <xsl-out:template name="equation-array" match="equation-array"> <TABLE CLASS="equation" BORDER="0" ALIGN="CENTER" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></TABLE> </xsl-out:template> <xsl-out:template match="equation-array/row"> <TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><TD ALIGN="RIGHT"><xsl:apply-templates select="left"/></TD><TD ALIGN="CENTER"><xsl:apply-templates select="middle"/></TD><TD ALIGN="LEFT"><xsl:apply-templates select="right"/></TD></TR> </xsl-out:template> <xsl-out:template name="digit-group-separator" match="digit-group-separator"> <xsl:call-template name="non-breaking-space" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="digitsep" match="digitsep"><xsl-out:call-template name="digit-group-separator"/></xsl-out:template> <xsl-out:template name="superscript" match="math//superscript"><SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUP></xsl-out:template> <xsl-out:template name="subscript" match="math//subscript"><SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUB></xsl-out:template> <xsl-out:template name="plus-operator" match="math//plus">+</xsl-out:template> <xsl-out:template name="minus-operator" match="math//minus">-</xsl-out:template> <xsl-out:template name="times-operator" match="math//times"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> &#215; </xsl:text></xsl-out:template> <xsl-out:template name="times" match="times"><xsl-out:call-template name="times-operator"/></xsl-out:template> <xsl-out:template name="divide-operator" match="math//divide">/</xsl-out:template> <xsl-out:template name="equals-operator" match="math//equals"> = </xsl-out:template> <xsl-out:template name="approximately-equals-operator" match="approximately-equals-operator"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">≈</xsl:text></xsl-out:template> <xsl-out:template name="approximately-equals" match="approximately-equals"><xsl-out:call-template name="approximately-equals-operator"/></xsl-out:template> <xsl-out:template name="approximately-equal-to" match="approximately-equal-to"><xsl-out:call-template name="approximately-equals-operator"/></xsl-out:template> <xsl-out:template name="log-like-function" match="math//function"><xsl:value-of select="@name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-variable" match="math//variable"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="math-fraction" match="math//fraction"><xsl:apply-templates select="numerator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><BIG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> / </BIG><xsl:apply-templates select="denominator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> </xsl-out:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl-out:stylesheet xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl-out:strip-space elements="*"/><xsl-out:param name="department">INFO</xsl-out:param><xsl-out:param name="paper"/><xsl-out:output method="html" encoding="ISO-8859-1" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/><xsl-out:template match="/document"><xsl-out:comment> THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:comment><HTML><HEAD><LINK REL="Stylesheet" HREF="http://info-nts-05.otago.ac.nz/info321/styles.css" TYPE="text/css"/><TITLE><xsl-out:apply-templates select="title" mode="preamble"/></TITLE></HEAD><BODY><xsl-out:apply-templates/><HR/><ADDRESS><xsl-out:apply-templates select="copyright"/><xsl-out:apply-templates select="id/cvs-id"/></ADDRESS></BODY></HTML></xsl-out:template> <xsl-out:template name="PaperCode" match="PaperCode"> <xsl:value-of select="$department" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&nbsp;</xsl:text> <xsl:value-of select="$paper" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="OracleServer" match="OracleServer">Oracle9<I xmlns:xsl="http://www.w3.org/1999/XSL/Transform">i</I></xsl-out:template> <xsl-out:template name="paragraph" match="paragraph"><P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template> <xsl-out:template name="para" match="para"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="p" match="p"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="newline" match="newline"><BR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="page-break" match="page-break"/> <xsl-out:template name="new-page" match="new-page"><xsl-out:call-template name="page-break"/></xsl-out:template> <xsl-out:template name="non-breaking-space" match="non-breaking-space"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&nbsp;</xsl:text></xsl-out:template> <xsl-out:template name="nbsp" match="nbsp"><xsl-out:call-template name="non-breaking-space"/></xsl-out:template> <xsl-out:template name="ellipsis-sign" match="ellipsis-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8230;</xsl:text></xsl-out:template> <xsl-out:template name="etc" match="etc"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="ellipsis" match="ellipsis"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="dots" match="dots"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="endash" match="endash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8211;</xsl:text></xsl-out:template> <xsl-out:template name="en-dash" match="en-dash"><xsl-out:call-template name="endash"/></xsl-out:template> <xsl-out:template name="emdash" match="emdash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8212;</xsl:text></xsl-out:template> <xsl-out:template name="em-dash" match="em-dash"><xsl-out:call-template name="emdash"/></xsl-out:template> <xsl-out:template name="apostrophe" match="apostrophe"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8217;</xsl:text></xsl-out:template> <xsl-out:template name="dollar" match="dollar">$</xsl-out:template> <xsl-out:template name="percent-sign" match="percent-sign">%</xsl-out:template> <xsl-out:template name="ampersand" match="ampersand"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;</xsl:text></xsl-out:template> <xsl-out:template name="trademark-sign" match="trademark-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8482;</xsl:text></xsl-out:template> <xsl-out:template name="trademark" match="trademark"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="TM" match="TM"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="copyright-sign" match="copyright-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#169;</xsl:text></xsl-out:template> <xsl-out:template name="degree-sign" match="degree-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#176;</xsl:text></xsl-out:template> <xsl-out:template name="degrees" match="degrees"><xsl-out:call-template name="degree-sign"/></xsl-out:template> <xsl-out:template name="section-sign" match="section-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#167;</xsl:text></xsl-out:template> <xsl-out:template name="paragraph-sign" match="paragraph-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#182;</xsl:text></xsl-out:template> <xsl-out:template name="pi" match="pi"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#960;</xsl:text></xsl-out:template> <xsl-out:template name="LaTeX" match="LaTeX">L<SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform">A</SUP>T<SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform">E</SUB>X</xsl-out:template> <xsl-out:template name="latex" match="latex"><xsl-out:call-template name="LaTeX"/></xsl-out:template> <xsl-out:template name="menu-separator" match="menu-separator"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8594;</xsl:text></xsl-out:template> <xsl-out:template name="menusep" match="menusep"><xsl-out:call-template name="menu-separator"/></xsl-out:template> <xsl-out:template name="menu-item" match="menu/item"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template> <xsl-out:template name="emph" match="emph"><EM xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></EM></xsl-out:template> <xsl-out:template name="italic" match="italic"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="strong" match="strong"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template> <xsl-out:template name="bold" match="bold"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template> <xsl-out:template name="term" match="term"><I CLASS="term" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="foreign" match="foreign"><I CLASS="foreign" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="code" match="code"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template> <xsl-out:template name="code-block" match="code-block"> <PRE CLASS="code" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE> </xsl-out:template> <xsl-out:template name="verbatim" match="verbatim"> <PRE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE> </xsl-out:template> <xsl-out:template name="single-quote" match="quote[@single='yes']"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8216;</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8217;</xsl:text> </xsl-out:template> <xsl-out:template name="double-quote" match="quote"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8220;</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&#8221;</xsl:text> </xsl-out:template> <xsl-out:template name="nested-double-quote" match="quote//quote"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="q" match="q"><xsl-out:call-template name="single-quote"/></xsl-out:template> <xsl-out:template name="qq" match="qq"><xsl-out:call-template name="double-quote"/></xsl-out:template> <xsl-out:template name="itemised-list" match="itemised-list"> <UL xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </UL> </xsl-out:template> <xsl-out:template name="itemize" match="itemize"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="unordered-list" match="unordered-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bulleted-list" match="bulleted-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-list" match="bullet-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-points" match="bullet-points"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="enumerated-list" match="enumerated-list"> <OL xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </OL> </xsl-out:template> <xsl-out:template name="enumerate" match="enumerate"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="ordered-list" match="ordered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="numbered-list" match="numbered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="question-list" match="question-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="definition-list" match="definition-list"> <!-- Hmm, <DL>s in HTML tend to come out with the spacing a bit wrong (or maybe it's just my browser?). Might using a table be better? Messy if the keyword is long, though, and you don't get a proper hanging indent... Maybe this is something thaty could be handled in CSS instead. --> <DL xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </DL> <!-- <TABLE BORDER="0" CELLPADDING="10"> --> <!-- <xsl:apply-templates/> --> <!-- </TABLE> --> </xsl-out:template> <xsl-out:template name="description-list" match="description-list"><xsl-out:call-template name="definition-list"/></xsl-out:template> <xsl-out:template name="item" match="item"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="count(paragraph|para|p) != 0"> <LI><xsl:apply-templates/></LI> </xsl:when> <xsl:otherwise> <LI><P><xsl:apply-templates/></P></LI> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="definition-item" match="definition-list/item"> <DT xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><P><xsl:apply-templates select="keyword"/></P></DT> <DD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="definition|description|discourse"/></DD> <!-- <TR VALIGN="TOP"> --> <!-- <TD><P><xsl:apply-templates select="keyword"/></P></TD> --> <!-- <TD><xsl:apply-templates select="definition|description|discourse"/></TD> --> <!-- </TR> --> </xsl-out:template> <xsl-out:template name="keyword" match="keyword"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template> <xsl-out:template name="topic" match="topic"><xsl-out:call-template name="keyword"/></xsl-out:template> <xsl-out:template name="definition" match="item/definition|item/description|item/discourse"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="count(paragraph|para|p) != 0"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> <P><xsl:apply-templates/></P> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="section" match="section"> <xsl:if test="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><A NAME="{@label}"/></xsl:if> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:if test="count(.//footnote) > 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <P><STRONG>Notes:</STRONG></P> <xsl:apply-templates select=".//footnote" mode="list"/> </xsl:if> </xsl-out:template> <xsl-out:template name="footnote" match="footnote"> <A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> </xsl-out:template> <xsl-out:template name="footnote-list" match="footnote" mode="list"> <P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <A> <xsl:attribute name="NAME"> <xsl:text>footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-target</xsl:text> </xsl:attribute> <xsl:text>[</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>]</xsl:text> </A> <xsl:text> </xsl:text> <xsl:apply-templates/> <xsl:text> </xsl:text> <A> <xsl:attribute name="HREF"> <xsl:text>#footnote-</xsl:text> <xsl:number level="any" count="footnote"/> <xsl:text>-source</xsl:text> </xsl:attribute> <xsl:text>[Back]</xsl:text> </A> </P> </xsl-out:template> <xsl-out:template name="preamble-title" match="document/title" mode="preamble"> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="preamble-author" match="document/author" mode="preamble"/> <xsl-out:template name="preamble-date" match="document/date" mode="preamble"/> <xsl-out:template name="document-title" match="document/title"> <H1 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></H1> </xsl-out:template> <xsl-out:template name="document-author" match="document/author"/> <xsl-out:template name="document-date" match="document/date"/> <xsl-out:template name="generate-subs"/> <xsl-out:template name="section-title" match="section/title"> <xsl:variable name="depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:number value="1 + count(ancestor::section)"/> <xsl:if test="1 + count(ancestor::section) > 6">6</xsl:if> </xsl:variable> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">></xsl:text> <xsl:number count="section" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"></H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">></xsl:text> </xsl-out:template> <xsl-out:template name="quotation" match="quotation"> <P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <I><xsl:apply-templates/></I> </P> </xsl-out:template> <xsl-out:template name="id" match="id"/> <xsl-out:template name="omit" match="omit"/> <xsl-out:template name="comment" match="comment"> <xsl:comment xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </xsl:comment> </xsl-out:template> <xsl-out:template name="tabular" match="tabular"> <TABLE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="BORDER"> <xsl:value-of select="@border"/> <xsl:if test="not(@border)">0</xsl:if> </xsl:attribute> <xsl:if test="@align"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> <!-- Note different ordering of tabular components: HTML requires THEAD and TFOOT to precede TBODY. --> <xsl:apply-templates select="tabular-header"/> <xsl:apply-templates select="tabular-footer"/> <xsl:apply-templates select="tabular-body"/> </TABLE> </xsl-out:template> <xsl-out:template name="aligned-column" match="column[@align]"/> <xsl-out:template name="unaligned-column" match="column[not(@align)]"/> <xsl-out:template name="tabular-header" match="tabular-header"> <THEAD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </THEAD> </xsl-out:template> <xsl-out:template name="tabular-footer" match="tabular-footer"> <TFOOT xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </TFOOT> </xsl-out:template> <xsl-out:template name="tabular-body" match="tabular-body"> <TBODY xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </TBODY> </xsl-out:template> <xsl-out:template name="row" match="row"> <TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:apply-templates/> </TR> </xsl-out:template> <xsl-out:template name="row-rule-full" match="row-rule[not(@columns)]"/> <xsl-out:template name="row-rule-partial" match="row-rule[@columns]"/> <xsl-out:template match="cell" mode="multi-row"/> <xsl-out:template match="cell" mode="multi-column"/> <xsl-out:template match="cell"> <!-- position() doesn't seem to work very well in this context --> <xsl:variable name="column-no" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:number/></xsl:variable> <TD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="ALIGN"> <xsl:value-of select="@align"/> <xsl:if test="not(@align)"> <xsl:value-of select="ancestor::tabular/columns/column[position() = $column-no]/@align"/> <xsl:if test="not(ancestor::tabular/columns/column[position() = $column-no]/@align)">left</xsl:if> </xsl:if> </xsl:attribute> <xsl:attribute name="COLSPAN"> <xsl:value-of select="@columns"/> <xsl:if test="not(@columns)">1</xsl:if> </xsl:attribute> <xsl:attribute name="ROWSPAN"> <xsl:value-of select="@rows"/> <xsl:if test="not(@rows)">1</xsl:if> </xsl:attribute> <xsl:apply-templates/> </TD> </xsl-out:template> <xsl-out:template name="hyperlink-label" match="hyperlink[@label]"><A HREF="#{@label}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template> <xsl-out:template name="hyperlink-url" match="hyperlink[@url and node()]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template> <xsl-out:template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><CODE><xsl:value-of select="@url"/></CODE></A></xsl-out:template> <xsl-out:template name="url" match="url"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template> <xsl-out:template name="uri" match="uri"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email" match="email"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email-address" match="email-address"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="reference" match="reference"> <!-- Find the element whose label is the same as our label. --> <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="section-reference" match="section" mode="reference"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Section&#160;</xsl:text> <xsl:number count="figure" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="figure-reference" match="figure" mode="reference"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure&#160;</xsl:text> <xsl:number count="figure" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="table-reference" match="table" mode="reference"> <xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table&#160;</xsl:text> <xsl:number count="table" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="figure" match="figure"> <DIV CLASS="figure" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:if test="@label"><A NAME="{@label}"/></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </xsl-out:template> <xsl-out:template name="table" match="table"> <DIV CLASS="table" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:if test="@label"><A NAME="{@label}"/></xsl:if> <xsl:apply-templates select="*[not(self::caption)]"/> <xsl:if test="count(caption) != 0"> <BR/> <xsl:apply-templates select="caption"/> </xsl:if> </DIV> </xsl-out:template> <xsl-out:template name="figure-caption" match="figure/caption"> <STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure <xsl:number count="figure" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="table-caption" match="table/caption"> <STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table <xsl:number count="table" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template match="image" mode="latex"/> <xsl-out:template match="image[count(provide-large-version) = 0]"> <IMG BORDER="0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="SRC"> <xsl:choose> <xsl:when test="(name(/child::node()[1])='tutorial') or (name(/child::node()[1])='laboratory')"> <xsl:text>Graphics/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-72dpi.png</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"><xsl:apply-templates select="description"/></xsl:attribute> </IMG> </xsl-out:template> <xsl-out:template match="image[count(provide-large-version) != 0]"> <A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:attribute name="HREF"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>-zoom.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:text>images/</xsl:text> <xsl:value-of select="basename"/> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:text>png</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="ALT"> <xsl:apply-templates select="description"/> </xsl:attribute> </IMG> <BR CLEAR="right"/> <xsl:text>(Larger version)</xsl:text> </A> </xsl-out:template> <xsl-out:template name="include-xml" match="include-document"> <xsl:apply-templates select="document(@file)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="environment" match="environment[@file]"/> <xsl-out:template name="latex-package" match="latex-packages/package"/> <xsl-out:template name="latex-command" match="latex-packages/command"/> <xsl-out:template name="raw-latex" match="raw-code[@format = 'latex']"/> <xsl-out:template name="raw-html" match="raw-code[@format = 'html']"><xsl:copy-of select="*" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="latex-input" match="latex-input"/> <xsl-out:template name="process-when-latex" match="process-when[@format = 'latex']"/> <xsl-out:template name="process-when-html" match="process-when[@format = 'html']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-inline" match="paragraph//math|para//math|p//math"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-display" match="math"><P ALIGN="center" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template> <xsl-out:template name="equation-array" match="equation-array"> <TABLE CLASS="equation" BORDER="0" ALIGN="CENTER" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></TABLE> </xsl-out:template> <xsl-out:template match="equation-array/row"> <TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><TD ALIGN="RIGHT"><xsl:apply-templates select="left"/></TD><TD ALIGN="CENTER"><xsl:apply-templates select="middle"/></TD><TD ALIGN="LEFT"><xsl:apply-templates select="right"/></TD></TR> </xsl-out:template> <xsl-out:template name="digit-group-separator" match="digit-group-separator"> <xsl:call-template name="non-breaking-space" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="digitsep" match="digitsep"><xsl-out:call-template name="digit-group-separator"/></xsl-out:template> <xsl-out:template name="superscript" match="math//superscript"><SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUP></xsl-out:template> <xsl-out:template name="subscript" match="math//subscript"><SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUB></xsl-out:template> <xsl-out:template name="plus-operator" match="math//plus">+</xsl-out:template> <xsl-out:template name="minus-operator" match="math//minus">-</xsl-out:template> <xsl-out:template name="times-operator" match="math//times"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> &#215; </xsl:text></xsl-out:template> <xsl-out:template name="times" match="times"><xsl-out:call-template name="times-operator"/></xsl-out:template> <xsl-out:template name="divide-operator" match="math//divide">/</xsl-out:template> <xsl-out:template name="equals-operator" match="math//equals"> = </xsl-out:template> <xsl-out:template name="log-like-function" match="math//function"><xsl:value-of select="@name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-variable" match="math//variable"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template> <xsl-out:template name="math-fraction" match="math//fraction"><xsl:apply-templates select="numerator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><BIG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> / </BIG><xsl:apply-templates select="denominator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> </xsl-out:stylesheet>
Ignore Space
Show notes
View
xml2latex.xsl
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl-out:stylesheet xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl-out:strip-space elements="*"/><xsl-out:param name="department">INFO</xsl-out:param><xsl-out:param name="paper"/><xsl-out:output method="text" encoding="ISO-8859-1" media-type="text/plain"/><xsl-out:param name="image-format">pdf</xsl-out:param><xsl-out:param name="standalone">yes</xsl-out:param><xsl-out:template match="/document"><xsl-out:choose><xsl-out:when test="$standalone = 'yes'"> % THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! \documentclass[12pt,a4paper]{article} \usepackage[margin=1in]{geometry} \usepackage{mathpple} \usepackage{multirow} \usepackage{graphicx} <xsl-out:apply-templates select="document('environment.xml')/environment/latex-packages"/> \usepackage[pdftex]{hyperref} <xsl-out:apply-templates select="document('environment.xml')/environment/latex-commands"/><xsl-out:apply-templates select="title" mode="preamble"/><xsl-out:apply-templates select="author" mode="preamble"/><xsl-out:apply-templates select="date" mode="preamble"/> \begin{document} \maketitle <xsl-out:apply-templates/> \vfill {\scriptsize \hfill \verb+<xsl-out:apply-templates select="document-metadata/cvs-id"/>+} \end{document} </xsl-out:when><xsl-out:otherwise><xsl-out:apply-templates/></xsl-out:otherwise></xsl-out:choose></xsl-out:template> <xsl-out:template name="PaperCode" match="PaperCode"><xsl:value-of select="$department" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>~<xsl:value-of select="$paper" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="OracleServer" match="OracleServer">Oracle9\textit{i}</xsl-out:template> <xsl-out:template name="paragraph" match="paragraph"><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text><xsl:if test="@indent = 'no'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\noindent </xsl:if><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text></xsl-out:template> <xsl-out:template name="para" match="para"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="p" match="p"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="newline" match="newline"> \\</xsl-out:template> <xsl-out:template name="page-break" match="page-break">\newpage</xsl-out:template> <xsl-out:template name="new-page" match="new-page"><xsl-out:call-template name="page-break"/></xsl-out:template> <xsl-out:template name="non-breaking-space" match="non-breaking-space">~</xsl-out:template> <xsl-out:template name="nbsp" match="nbsp"><xsl-out:call-template name="non-breaking-space"/></xsl-out:template> <xsl-out:template name="ellipsis-sign" match="ellipsis-sign">{\ldots}</xsl-out:template> <xsl-out:template name="etc" match="etc"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="ellipsis" match="ellipsis"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="dots" match="dots"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="endash" match="endash">--</xsl-out:template> <xsl-out:template name="en-dash" match="en-dash"><xsl-out:call-template name="endash"/></xsl-out:template> <xsl-out:template name="emdash" match="emdash">---</xsl-out:template> <xsl-out:template name="em-dash" match="em-dash"><xsl-out:call-template name="emdash"/></xsl-out:template> <xsl-out:template name="apostrophe" match="apostrophe">'</xsl-out:template> <xsl-out:template name="dollar" match="dollar">\$</xsl-out:template> <xsl-out:template name="percent-sign" match="percent-sign">\%</xsl-out:template> <xsl-out:template name="ampersand" match="ampersand">\&</xsl-out:template> <xsl-out:template name="trademark-sign" match="trademark-sign">\texttrademark</xsl-out:template> <xsl-out:template name="trademark" match="trademark"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="TM" match="TM"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="copyright-sign" match="copyright-sign">\copyright</xsl-out:template> <xsl-out:template name="degree-sign" match="degree-sign">$^{\circ}$</xsl-out:template> <xsl-out:template name="degrees" match="degrees"><xsl-out:call-template name="degree-sign"/></xsl-out:template> <xsl-out:template name="section-sign" match="section-sign">{\S}</xsl-out:template> <xsl-out:template name="paragraph-sign" match="paragraph-sign">{\P}</xsl-out:template> <xsl-out:template name="pi-math" match="pi" mode="math">\pi</xsl-out:template> <xsl-out:template name="pi-normal" match="pi">$\pi$</xsl-out:template> <xsl-out:template name="LaTeX" match="LaTeX">{\LaTeX}</xsl-out:template> <xsl-out:template name="latex" match="latex"><xsl-out:call-template name="LaTeX"/></xsl-out:template> <xsl-out:template name="menu-separator" match="menu-separator">$\triangleright$</xsl-out:template> <xsl-out:template name="menusep" match="menusep"><xsl-out:call-template name="menu-separator"/></xsl-out:template> <xsl-out:template name="menu-item" match="menu/item">\menuitem{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="emph" match="emph">\emph{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="italic" match="italic">\textit{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="strong" match="strong">\textbf{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="bold" match="bold">\textbf{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="term" match="term">\term{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="foreign" match="foreign">\foreign{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="code" match="code">\verb+<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>+</xsl-out:template> <xsl-out:template name="code-block" match="code-block"> \begin{verbatim} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{verbatim} </xsl-out:template> <xsl-out:template name="verbatim" match="verbatim"> \begin{verbatim} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{verbatim} </xsl-out:template> <xsl-out:template name="single-quote" match="quote[@single='yes']">`<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'</xsl-out:template> <xsl-out:template name="double-quote" match="quote">``<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>''</xsl-out:template> <xsl-out:template name="nested-double-quote" match="quote//quote"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="q" match="q"><xsl-out:call-template name="single-quote"/></xsl-out:template> <xsl-out:template name="qq" match="qq"><xsl-out:call-template name="double-quote"/></xsl-out:template> <xsl-out:template name="itemised-list" match="itemised-list"> \begin{itemize} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{itemize} </xsl-out:template> <xsl-out:template name="itemize" match="itemize"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="unordered-list" match="unordered-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bulleted-list" match="bulleted-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-list" match="bullet-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-points" match="bullet-points"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="enumerated-list" match="enumerated-list"> \begin{enumerate} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{enumerate} </xsl-out:template> <xsl-out:template name="enumerate" match="enumerate"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="ordered-list" match="ordered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="numbered-list" match="numbered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="question-list" match="question-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="definition-list" match="definition-list"> \begin{description} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{description} </xsl-out:template> <xsl-out:template name="description-list" match="description-list"><xsl-out:call-template name="definition-list"/></xsl-out:template> <xsl-out:template name="item" match="item">\item <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="definition-item" match="definition-list/item">\item[<xsl:apply-templates select="keyword" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>] <xsl:apply-templates select="definition" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="keyword" match="keyword"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="topic" match="topic"><xsl-out:call-template name="keyword"/></xsl-out:template> <xsl-out:template name="definition" match="item/definition|item/description|item/discourse"/> <xsl-out:template name="section" match="section"> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:with-param name="label"> <xsl:value-of select="@label"/> <xsl:if test="not(@label)">THERE_IS_NO_LABEL</xsl:if> </xsl:with-param> </xsl:apply-templates> </xsl-out:template> <xsl-out:template name="footnote" match="footnote">\footnote{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="footnote-list" match="footnote" mode="list"/> <xsl-out:template name="preamble-title" match="document/title" mode="preamble">\title{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="preamble-author" match="document/author" mode="preamble">\author{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="preamble-date" match="document/date" mode="preamble">\date{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="document-title" match="document/title"><xsl:if test="$standalone = 'no'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="document-author" match="document/author"/> <xsl-out:template name="document-date" match="document/date"/> <xsl-out:template name="generate-subs"> <xsl:param name="depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">1</xsl:param> <xsl:if test="$depth > 1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:text>sub</xsl:text> <xsl:call-template name="generate-subs"> <xsl:with-param name="depth"><xsl:value-of select="$depth - 1"/></xsl:with-param> </xsl:call-template> </xsl:if> </xsl-out:template> <xsl-out:template name="section-title" match="section/title"> <xsl:param name="label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\</xsl:text> <!-- Generate the correct number of "sub"s for LaTeX. --> <xsl:call-template name="generate-subs" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:with-param name="depth"> <xsl:number value="count(ancestor::section)"/> <xsl:if test="count(ancestor::section) > 3">3</xsl:if> </xsl:with-param> </xsl:call-template> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">section{</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> <xsl:if test="$label != 'THERE_IS_NO_LABEL'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \label{<xsl:value-of select="$label"/>} </xsl:if> </xsl-out:template> <xsl-out:template name="quotation" match="quotation"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(@align = 'left') or (@align = 'right')"> \begin{flush<xsl:value-of select="@align"/>}\itshape <xsl:apply-templates/>\end{flush<xsl:value-of select="@align"/>} </xsl:when> <xsl:when test="@align = 'center'"> \begin{center}\itshape <xsl:apply-templates/>\end{center} </xsl:when> <xsl:otherwise> \begin{quote}\itshape <xsl:apply-templates/>\end{quote} </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="metadata" match="metadata"/> <xsl-out:template name="omit" match="omit"/> <xsl-out:template name="comment" match="comment"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \begin{comment}</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\end{comment} </xsl:text> </xsl-out:template> <xsl-out:template name="tabular" match="tabular"> <!-- Overall table alignment. --> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\begin{</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> \begin{tabular}{<xsl:apply-templates select="columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>} <xsl:apply-templates select="tabular-header" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:apply-templates select="tabular-body" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:apply-templates select="tabular-footer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{tabular} <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\end{</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template name="aligned-column" match="column[@align]"> <xsl:value-of select="@left-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:value-of select="substring(@align, 1, 1)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:value-of select="@right-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="unaligned-column" match="column[not(@align)]"> <xsl:value-of select="@left-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">l</xsl:text> <xsl:value-of select="@right-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="tabular-header" match="tabular-header"/> <xsl-out:template name="tabular-footer" match="tabular-footer"/> <xsl-out:template name="tabular-body" match="tabular-body"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="row" match="row"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \\<xsl:if test="@no-page-break = 'yes'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">*</xsl:if><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text></xsl-out:template> <xsl-out:template name="row-rule-full" match="row-rule[not(@columns)]"><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\hline </xsl:text></xsl-out:template> <xsl-out:template name="row-rule-partial" match="row-rule[@columns]">\cline{<xsl:value-of select="@columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="multirow-cell" match="cell" mode="multi-row"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\multirow{</xsl:text> <xsl:value-of select="@rows" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}{*}{</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template name="multicolumn-cell" match="cell" mode="multi-column"> <xsl:param name="num-columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">1</xsl:param> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\multicolumn{</xsl:text> <xsl:value-of select="$num-columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}{</xsl:text> <xsl:value-of select="@left-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="@align"> <xsl:value-of select="substring(@align, 1, 1)"/> </xsl:when> <xsl:otherwise> <xsl:text>l</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="@right-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}{</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template match="cell"> <!-- position() doesn't seem to work very well in this context. --> <xsl:variable name="column-no" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:number/></xsl:variable> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="@columns"> <xsl:apply-templates select="." mode="multi-column"> <xsl:with-param name="num-columns" select="@columns"/> </xsl:apply-templates> </xsl:when> <xsl:when test="@align"> <xsl:apply-templates select="." mode="multi-column"/> </xsl:when> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:if test="$column-no != last()" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> & </xsl:if> </xsl-out:template> <xsl-out:template name="hyperlink-label" match="hyperlink[@label]">\hyperref[<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>]{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="hyperlink-url" match="hyperlink[@url and node()]">\href{<xsl:value-of select="@url" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]">\href{<xsl:value-of select="@url" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}{\texttt{<xsl:value-of select="@url" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}}</xsl-out:template> <xsl-out:template name="url" match="url">\texttt{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="uri" match="uri"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email" match="email"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email-address" match="email-address"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="reference" match="reference"> <!-- Find the element whose label is the same as our label. --> <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="section-reference" match="section" mode="reference">Section~\ref*{<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="figure-reference" match="figure" mode="reference">Figure~\ref*{<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="table-reference" match="table" mode="reference">Table~\ref*{<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="figure" match="figure"> \begin{figure} \centering <xsl:apply-templates select="*[not(self::caption)]" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:if test="count(caption) != 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{figure} </xsl-out:template> <xsl-out:template name="table" match="table"> \begin{table} \centering <xsl:apply-templates select="*[not(self::caption)]" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:if test="count(caption) != 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{table} </xsl-out:template> <xsl-out:template name="figure-caption" match="figure/caption"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="table-caption" match="table/caption"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template match="image" mode="latex"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\includegraphics</xsl:text> <xsl:if test="count(latex-scaling) != 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:text>[scale=</xsl:text> <xsl:value-of select="latex-scaling"/> <xsl:text>]</xsl:text> </xsl:if> <!-- Use whatever standard image folder is appropriate for the context. --> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Could possibly change this to test="/document/@class = 'tutorial'" or similar? --> <xsl:when test="name(/child::node()[1])='tutorial'"> <xsl:text>{\tutroot/</xsl:text><xsl:value-of select="/tutorial/metadata/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/tutorial/metadata/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:when test="name(/child::node()[1])='laboratory'"> <xsl:text>{\labroot/</xsl:text><xsl:value-of select="/laboratory/metadata/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/laboratory/metadata/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>{images/</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="basename" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">.</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$image-format"/> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template match="image[count(provide-large-version) = 0]"><xsl:apply-templates select="." mode="latex" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template match="image[count(provide-large-version) != 0]"><xsl:apply-templates select="." mode="latex" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="include-xml" match="include-document"> <xsl:apply-templates select="document(@file)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="environment" match="environment[@file]"/> <xsl-out:template name="latex-package" match="latex-packages/package">\usepackage<xsl:if test="@options" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">[<xsl:value-of select="@options"/>]</xsl:if>{<xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="latex-command" match="latex-packages/command"><xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="raw-latex" match="raw-code[@format = 'latex']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="raw-html" match="raw-code[@format = 'html']"/> <xsl-out:template name="latex-input" match="latex-input">\input{<xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="process-when-latex" match="process-when[@format = 'latex']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="process-when-html" match="process-when[@format = 'html']"/> <xsl-out:template name="math-inline" match="paragraph//math|para//math|p//math">\(<xsl:apply-templates mode="math" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>\)</xsl-out:template> <xsl-out:template name="math-display" match="math">\[<xsl:apply-templates mode="math" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>\]</xsl-out:template> <xsl-out:template name="equation-array" match="equation-array"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\begin{eqnarray*} </xsl:text> <xsl:apply-templates mode="math" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \end{eqnarray*}</xsl:text> </xsl-out:template> <xsl-out:template match="equation-array/row"> <xsl:apply-templates select="left" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> & </xsl:text><xsl:apply-templates select="middle" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> & </xsl:text><xsl:apply-templates select="right" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \\ \\ </xsl:text> </xsl-out:template> <xsl-out:template name="digit-group-separator" match="digit-group-separator"> <xsl:call-template name="non-breaking-space" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="digitsep" match="digitsep"><xsl-out:call-template name="digit-group-separator"/></xsl-out:template> <xsl-out:template name="superscript" match="math//superscript">^{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="subscript" match="math//subscript">_{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="plus-operator" match="math//plus">+</xsl-out:template> <xsl-out:template name="minus-operator" match="math//minus">-</xsl-out:template> <xsl-out:template name="times-operator" match="math//times">\times</xsl-out:template> <xsl-out:template name="times" match="times"><xsl-out:call-template name="times-operator"/></xsl-out:template> <xsl-out:template name="divide-operator" match="math//divide">/</xsl-out:template> <xsl-out:template name="equals-operator" match="math//equals"> = </xsl-out:template> <xsl-out:template name="approximately-equals-operator" match="approximately-equals-operator">{\approx}</xsl-out:template> <xsl-out:template name="approximately-equals" match="approximately-equals"><xsl-out:call-template name="approximately-equals-operator"/></xsl-out:template> <xsl-out:template name="approximately-equal-to" match="approximately-equal-to"><xsl-out:call-template name="approximately-equals-operator"/></xsl-out:template> <xsl-out:template name="log-like-function" match="math//function">\<xsl:value-of select="@name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-variable" match="math//variable"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-fraction" match="math//fraction">\frac{<xsl:apply-templates select="numerator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}{<xsl:apply-templates select="denominator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> </xsl-out:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl-out:stylesheet xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl-out:strip-space elements="*"/><xsl-out:param name="department">INFO</xsl-out:param><xsl-out:param name="paper"/><xsl-out:output method="text" encoding="ISO-8859-1" media-type="text/plain"/><xsl-out:param name="image-format">pdf</xsl-out:param><xsl-out:param name="standalone">yes</xsl-out:param><xsl-out:template match="/document"><xsl-out:choose><xsl-out:when test="$standalone = 'yes'"> % THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! \documentclass[12pt,a4paper]{article} \usepackage[margin=1in]{geometry} \usepackage{mathpple} \usepackage{multirow} \usepackage{graphicx} <xsl-out:apply-templates select="document('environment.xml')/environment/latex-packages"/> \usepackage[pdftex]{hyperref} <xsl-out:apply-templates select="document('environment.xml')/environment/latex-commands"/><xsl-out:apply-templates select="title" mode="preamble"/><xsl-out:apply-templates select="author" mode="preamble"/><xsl-out:apply-templates select="date" mode="preamble"/> \begin{document} \maketitle <xsl-out:apply-templates/> \vfill {\scriptsize \hfill \verb+<xsl-out:apply-templates select="id/cvs-id"/>+} \end{document} </xsl-out:when><xsl-out:otherwise><xsl-out:apply-templates/></xsl-out:otherwise></xsl-out:choose></xsl-out:template> <xsl-out:template name="PaperCode" match="PaperCode"><xsl:value-of select="$department" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>~<xsl:value-of select="$paper" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="OracleServer" match="OracleServer">Oracle9\textit{i}</xsl-out:template> <xsl-out:template name="paragraph" match="paragraph"><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text><xsl:if test="@indent = 'no'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\noindent </xsl:if><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text></xsl-out:template> <xsl-out:template name="para" match="para"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="p" match="p"><xsl-out:call-template name="paragraph"/></xsl-out:template> <xsl-out:template name="newline" match="newline"> \\</xsl-out:template> <xsl-out:template name="page-break" match="page-break">\newpage</xsl-out:template> <xsl-out:template name="new-page" match="new-page"><xsl-out:call-template name="page-break"/></xsl-out:template> <xsl-out:template name="non-breaking-space" match="non-breaking-space">~</xsl-out:template> <xsl-out:template name="nbsp" match="nbsp"><xsl-out:call-template name="non-breaking-space"/></xsl-out:template> <xsl-out:template name="ellipsis-sign" match="ellipsis-sign">{\ldots}</xsl-out:template> <xsl-out:template name="etc" match="etc"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="ellipsis" match="ellipsis"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="dots" match="dots"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template> <xsl-out:template name="endash" match="endash">--</xsl-out:template> <xsl-out:template name="en-dash" match="en-dash"><xsl-out:call-template name="endash"/></xsl-out:template> <xsl-out:template name="emdash" match="emdash">---</xsl-out:template> <xsl-out:template name="em-dash" match="em-dash"><xsl-out:call-template name="emdash"/></xsl-out:template> <xsl-out:template name="apostrophe" match="apostrophe">'</xsl-out:template> <xsl-out:template name="dollar" match="dollar">\$</xsl-out:template> <xsl-out:template name="percent-sign" match="percent-sign">\%</xsl-out:template> <xsl-out:template name="ampersand" match="ampersand">\&</xsl-out:template> <xsl-out:template name="trademark-sign" match="trademark-sign">\texttrademark</xsl-out:template> <xsl-out:template name="trademark" match="trademark"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="TM" match="TM"><xsl-out:call-template name="trademark-sign"/></xsl-out:template> <xsl-out:template name="copyright-sign" match="copyright-sign">\copyright</xsl-out:template> <xsl-out:template name="degree-sign" match="degree-sign">$^{\circ}$</xsl-out:template> <xsl-out:template name="degrees" match="degrees"><xsl-out:call-template name="degree-sign"/></xsl-out:template> <xsl-out:template name="section-sign" match="section-sign">{\S}</xsl-out:template> <xsl-out:template name="paragraph-sign" match="paragraph-sign">{\P}</xsl-out:template> <xsl-out:template name="pi" match="pi">\pi</xsl-out:template> <xsl-out:template name="LaTeX" match="LaTeX">{\LaTeX}</xsl-out:template> <xsl-out:template name="latex" match="latex"><xsl-out:call-template name="LaTeX"/></xsl-out:template> <xsl-out:template name="menu-separator" match="menu-separator">$\triangleright$</xsl-out:template> <xsl-out:template name="menusep" match="menusep"><xsl-out:call-template name="menu-separator"/></xsl-out:template> <xsl-out:template name="menu-item" match="menu/item">\menuitem{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="emph" match="emph">\emph{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="italic" match="italic">\textit{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="strong" match="strong">\textbf{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="bold" match="bold">\textbf{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="term" match="term">\term{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="foreign" match="foreign">\foreign{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="code" match="code">\verb+<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>+</xsl-out:template> <xsl-out:template name="code-block" match="code-block"> \begin{verbatim} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{verbatim} </xsl-out:template> <xsl-out:template name="verbatim" match="verbatim"> \begin{verbatim} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{verbatim} </xsl-out:template> <xsl-out:template name="single-quote" match="quote[@single='yes']">`<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'</xsl-out:template> <xsl-out:template name="double-quote" match="quote">``<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>''</xsl-out:template> <xsl-out:template name="nested-double-quote" match="quote//quote"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote"/> </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="q" match="q"><xsl-out:call-template name="single-quote"/></xsl-out:template> <xsl-out:template name="qq" match="qq"><xsl-out:call-template name="double-quote"/></xsl-out:template> <xsl-out:template name="itemised-list" match="itemised-list"> \begin{itemize} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{itemize} </xsl-out:template> <xsl-out:template name="itemize" match="itemize"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="unordered-list" match="unordered-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bulleted-list" match="bulleted-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-list" match="bullet-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="bullet-points" match="bullet-points"><xsl-out:call-template name="itemised-list"/></xsl-out:template> <xsl-out:template name="enumerated-list" match="enumerated-list"> \begin{enumerate} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{enumerate} </xsl-out:template> <xsl-out:template name="enumerate" match="enumerate"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="ordered-list" match="ordered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="numbered-list" match="numbered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="question-list" match="question-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template> <xsl-out:template name="definition-list" match="definition-list"> \begin{description} <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{description} </xsl-out:template> <xsl-out:template name="description-list" match="description-list"><xsl-out:call-template name="definition-list"/></xsl-out:template> <xsl-out:template name="item" match="item">\item <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="definition-item" match="definition-list/item">\item[<xsl:apply-templates select="keyword" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>] <xsl:apply-templates select="definition" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="keyword" match="keyword"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="topic" match="topic"><xsl-out:call-template name="keyword"/></xsl-out:template> <xsl-out:template name="definition" match="item/definition|item/description|item/discourse"/> <xsl-out:template name="section" match="section"> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:with-param name="label"> <xsl:value-of select="@label"/> <xsl:if test="not(@label)">THERE_IS_NO_LABEL</xsl:if> </xsl:with-param> </xsl:apply-templates> </xsl-out:template> <xsl-out:template name="footnote" match="footnote">\footnote{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="footnote-list" match="footnote" mode="list"/> <xsl-out:template name="preamble-title" match="document/title" mode="preamble">\title{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="preamble-author" match="document/author" mode="preamble">\author{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="preamble-date" match="document/date" mode="preamble">\date{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="document-title" match="document/title"><xsl:if test="$standalone = 'no'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="document-author" match="document/author"/> <xsl-out:template name="document-date" match="document/date"/> <xsl-out:template name="generate-subs"> <xsl:param name="depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">1</xsl:param> <xsl:if test="$depth > 1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:text>sub</xsl:text> <xsl:call-template name="generate-subs"> <xsl:with-param name="depth"><xsl:value-of select="$depth - 1"/></xsl:with-param> </xsl:call-template> </xsl:if> </xsl-out:template> <xsl-out:template name="section-title" match="section/title"> <xsl:param name="label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\</xsl:text> <!-- Depth calculation for LaTeX hasn't been tested! --> <xsl:call-template name="generate-subs" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:with-param name="depth"> <xsl:number value="count(ancestor::section)"/> <xsl:if test="count(ancestor::section) > 3">3</xsl:if> </xsl:with-param> </xsl:call-template> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">section{</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> <xsl:if test="$label != 'THERE_IS_NO_LABEL'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \label{<xsl:value-of select="$label"/>} </xsl:if> </xsl-out:template> <xsl-out:template name="quotation" match="quotation"> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(@align = 'left') or (@align = 'right')"> \begin{flush<xsl:value-of select="@align"/>}\itshape <xsl:apply-templates/>\end{flush<xsl:value-of select="@align"/>} </xsl:when> <xsl:when test="@align = 'center'"> \begin{center}\itshape <xsl:apply-templates/>\end{center} </xsl:when> <xsl:otherwise> \begin{quote}\itshape <xsl:apply-templates/>\end{quote} </xsl:otherwise> </xsl:choose> </xsl-out:template> <xsl-out:template name="id" match="id"/> <xsl-out:template name="omit" match="omit"/> <xsl-out:template name="comment" match="comment"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \begin{comment}</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\end{comment} </xsl:text> </xsl-out:template> <xsl-out:template name="tabular" match="tabular"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\begin{</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> \begin{tabular}{<xsl:apply-templates select="columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>} <xsl:apply-templates select="tabular-header" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:apply-templates select="tabular-body" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:apply-templates select="tabular-footer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \end{tabular} <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\end{</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>flush</xsl:text><xsl:value-of select="@align"/> </xsl:when> <xsl:when test="@align = 'center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>flushleft</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template name="aligned-column" match="column[@align]"> <xsl:value-of select="@left-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:value-of select="substring(@align, 1, 1)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:value-of select="@right-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="unaligned-column" match="column[not(@align)]"> <xsl:value-of select="@left-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">l</xsl:text> <xsl:value-of select="@right-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="tabular-header" match="tabular-header"/> <xsl-out:template name="tabular-footer" match="tabular-footer"/> <xsl-out:template name="tabular-body" match="tabular-body"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="row" match="row"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> \\<xsl:if test="@no-page-break = 'yes'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">*</xsl:if><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text></xsl-out:template> <xsl-out:template name="row-rule-full" match="row-rule[not(@columns)]">\hline</xsl-out:template> <xsl-out:template name="row-rule-partial" match="row-rule[@columns]">\cline{<xsl:value-of select="@columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template match="cell" mode="multi-row"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\multirow{</xsl:text> <xsl:value-of select="@rows" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}{*}{</xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template match="cell" mode="multi-column"> <xsl:param name="num-columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">1</xsl:param> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\multicolumn{</xsl:text> <xsl:value-of select="$num-columns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}{</xsl:text> <xsl:value-of select="@left-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="@align"> <xsl:value-of select="@align"/> </xsl:when> <xsl:otherwise> <xsl:text>l</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="@right-border" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}{</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template match="cell"> <!-- position() doesn't seem to work very well in this context --> <xsl:variable name="column-no" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:number/></xsl:variable> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="@columns"> <xsl:apply-templates select="." mode="multi-column"> <xsl:with-param name="num-columns" select="@columns"/> </xsl:apply-templates> </xsl:when> <xsl:when test="@align"> <xsl:apply-templates select="." mode="multi-column"/> </xsl:when> <xsl:when test="@rows"> <xsl:apply-templates select="." mode="multi-row"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> <xsl:if test="$column-no != last()" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> & </xsl:if> </xsl-out:template> <xsl-out:template name="hyperlink-label" match="hyperlink[@label]">\hyperref[<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>]{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="hyperlink-url" match="hyperlink[@url and node()]">\href{<xsl:value-of select="@url" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]">\href{<xsl:value-of select="@url" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}{\texttt{<xsl:value-of select="@url" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}}</xsl-out:template> <xsl-out:template name="url" match="url">\texttt{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="uri" match="uri"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email" match="email"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="email-address" match="email-address"><xsl-out:call-template name="url"/></xsl-out:template> <xsl-out:template name="reference" match="reference"> <!-- Find the element whose label is the same as our label. --> <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="section-reference" match="section" mode="reference">Section~\ref*{<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="figure-reference" match="figure" mode="reference">Figure~\ref*{<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="table-reference" match="table" mode="reference">Table~\ref*{<xsl:value-of select="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="figure" match="figure"> \begin{figure} \centering <xsl:apply-templates select="*[not(self::caption)]" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:if test="count(caption) != 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{figure} </xsl-out:template> <xsl-out:template name="table" match="table"> \begin{table} \centering <xsl:apply-templates select="*[not(self::caption)]" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:if test="count(caption) != 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \caption{<xsl:apply-templates select="caption"/>} <xsl:if test="@label">\label{<xsl:value-of select="@label"/>}</xsl:if> </xsl:if> \end{table} </xsl-out:template> <xsl-out:template name="figure-caption" match="figure/caption"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="table-caption" match="table/caption"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template match="image" mode="latex"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\includegraphics</xsl:text> <xsl:if test="count(latex-scaling) != 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:text>[scale=</xsl:text> <xsl:value-of select="latex-scaling"/> <xsl:text>]</xsl:text> </xsl:if> <!-- Use whatever standard image folder is appropriate for the context. --> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="name(/child::node()[1])='tutorial'"> <xsl:text>{\tutroot/</xsl:text><xsl:value-of select="/tutorial/id/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/tutorial/id/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:when test="name(/child::node()[1])='laboratory'"> <xsl:text>{\labroot/</xsl:text><xsl:value-of select="/laboratory/id/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/laboratory/id/title-code"/><xsl:text>/Graphics/</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>{images/</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:value-of select="basename" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">.</xsl:text> <xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:when test="count(format) != 0"> <xsl:value-of select="format"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$image-format"/> </xsl:otherwise> </xsl:choose> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">}</xsl:text> </xsl-out:template> <xsl-out:template match="image[count(provide-large-version) = 0]"><xsl:apply-templates select="." mode="latex" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template match="image[count(provide-large-version) != 0]"><xsl:apply-templates select="." mode="latex" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="include-xml" match="include-document"> <xsl:apply-templates select="document(@file)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="environment" match="environment[@file]"/> <xsl-out:template name="latex-package" match="latex-packages/package">\usepackage<xsl:if test="@options" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">[<xsl:value-of select="@options"/>]</xsl:if>{<xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="latex-command" match="latex-packages/command"><xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="raw-latex" match="raw-code[@format = 'latex']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="raw-html" match="raw-code[@format = 'html']"/> <xsl-out:template name="latex-input" match="latex-input">\input{<xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="process-when-latex" match="process-when[@format = 'latex']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="process-when-html" match="process-when[@format = 'html']"/> <xsl-out:template name="math-inline" match="paragraph//math|para//math|p//math">\(<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>\)</xsl-out:template> <xsl-out:template name="math-display" match="math">\[<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>\]</xsl-out:template> <xsl-out:template name="equation-array" match="equation-array"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\begin{eqnarray*} </xsl:text> <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \end{eqnarray*}</xsl:text> </xsl-out:template> <xsl-out:template match="equation-array/row"> <xsl:apply-templates select="left" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> & </xsl:text><xsl:apply-templates select="middle" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> & </xsl:text><xsl:apply-templates select="right" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \\ \\ </xsl:text> </xsl-out:template> <xsl-out:template name="digit-group-separator" match="digit-group-separator"> <xsl:call-template name="non-breaking-space" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> </xsl-out:template> <xsl-out:template name="digitsep" match="digitsep"><xsl-out:call-template name="digit-group-separator"/></xsl-out:template> <xsl-out:template name="superscript" match="math//superscript">^{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="subscript" match="math//subscript">_{<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> <xsl-out:template name="plus-operator" match="math//plus">+</xsl-out:template> <xsl-out:template name="minus-operator" match="math//minus">-</xsl-out:template> <xsl-out:template name="times-operator" match="math//times">\times</xsl-out:template> <xsl-out:template name="times" match="times"><xsl-out:call-template name="times-operator"/></xsl-out:template> <xsl-out:template name="divide-operator" match="math//divide">/</xsl-out:template> <xsl-out:template name="equals-operator" match="math//equals"> = </xsl-out:template> <xsl-out:template name="log-like-function" match="math//function">\<xsl:value-of select="@name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-variable" match="math//variable"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template> <xsl-out:template name="math-fraction" match="math//fraction">\frac{<xsl:apply-templates select="numerator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}{<xsl:apply-templates select="denominator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>}</xsl-out:template> </xsl-out:stylesheet>
Show line notes below