| |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="OracleServer" match="OracleServer"> |
---|
| | <latex>Oracle11\textit{g}</latex> |
---|
| | <html>Oracle11<I>g</I></html> |
---|
| | <common formats="/latex/xelatex/">Oracle11\textit{g}</common> |
---|
| | <common formats="/html/xhtml/">Oracle11<i>g</i></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="OracleServerRelease" match="OracleServerRelease"> |
---|
| | <common>1</common> |
---|
| |
---|
| | 'center' => centered alignment |
---|
| | 'right' => right alignment |
---|
| | --> |
---|
| | <template name="paragraph" match="paragraph|para|p|P"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text> |
---|
| | |
---|
| | |
---|
| | </xsl:text> |
---|
| |
---|
| | <xsl:text> |
---|
| | |
---|
| | |
---|
| | </xsl:text> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <!-- 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> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <!-- |
---|
| | The HTMLStyle parameter is an Ugly Hack(tm) to ensure |
---|
| | that paragraphs are indented correctly inside definition |
---|
| | lists in HTML. I tried modes first, but they didn't work |
---|
| | correctly. Fortunately this only needs to be done with |
---|
| | paragraphs, so this will work fine. |
---|
| | --> |
---|
| | <xsl:param name="HTMLStyle" /> |
---|
| | <P> |
---|
| | <p> |
---|
| | <xsl:if test="$HTMLStyle"> |
---|
| | <xsl:attribute name="CLASS"> |
---|
| | <xsl:attribute name="class"> |
---|
| | <xsl:value-of select="$HTMLStyle" /> |
---|
| | </xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <xsl:if test="@align"> |
---|
| | <xsl:attribute name="ALIGN"> |
---|
| | <xsl:attribute name="align"> |
---|
| | <xsl:value-of select="@align" /> |
---|
| | </xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <xsl:apply-templates /> |
---|
| | </P> |
---|
| | </html> |
---|
| | </template> |
---|
| | </p> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- 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|line-break|br"> |
---|
| | <latex><xsl:text> \\ |
---|
| | </xsl:text></latex> |
---|
| | <html><BR /></html> |
---|
| | <common formats="/latex/xelatex/"><xsl:text> \\ |
---|
| | </xsl:text></common> |
---|
| | <common formats="/html/xhtml/"><br /></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Whereas newline|line-break is for line breaks intended to be outputted in the final document, this is for additional linebreaks in the generated latex or HTML source (for stuff like avoiding "\end{verbatim}\item" all on one line). --> |
---|
| | <template name="newline-internal" match="newline-internal"> |
---|
| | <latex><xsl:text> |
---|
| | </xsl:text></latex> |
---|
| | <html><xsl:text> |
---|
| | </xsl:text></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/"><xsl:text> |
---|
| | </xsl:text></common> |
---|
| | <common formats="/html/xhtml/"><xsl:text> |
---|
| | </xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="page-break" match="page-break|new-page|newpage|pagebreak"> |
---|
| | <latex>\newpage</latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\newpage</common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Insert a space. Useful for the occasional case where two |
---|
| | elements occur next to each other with only a space separating |
---|
| |
---|
| | to ensure that spaces after the macro aren't gobbled, and indeed, |
---|
| | this is what the LaTeX version of the markup produces. |
---|
| | --> |
---|
| | <template name="space" match="space"> |
---|
| | <latex><xsl:text>\ </xsl:text></latex> |
---|
| | <html><xsl:text> </xsl:text></html> |
---|
| | <common formats="/latex/xelatex/"><xsl:text>\ </xsl:text></common> |
---|
| | <common formats="/html/xhtml/"><xsl:text> </xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="non-breaking-space" match="non-breaking-space|nbsp"> |
---|
| | <latex>~</latex> |
---|
| | <html><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">~</common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="thin-space" match="thin-space|thinspace"> |
---|
| | <latex>\,</latex> |
---|
| | <html><xsl:text disable-output-escaping="yes">&thinsp;</xsl:text></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\,</common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">&thinsp;</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Insert a discretionary hyphen. Only relevant for LaTeX output. |
---|
| | --> |
---|
| | <template name="discretionary-hyphen" match="hyphen"> |
---|
| | <latex>\-</latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\-</common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Technically we don't need to disable output escaping for all of |
---|
| | these, but it's probably better to code them all consistently, |
---|
| |
---|
| |   for a non-breaking space) and which ones don't (e.g., |
---|
| | &). |
---|
| | --> |
---|
| | <template name="ellipsis-sign" match="ellipsis-sign|etc|ellipsis|dots"> |
---|
| | <latex>{\ldots}</latex> |
---|
| | <common formats="/latex/xelatex/">{\ldots}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&hellip;</xsl:text></html> |
---|
| | <xhtml>…</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Misc typographic symbols --> |
---|
| | <template name="endash" match="endash|en-dash"> |
---|
| | <latex>--</latex> |
---|
| | <common formats="/latex/xelatex/">--</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&ndash;</xsl:text></html> |
---|
| | <xhtml>–</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="emdash" match="emdash|em-dash"> |
---|
| | <latex>---</latex> |
---|
| | <common formats="/latex/xelatex/">---</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&mdash;</xsl:text></html> |
---|
| | </template> |
---|
| | <xhtml>—</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Use this for literal underscores that appear outside code blocks. Such things cause LaTeX to wig out. --> |
---|
| | <template name="underscore" match="underscore"> |
---|
| | <latex>\_</latex> |
---|
| | <html>_</html> |
---|
| | <common formats="/latex/xelatex/">\_</common> |
---|
| | <common formats="/html/xhtml/">_</common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="apostrophe" match="apostrophe"> |
---|
| | <latex>'</latex> |
---|
| | <common formats="/latex/xelatex/">'</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&rsquo;</xsl:text></html> |
---|
| | <xhtml>’</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="dollar" match="dollar|dollar-sign"> |
---|
| | <latex>{\$}</latex> |
---|
| | <html>$</html> |
---|
| | <common formats="/latex/xelatex/">{\$}</common> |
---|
| | <common formats="/html/xhtml/">$</common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="percent-sign" match="percent-sign|percentage-sign|percent"> |
---|
| | <latex>{\%}</latex> |
---|
| | <html>%</html> |
---|
| | <common formats="/latex/xelatex/">{\%}</common> |
---|
| | <common formats="/html/xhtml/">%</common> |
---|
| | </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|trademark|TM"> |
---|
| | <latex>{\texttrademark}</latex> |
---|
| | <common formats="/latex/xelatex/">{\&}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">&amp;</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="trademark-sign" match="trademark-sign|trademark|TM|tm"> |
---|
| | <common formats="/latex/xelatex/">{\texttrademark}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&trade;</xsl:text></html> |
---|
| | <xhtml>™</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="copyright-sign" match="copyright-sign"> |
---|
| | <latex>{\copyright}</latex> |
---|
| | <common formats="/latex/xelatex/">{\copyright}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&copy;</xsl:text></html> |
---|
| | <xhtml>©</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="degree-sign" match="degree-sign|degrees"> |
---|
| | <latex>\ensuremath{^{\circ}}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{^{\circ}}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&deg;</xsl:text></html> |
---|
| | <xhtml>°</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="section-sign" match="section-sign"> |
---|
| | <latex>{\S}</latex> |
---|
| | <common formats="/latex/xelatex/">{\S}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&sect;</xsl:text></html> |
---|
| | <xhtml>§</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="sharp-sign" match="sharp|hash"> |
---|
| | <latex>{\#}</latex> |
---|
| | <html><xsl:text>#</xsl:text></html> |
---|
| | <common formats="/latex/xelatex/">{\#}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:text>#</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="paragraph-sign" match="paragraph-sign"> |
---|
| | <latex>{\P}</latex> |
---|
| | <common formats="/latex/xelatex/">{\P}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&para;</xsl:text></html> |
---|
| | <xhtml>¶</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="left-curly-bracket" match="left-curly-bracket|left-curly-brace|left-brace"> |
---|
| | <latex>\ensuremath{\{}</latex> |
---|
| | <html><xsl:text disable-output-escaping="yes">{</xsl:text></html> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\{}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">{</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="right-curly-bracket" match="right-curly-bracket|right-curly-brace|right-brace"> |
---|
| | <latex>\ensuremath{\}}</latex> |
---|
| | <html><xsl:text disable-output-escaping="yes">}</xsl:text></html> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\}}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">}</xsl:text></common> |
---|
| | </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... --> |
---|
| | <!-- Use \ensuremath to resolve the problem. --> |
---|
| | <template name="pi" match="pi|project"> |
---|
| | <latex>\ensuremath{\pi}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\pi}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&pi;</xsl:text></html> |
---|
| | <xhtml>π</xhtml> |
---|
| | </template> |
---|
| | <template name="epsilon" match="epsilon|extend"> |
---|
| | <latex>\ensuremath{\epsilon}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\epsilon}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&epsilon;</xsl:text></html> |
---|
| | <xhtml>ε</xhtml> |
---|
| | </template> |
---|
| | <template name="sigma" match="sigma|restrict"> |
---|
| | <latex>\ensuremath{\sigma}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\sigma}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&sigma;</xsl:text></html> |
---|
| | <xhtml>σ</xhtml> |
---|
| | </template> |
---|
| | <template name="rho" match="rho|rename"> |
---|
| | <latex>\ensuremath{\rho}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\rho}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&rho;</xsl:text></html> |
---|
| | <xhtml>ρ</xhtml> |
---|
| | </template> |
---|
| | <template name="capital-phi" match="Phi"> |
---|
| | <latex>\ensuremath{\Phi}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\Phi}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&Phi;</xsl:text></html> |
---|
| | <xhtml>Φ</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="empty-set-sign" match="empty-set-sign|empty-set|null"> |
---|
| | <latex>\ensuremath{\emptyset}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\emptyset}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&empty;</xsl:text></html> |
---|
| | <xhtml>∅</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="element-sign" match="element-sign|element|element-of|is-element-of|is-an-element-of"> |
---|
| | <latex>\ensuremath{\in}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\in}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&isin;</xsl:text></html> |
---|
| | </template> |
---|
| | <xhtml>∈</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="not-element-sign" match="not-element-sign|not-element|not-element-of|is-not-element-of|is-not-an-element-of"> |
---|
| | <latex>\ensuremath{\not\in}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\not\in}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&notin;</xsl:text></html> |
---|
| | </template> |
---|
| | <xhtml>∉</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="subset-sign" match="subset-sign|subset|subset-of|is-subset-of|is-a-subset-of"> |
---|
| | <latex>\ensuremath{\subset}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\subset}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&sub;</xsl:text></html> |
---|
| | <xhtml>⊂</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="superset-sign" match="superset-sign|superset|superset-of|is-superset-of|is-a-superset-of"> |
---|
| | <latex>\ensuremath{\supset}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\supset}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&sup;</xsl:text></html> |
---|
| | <xhtml>⊃</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="join-operator" match="join-operator|join|natural-join"> |
---|
| | <latex>\ensuremath{\Join}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\Join}</common> |
---|
| | <!-- |
---|
| | No easy way at present to get the join symbol in HTML, so |
---|
| | just use an image. Scale it to 10x10 pixels (fine as long as |
---|
| | font size is set relatively normally). |
---|
| |
---|
| | We need to ensure that the path is absolute, because we don't |
---|
| | necessarily know where the document will end up in the tree. |
---|
| | --> |
---|
| | <html> |
---|
| | <IMG> |
---|
| | <xsl:attribute name="SRC"> |
---|
| | <img> |
---|
| | <xsl:attribute name="src"> |
---|
| | <xsl:text>/</xsl:text> |
---|
| | <xsl:value-of select="$department" /> |
---|
| | <xsl:value-of select="$paper" /> |
---|
| | <xsl:text>/Handbook/join-operator-web.png</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="ALT"> |
---|
| | <xsl:attribute name="alt"> |
---|
| | <xsl:text>Join operator</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="WIDTH"> |
---|
| | <xsl:attribute name="width"> |
---|
| | <xsl:text>10</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="HEIGHT"> |
---|
| | <xsl:attribute name="height"> |
---|
| | <xsl:text>10</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="STYLE"> |
---|
| | <xsl:attribute name="style"> |
---|
| | <xsl:text>padding-left:0.3em;padding-right:0.3em</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | </IMG> |
---|
| | </img> |
---|
| | </html> |
---|
| | <xhtml>⋈</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Generate a left, right or full outer join operator. |
---|
| |
---|
| | 'right' |
---|
| | 'full' [default] |
---|
| | --> |
---|
| | <template name="outer-join-operator" match="outer-join-operator|outer-join"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\ensuremath{\</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@type"> |
---|
| | <xsl:value-of select="@type" /> |
---|
| |
---|
| | <xsl:text>Full</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>OuterJoin}</xsl:text> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <!-- |
---|
| | No easy way at present to get a join symbol in HTML, so |
---|
| | just use an image. Scale it to 10 pixels high (fine as long as |
---|
| | font size is set relatively normally, width depends on operator |
---|
| | type). |
---|
| | |
---|
| | We need to ensure that the path is absolute, because we don't |
---|
| | necessarily know where the document will end up in the tree. |
---|
| | |
---|
| | Note that these characters are available in Unicode, but I'm not |
---|
| | sure how widespread font support will be as yet (Dec 2010). |
---|
| | --> |
---|
| | <html> |
---|
| | <IMG> |
---|
| | <xsl:attribute name="SRC"> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <img> |
---|
| | <xsl:attribute name="src"> |
---|
| | <xsl:text>/</xsl:text> |
---|
| | <xsl:value-of select="$department" /> |
---|
| | <xsl:value-of select="$paper" /> |
---|
| | <xsl:text>/Handbook/</xsl:text> |
---|
| |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>-outer-join-operator-web.png</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="ALT"> |
---|
| | <xsl:attribute name="alt"> |
---|
| | <xsl:text>Join operator</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="WIDTH"> |
---|
| | <xsl:attribute name="width"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="(@type = 'left') or (@type = 'right')"> |
---|
| | <xsl:text>15</xsl:text> |
---|
| | </xsl:when> |
---|
| |
---|
| | <xsl:text>20</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="HEIGHT"> |
---|
| | <xsl:attribute name="height"> |
---|
| | <xsl:text>10</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="STYLE"> |
---|
| | <xsl:attribute name="style"> |
---|
| | <xsl:text>padding-left:0.3em;padding-right:0.3em</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | </IMG> |
---|
| | </html> |
---|
| | </img> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="intersect-operator" match="intersect-operator|intersect|intersection|cap"> |
---|
| | <latex>\ensuremath{\cap}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\cap}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&cap;</xsl:text></html> |
---|
| | <xhtml>∩</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="union-operator" match="union-operator|union|cup"> |
---|
| | <latex>\ensuremath{\cup}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\cup}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&cup;</xsl:text></html> |
---|
| | <xhtml>∪</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="logical-and-operator" match="logical-and-operator|logical-and|and|and-operator|hat|wedge"> |
---|
| | <latex>\ensuremath{\wedge}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\wedge}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&and;</xsl:text></html> |
---|
| | <xhtml>∧</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="logical-or-operator" match="logical-or-operator|logical-or|or|or-operator|vee"> |
---|
| | <latex>\ensuremath{\vee}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\vee}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&or;</xsl:text></html> |
---|
| | <xhtml>∨</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="logical-not-operator" match="logical-not-operator|logical-negation-operator|logical-negation|logical-not|not|negation|neg"> |
---|
| | <latex>\ensuremath{\neg}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\neg}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&not;</xsl:text></html> |
---|
| | <xhtml>¬</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="LaTeX" match="LaTeX|latex"> |
---|
| | <latex>{\LaTeX}</latex> |
---|
| | <html>L<SUP>A</SUP>T<SUB>E</SUB>X</html> |
---|
| | <common formats="/latex/xelatex/">{\LaTeX}</common> |
---|
| | <common formats="/html/xhtml/">L<sup>A</sup>T<sub>E</sub>X</common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Note: no equivalent of \triangleright in HTML, use right arrow instead. --> |
---|
| | <template name="menu-separator" match="menu-separator|menusep|menu/separator"> |
---|
| | <latex> \ensuremath{\triangleright} </latex> |
---|
| | <common formats="/latex/xelatex/"> \ensuremath{\triangleright} </common> |
---|
| | <html><xsl:text disable-output-escaping="yes"> &rarr; </xsl:text></html> |
---|
| | <xhtml> ▹ </xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="menu-item" match="menu/item"> |
---|
| | <latex>\textbf{<xsl:apply-templates />}</latex> |
---|
| | <html><B><xsl:apply-templates /></B></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\textbf{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><b><xsl:apply-templates /></b></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Emoticons, specifically :), :| and :(. We may be able to do more |
---|
| | with the HTML version if we switch to Unicode? |
---|
| |
---|
| | 'neutral' or 'meh' :) |
---|
| | 'happy' [default] |
---|
| | --> |
---|
| | <template name="emoticon" match="emoticon|smiley"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@type = 'sad'"> |
---|
| | <xsl:text>\Pisymbol{jwi}{"4C}</xsl:text> |
---|
| | </xsl:when> |
---|
| |
---|
| | <xsl:otherwise> |
---|
| | <xsl:text>\Pisymbol{jwi}{"4A}</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <html> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@type = 'sad'"> |
---|
| | <xsl:text>:(</xsl:text> |
---|
| |
---|
| | <xsl:text>:)</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | <xhtml> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@type = 'sad'"> |
---|
| | <xsl:text>☹</xsl:text> |
---|
| | </xsl:when> |
---|
| | <xsl:when test="@type = 'neutral' or @type = 'meh'"> |
---|
| | <xsl:text>:|</xsl:text> |
---|
| | </xsl:when> |
---|
| | <xsl:otherwise> |
---|
| | <xsl:text>☺</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Special styles --> |
---|
| | <template name="emph" match="emph|em"> |
---|
| | <latex>\emph{<xsl:apply-templates />}</latex> |
---|
| | <html><EM><xsl:apply-templates /></EM></html> |
---|
| | <common formats="/latex/xelatex/">\emph{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><em><xsl:apply-templates /></em></common> |
---|
| | </template> |
---|
| | <!-- |
---|
| | Emphasis inside answers needs to be handled specially in HTML, as |
---|
| | it doesn't just flip-flop automatically like it does in LaTeX. |
---|
| | --> |
---|
| | <template name="emph-in-answer" match="answer//emph|answer//em"> |
---|
| | <latex>\emph{<xsl:apply-templates />}</latex> |
---|
| | <html><STRONG><xsl:apply-templates /></STRONG></html> |
---|
| | <common formats="/latex/xelatex/">\emph{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><strong><xsl:apply-templates /></strong></common> |
---|
| | </template> |
---|
| | <template name="italic" match="italic"> |
---|
| | <latex>\textit{<xsl:apply-templates />}</latex> |
---|
| | <html><I><xsl:apply-templates /></I></html> |
---|
| | <common formats="/latex/xelatex/">\textit{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><i><xsl:apply-templates /></i></common> |
---|
| | </template> |
---|
| | <template name="strong" match="strong"> |
---|
| | <latex>\textbf{<xsl:apply-templates />}</latex> |
---|
| | <html><STRONG><xsl:apply-templates /></STRONG></html> |
---|
| | <common formats="/latex/xelatex/">\textbf{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><strong><xsl:apply-templates /></strong></common> |
---|
| | </template> |
---|
| | <template name="bold" match="bold"> |
---|
| | <latex>\textbf{<xsl:apply-templates />}</latex> |
---|
| | <html><B><xsl:apply-templates /></B></html> |
---|
| | <common formats="/latex/xelatex/">\textbf{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><b><xsl:apply-templates /></b></common> |
---|
| | </template> |
---|
| | <template name="underline" match="underline|u"> |
---|
| | <latex>\underline{<xsl:apply-templates />}</latex> |
---|
| | <html><span style="text-decoration: underline;"><xsl:apply-templates /></span></html> |
---|
| | <common formats="/latex/xelatex/">\underline{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><span style="text-decoration: underline;"><xsl:apply-templates /></span></common> |
---|
| | </template> |
---|
| | <template name="term" match="term"> |
---|
| | <latex>\term{<xsl:apply-templates />}</latex> |
---|
| | <html><I CLASS="term"><xsl:apply-templates /></I></html> |
---|
| | <common formats="/latex/xelatex/">\term{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><i class="term"><xsl:apply-templates /></i></common> |
---|
| | </template> |
---|
| | <template name="foreign" match="foreign"> |
---|
| | <latex>\foreign{<xsl:apply-templates />}</latex> |
---|
| | <html><I CLASS="foreign"><xsl:apply-templates /></I></html> |
---|
| | <common formats="/latex/xelatex/">\foreign{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><i class="foreign"><xsl:apply-templates /></i></common> |
---|
| | </template> |
---|
| | <template name="code" match="code"> |
---|
| | <!-- <latex>\code{<xsl:apply-templates />}</latex> --> |
---|
| | <!-- Using \verb is quite handy because things like underscores don't bother it. However, it seems it can't be used inside hyperlinks. Maybe create another template that just does a \texttt on the contents? --> |
---|
| | <!-- OK, but then we need an <underscore> element to stop them from freaking LaTeX out. --> |
---|
| | <latex>\verb`<xsl:apply-templates />`</latex> |
---|
| | <html><CODE><xsl:apply-templates /></CODE></html> |
---|
| | <common formats="/latex/xelatex/">\verb`<xsl:apply-templates />`</common> |
---|
| | <common formats="/html/xhtml/"><code><xsl:apply-templates /></code></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="typewriter" match="typewriter|monospace|tt"> |
---|
| | <latex>\texttt{<xsl:apply-templates />}</latex> |
---|
| | <html><TT><xsl:apply-templates /></TT></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\texttt{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><tt><xsl:apply-templates /></tt></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="sans-serif" match="sans-serif|sans|ss|sf"> |
---|
| | <latex>\textsf{<xsl:apply-templates />}</latex> |
---|
| | <html><FONT FACE="sans-serif"><xsl:apply-templates /></FONT></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\textsf{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><font face="sans-serif"><xsl:apply-templates /></font></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Non-maths super- and subscript. --> |
---|
| | <template name="superscript" match="superscript"> |
---|
| | <latex>\ensuremath{^{\mathrm{<xsl:apply-templates />}}}</latex> |
---|
| | <html><SUP><xsl:apply-templates /></SUP></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{^{\mathrm{<xsl:apply-templates />}}}</common> |
---|
| | <common formats="/html/xhtml/"><sup><xsl:apply-templates /></sup></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="subscript" match="subscript"> |
---|
| | <latex>\ensuremath{_{\mathrm{<xsl:apply-templates />}}}</latex> |
---|
| | <html><SUB><xsl:apply-templates /></SUB></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{_{\mathrm{<xsl:apply-templates />}}}</common> |
---|
| | <common formats="/html/xhtml/"><sub><xsl:apply-templates /></sub></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Font sizing, using relative font size elements borrowed from |
---|
| | LaTeX. Note that we use CSS relative font sizes (smaller and |
---|
| |
---|
| | LaTeX. We can't use absolute sizes in CSS as they would probably |
---|
| | look different on different machines. |
---|
| | --> |
---|
| | <template name="tiny" match="tiny"> |
---|
| | <latex>{\tiny <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <common formats="/latex/xelatex/">{\tiny <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="scriptsize" match="scriptsize"> |
---|
| | <latex>{\scriptsize <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <common formats="/latex/xelatex/">{\scriptsize <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="footnotesize" match="footnotesize"> |
---|
| | <latex>{\footnotesize <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <common formats="/latex/xelatex/">{\footnotesize <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="small" match="small"> |
---|
| | <latex>{\small <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:smaller;"> |
---|
| | <common formats="/latex/xelatex/">{\small <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:smaller;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="large" match="large"> |
---|
| | <latex>{\large <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <common formats="/latex/xelatex/">{\large <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Fortunately, XML is case-sensitive. --> |
---|
| | <template name="Large" match="Large"> |
---|
| | <latex>{\Large <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <common formats="/latex/xelatex/">{\Large <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="LARGE" match="LARGE"> |
---|
| | <latex>{\LARGE <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <common formats="/latex/xelatex/">{\LARGE <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="huge" match="huge"> |
---|
| | <latex>{\huge <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <common formats="/latex/xelatex/">{\huge <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="Huge" match="Huge"> |
---|
| | <latex>{\Huge <xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <SPAN STYLE="font-size:larger;"> |
---|
| | <common formats="/latex/xelatex/">{\Huge <xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <span style="font-size:larger;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </SPAN> |
---|
| | </html> |
---|
| | </template> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </span> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Text that shouldn't be broken across a line (i.e., LaTeX \mbox). |
---|
| | Only really relevant for LaTeX because we can't control this in HTML. |
---|
| | --> |
---|
| | <template name="no-break" match="no-break|mbox"> |
---|
| | <latex>\mbox{<xsl:apply-templates />}</latex> |
---|
| | <html><xsl:apply-templates /></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\mbox{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Skip a certain amount of space vertically. |
---|
| |
---|
| | 'fill' => \vfill |
---|
| | LaTeX length => \vskipxx |
---|
| | --> |
---|
| | <template name="vertical-skip" match="vertical-skip|vskip"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="not(@size)"> |
---|
| | \vskip\baselineskip |
---|
| | </xsl:when> |
---|
| |
---|
| | <xsl:otherwise> |
---|
| | \vskip<xsl:value-of select="@size" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <!-- For the moment we'll just throw in a BR :) --> |
---|
| | <html><BR CLEAR="left" /></html> |
---|
| | </template> |
---|
| | <common formats="/html/xhtml/"><br clear="left" /></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- We can decide later whether to use plain verbatim or listings. --> |
---|
| | <template name="code-block" match="code-block"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:call-template name="newline-internal" /> |
---|
| | <!-- If the code-block specifies "allow-breaks='no'", wrap the verbatim inside a minipage to avoid page breaks within the code. --> |
---|
| | <xsl:if test="@allow-breaks = 'no'"> |
---|
| | <xsl:text>\vskip\baselineskip</xsl:text> |
---|
| |
---|
| | <xsl:text>\vskip\baselineskip</xsl:text> |
---|
| | <xsl:call-template name="newline-internal" /> |
---|
| | </xsl:if> |
---|
| | <xsl:call-template name="newline-internal" /> |
---|
| | </latex> |
---|
| | <html> |
---|
| | <PRE CLASS="code"><xsl:apply-templates /></PRE> |
---|
| | </html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <pre class="code"><xsl:apply-templates /></pre> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | This is for stuff that should unequivocally be treated verbatim (e.g. problem code). |
---|
| | I'm pretty sure that previously this was distinguished from "code-block" because it (code-block) used to use listings instead of verbatim. Now that they're both using verbatim there is probably no need for them both (but we might switch back to using listings for code-block). |
---|
| | --> |
---|
| | <template name="verbatim" match="verbatim"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:call-template name="newline-internal" /> |
---|
| | <xsl:text>\begin{verbatim}</xsl:text> |
---|
| | <xsl:apply-templates /> |
---|
| | <xsl:text>\end{verbatim}</xsl:text> |
---|
| | <xsl:call-template name="newline-internal" /> |
---|
| | </latex> |
---|
| | <html> |
---|
| | <PRE><xsl:apply-templates /></PRE> |
---|
| | </html> |
---|
| | </template> |
---|
| | |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <pre><xsl:apply-templates /></pre> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Quoted text. Handles nested quotes correctly. |
---|
| | |
---|
| |
---|
| | 'yes' => single quotes (''). |
---|
| | otherwise => double quotes (""). [default] |
---|
| | --> |
---|
| | <template name="single-quote" match="quote[@single='yes']|q[@single='yes']"> |
---|
| | <latex>`<xsl:apply-templates />'</latex> |
---|
| | <common formats="/latex/xelatex/">`<xsl:apply-templates />'</common> |
---|
| | <html> |
---|
| | <xsl:text disable-output-escaping="yes">&lsquo;</xsl:text> |
---|
| | <xsl:apply-templates /> |
---|
| | <xsl:text disable-output-escaping="yes">&rsquo;</xsl:text> |
---|
| | </html> |
---|
| | <xhtml>‘<xsl:apply-templates />’</xhtml> |
---|
| | </template> |
---|
| | <template name="double-quote" match="quote|qq"> |
---|
| | <latex>``<xsl:apply-templates />''</latex> |
---|
| | <common formats="/latex/xelatex/">``<xsl:apply-templates />''</common> |
---|
| | <html> |
---|
| | <xsl:text disable-output-escaping="yes">&ldquo;</xsl:text> |
---|
| | <xsl:apply-templates /> |
---|
| | <xsl:text disable-output-escaping="yes">&rdquo;</xsl:text> |
---|
| | </html> |
---|
| | <xhtml>“<xsl:apply-templates />”</xhtml> |
---|
| | </template> |
---|
| | <!-- |
---|
| | With nested quotes, we need to figure out what depth of nesting |
---|
| | we're at, then call the appropriate template depending on |
---|
| |
---|
| | |
---|
| | <!-- Unordered lists --> |
---|
| | |
---|
| | <template name="itemised-list" match="itemised-list|itemize|unordered-list|bulleted-list|bullet-list|bullet-points|UL|ul"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | \begin{itemize} |
---|
| | <xsl:apply-templates select="item" mode="normal" /> |
---|
| | \end{itemize} |
---|
| | |
---|
| | </latex> |
---|
| | <html> |
---|
| | <UL> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <ul> |
---|
| | <xsl:apply-templates select="item" mode="normal" /> |
---|
| | </UL> |
---|
| | </html> |
---|
| | </template> |
---|
| | </ul> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Ordered lists --> |
---|
| | |
---|
| | <template name="enumerated-list" match="enumerated-list|enumerate|ordered-list|numbered-list|question-list|OL|ol"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | \begin{enumerate} |
---|
| | <xsl:apply-templates select="item" mode="normal" /> |
---|
| | \end{enumerate} |
---|
| | |
---|
| | </latex> |
---|
| | <html> |
---|
| | <OL> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <ol> |
---|
| | <xsl:apply-templates select="item" mode="normal" /> |
---|
| | </OL> |
---|
| | </html> |
---|
| | </template> |
---|
| | </ol> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Definition or description lists. --> |
---|
| | <template name="definition-list" match="definition-list|description-list|DL|dl"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | \begin{description} |
---|
| | <xsl:apply-templates select="item" mode="definition-list" /> |
---|
| | \end{description} |
---|
| | |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <!-- |
---|
| | <DL>s in HTML tend to come out with the spacing a bit |
---|
| | <dl>s in HTML tend to come out with the spacing a bit |
---|
| | wrong (or maybe it's just my browser?). Anyway, they |
---|
| | don't appear to be displayed correctly. A more portable |
---|
| | solution is to use plain <P>s with CSS margins to |
---|
| | solution is to use plain <p>s with CSS margins to |
---|
| | control the hanging indent. The tricky part is dealing |
---|
| | with embedded <paragraph>s inside the |
---|
| | <description-list>. The clever details are handled in |
---|
| | the "definition-item" template. |
---|
| | --> |
---|
| | <xsl:apply-templates select="item" mode="definition-list" /> |
---|
| | </html> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- List elements --> |
---|
| | <template name="list-item" match="item" mode="normal"> |
---|
| | <latex><xsl:text>\item </xsl:text><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <common formats="/latex/xelatex/"><xsl:text>\item </xsl:text><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:choose> |
---|
| | <!-- |
---|
| | Check whether there are actual paragraphs or things that |
---|
| | should be treated like paragraphs inside the item. If so, |
---|
| | let them worry about inserting the <P> tags. |
---|
| | let them worry about inserting the <p> tags. |
---|
| | --> |
---|
| | <xsl:when test="count(paragraph|para|p|question|answer|code-block) != 0"> |
---|
| | <LI><xsl:apply-templates /></LI> |
---|
| | <li><xsl:apply-templates /></li> |
---|
| | </xsl:when> |
---|
| | <!-- |
---|
| | Otherwise, insert <P> tags surrounding the item content |
---|
| | Otherwise, insert <p> tags surrounding the item content |
---|
| | so that the item spacing looks OK. |
---|
| | --> |
---|
| | <xsl:otherwise> |
---|
| | <LI><P><xsl:apply-templates /></P></LI> |
---|
| | <li><p><xsl:apply-templates /></p></li> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="definition-item" match="item" mode="definition-list"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\item[</xsl:text> |
---|
| | <xsl:apply-templates select="keyword|term|topic|DT|dt" /> |
---|
| | <xsl:text>] </xsl:text> |
---|
| | <xsl:apply-templates select="definition|description|discourse|DD|dd" /> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <!-- |
---|
| | We have to be a little clever here, because we're |
---|
| | transforming potentially multiple embedded elements |
---|
| | (embedded <paragraph>s in particular) into one or more |
---|
| | <P> tags in the HTML. We need to ensure that: |
---|
| | <p> tags in the HTML. We need to ensure that: |
---|
| | |
---|
| | (a) we don't end up with nested <P> tags, |
---|
| | (a) we don't end up with nested <p> tags, |
---|
| | |
---|
| | (b) all paragraphs are correctly indented, and |
---|
| | |
---|
| | (c) if the first thing following the <definition> |
---|
| |
---|
| | If the first sub-node of the <definition> is NOT a |
---|
| | <p> node, then the whole thing should be just simple |
---|
| | text and contain only basic formatting elements, if |
---|
| | anything (i.e., no lists!). We therefore just wrap |
---|
| | the <keyword> and <definition> within a <P> with a |
---|
| | the <keyword> and <definition> within a <p> with a |
---|
| | hanging indent and finish. Note the use of |
---|
| | child::node[1|2], because we don't necessarily know |
---|
| | what variants of <keyword> and <definition> have |
---|
| | actually been used, but we know that they will |
---|
| |
---|
| | This probably is the most common case, so test for |
---|
| | it first. |
---|
| | --> |
---|
| | <xsl:when test="not(child::node()[2]/child::node()[1][self::p] or child::node()[2]/child::node()[1][self::paragraph])"> |
---|
| | <P CLASS="definition1"> |
---|
| | <p class="definition1"> |
---|
| | <xsl:apply-templates select="child::node()[1]" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:apply-templates select="child::node()[2]" /> |
---|
| | </P> |
---|
| | </p> |
---|
| | </xsl:when> |
---|
| | <!-- |
---|
| | If the first sub-node of the <definition> IS a <p> |
---|
| | or <paragraph>, then we need to skip over the |
---|
| | processing of this element to avoid nested <P>s in |
---|
| | processing of this element to avoid nested <p>s in |
---|
| | the output. Any remaining sub-nodes are processed |
---|
| | normally, except that we pass in the HTMLStyle |
---|
| | parameter to ensure that any remaining paragraph |
---|
| | elements are correctly indented. I would have used |
---|
| |
---|
| | because there isn't an <itemize> template with the |
---|
| | appropriate mode (nor is there a need for one). Grr. |
---|
| | --> |
---|
| | <xsl:otherwise> |
---|
| | <P CLASS="definition1"> |
---|
| | <p class="definition1"> |
---|
| | <xsl:apply-templates select="child::node()[1]" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:apply-templates select="child::node()[2]/child::node()[1]/node()" /> |
---|
| | </P> |
---|
| | </p> |
---|
| | <xsl:apply-templates select="child::node()[2]/*[position() > 1]"> |
---|
| | <xsl:with-param name="HTMLStyle">definition2</xsl:with-param> |
---|
| | </xsl:apply-templates> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Need to provide some context here as, e.g., <term> is also |
---|
| | a standalone element. |
---|
| | --> |
---|
| | <template name="keyword" match="item/keyword|item/term|item/topic|item/DT|item/dt"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html><STRONG><xsl:apply-templates /></STRONG></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"><strong><xsl:apply-templates /></strong></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Need to provide some context here as, e.g., <description> is also |
---|
| |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Question text. This only exists so that we can ensure that appropriate |
---|
| | <P> tags are correctly inserted. If this template didn't exist, showing |
---|
| | <p> tags are correctly inserted. If this template didn't exist, showing |
---|
| | the answers would generate invalid HTML. The answers are enclosed in a |
---|
| | <DIV CLASS="answer">...</DIV>. Without this template, the answer markup |
---|
| | ends up embedded inside <P>...</P>, which is invalid. |
---|
| | <div class="answer">...</div>. Without this template, the answer markup |
---|
| | ends up embedded inside <p>...</p>, which is invalid. |
---|
| | --> |
---|
| | <template name="question" match="question"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:choose> |
---|
| | <!-- |
---|
| | Check whether there are actual paragraphs inside the |
---|
| | question. If so, let them worry about inserting the |
---|
| | <P> tags. |
---|
| | <p> tags. |
---|
| | --> |
---|
| | <xsl:when test="count(paragraph|para|p|question|answer|code-block) != 0"> |
---|
| | <xsl:apply-templates /> |
---|
| | </xsl:when> |
---|
| | <!-- |
---|
| | Otherwise, insert <P> tags surrounding the question content. |
---|
| | Otherwise, insert <p> tags surrounding the question content. |
---|
| | --> |
---|
| | <xsl:otherwise> |
---|
| | <P><xsl:apply-templates /></P> |
---|
| | <p><xsl:apply-templates /></p> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Sample answers, which may optionally be excluded from the |
---|
| | output. This can be done globally for all answers by setting the |
---|
| |
---|
| | @hide: If "yes", don't include this answer in the output stream. |
---|
| | The default is to include the answer. |
---|
| | --> |
---|
| | <template name="answer" match="answer"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <!-- |
---|
| | It's nice to weed out the sample answer markup at the XSLT processing stage to make LaTeX run faster. |
---|
| | Note that \showanswers still needs to be called so that LaTeX can format chapter headings like "Answers for ..." |
---|
| | --> |
---|
| |
---|
| | <xsl:apply-templates /> |
---|
| | \end{answer} |
---|
| | |
---|
| | </xsl:if> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:if test="$showanswers='yes'"> |
---|
| | <DIV CLASS="answer"> |
---|
| | <div class="answer"> |
---|
| | <xsl:apply-templates /> |
---|
| | </DIV> |
---|
| | </div> |
---|
| | </xsl:if> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Match hidden answers and do nothing. |
---|
| | --> |
---|
| |
---|
| | value can be used, as long as it's a legal identifier in both |
---|
| | LaTeX and HTML. |
---|
| | --> |
---|
| | <template name="section" match="section"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <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> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:if test="@label"><a id="{@label}"></a></xsl:if> |
---|
| | <xsl:apply-templates /> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Footnotes. --> |
---|
| | <template name="footnote" match="footnote"> |
---|
| | <latex>\footnote{<xsl:apply-templates />}</latex> |
---|
| | <html> |
---|
| | <A> |
---|
| | <xsl:attribute name="NAME"> |
---|
| | <common formats="/latex/xelatex/">\footnote{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <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: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> |
---|
| | </a> |
---|
| | </common> |
---|
| | </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"> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <p> |
---|
| | <a> |
---|
| | <xsl:attribute name="name"> |
---|
| | <xsl:text>footnote-</xsl:text> |
---|
| | <xsl:number level="any" count="footnote" /> |
---|
| | <xsl:text>-target</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <SUP> |
---|
| | <sup> |
---|
| | <xsl:text>[</xsl:text> |
---|
| | <xsl:number level="any" count="footnote" /> |
---|
| | <xsl:text>]</xsl:text> |
---|
| | </SUP> |
---|
| | </A> |
---|
| | </sup> |
---|
| | </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"> |
---|
| | <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> |
---|
| | |
---|
| | </a> |
---|
| | </p> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Document preamble stuff: title, author, date. --> |
---|
| | <template name="preamble-title" match="document/title" mode="preamble"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\title{</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="/document/@class = 'assignment'"> |
---|
| | <xsl:if test="$showanswers='yes'">Sample Solution for </xsl:if> |
---|
| | </xsl:when> |
---|
| | </xsl:choose> |
---|
| | <xsl:apply-templates /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <!-- |
---|
| | For HTML, strip out any formatting (e.g., emphasis), as this |
---|
| | is not interpreted within the <TITLE> tag, resulting in raw |
---|
| | is not interpreted within the <title> tag, resulting in raw |
---|
| | HTML markup in the window title. Ick. We do this by just |
---|
| | grabbing the values of all descendant text nodes. |
---|
| | --> |
---|
| | <html> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="/document/@class = 'assignment'"> |
---|
| | <xsl:if test="$showanswers='yes'">Sample Solution for </xsl:if> |
---|
| | </xsl:when> |
---|
| | </xsl:choose> |
---|
| | <xsl:value-of select="." /> |
---|
| | </html> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="preamble-author" match="document/author" mode="preamble"> |
---|
| | <latex>\author{<xsl:apply-templates />}</latex> |
---|
| | <common formats="/latex/xelatex/">\author{<xsl:apply-templates />}</common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="preamble-date" match="document/date" mode="preamble"> |
---|
| | <latex>\date{<xsl:apply-templates />}</latex> |
---|
| | <common formats="/latex/xelatex/">\date{<xsl:apply-templates />}</common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="document-title" match="document/title"> |
---|
| | <!-- Need to do something sensible for LaTeX here. --> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <!-- Under the LaTeX framework, the rest of the chapter title text is generated by LaTeX macros, so this is pretty simple. --> |
---|
| | <!-- I think this is broken? --> |
---|
| | <xsl:if test="/document/@standalone = 'yes'"><xsl:apply-templates /></xsl:if> |
---|
| | </latex> |
---|
| | <html> |
---|
| | <H1> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <h1> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="/document/@class = 'tutorial'"> |
---|
| | <xsl:if test="$showanswers='yes'">Selected Answers for </xsl:if> |
---|
| | <xsl:call-template name="PaperCode" /> |
---|
| | <xsl:text> Tutorial </xsl:text> |
---|
| | <xsl:value-of select="/document/@sequence-number" /> |
---|
| | <xsl:text>: </xsl:text> |
---|
| | <BR /> |
---|
| | <br /> |
---|
| | </xsl:when> |
---|
| | <xsl:when test="/document/@class = 'laboratory'"> |
---|
| | <xsl:if test="$showanswers='yes'">Selected Answers for </xsl:if> |
---|
| | <xsl:call-template name="PaperCode" /> |
---|
| | <xsl:text> Lab </xsl:text> |
---|
| | <xsl:value-of select="/document/@sequence-number" /> |
---|
| | <xsl:text>: </xsl:text> |
---|
| | <BR /> |
---|
| | <br /> |
---|
| | </xsl:when> |
---|
| | <xsl:when test="/document/@class = 'assignment'"> |
---|
| | <xsl:if test="$showanswers='yes'">Sample Solution for </xsl:if> |
---|
| | </xsl:when> |
---|
| | </xsl:choose> |
---|
| | <xsl:apply-templates /> |
---|
| | </H1> |
---|
| | </html> |
---|
| | </h1> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- New template for tutorials and labs, which are essentially chapters when included in a course book, but are marked up as documents in themselves. --> |
---|
| | <template name="chapter-title" match="document/title" mode="chapter"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:apply-templates /> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="/document/@class = 'tutorial'"> |
---|
| | <H1><xsl:call-template name="PaperCode" /> Tutorial <xsl:value-of select="/document/@sequence-number" /><xsl:if test="$showanswers='yes'"> Sample Answers</xsl:if>: <BR /><xsl:apply-templates /></H1> |
---|
| | <h1><xsl:call-template name="PaperCode" /> Tutorial <xsl:value-of select="/document/@sequence-number" /><xsl:if test="$showanswers='yes'"> Sample Answers</xsl:if>: <br /><xsl:apply-templates /></h1> |
---|
| | </xsl:when> |
---|
| | <xsl:when test="/document/@class = 'laboratory'"> |
---|
| | <H1><xsl:call-template name="PaperCode" /> Lab <xsl:value-of select="/document/@sequence-number" /><xsl:if test="$showanswers='yes'"> Sample Answers</xsl:if>: <BR /><xsl:apply-templates /></H1> |
---|
| | <h1><xsl:call-template name="PaperCode" /> Lab <xsl:value-of select="/document/@sequence-number" /><xsl:if test="$showanswers='yes'"> Sample Answers</xsl:if>: <br /><xsl:apply-templates /></h1> |
---|
| | </xsl:when> |
---|
| | <xsl:otherwise> |
---|
| | <H1><xsl:apply-templates /></H1> |
---|
| | <h1><xsl:apply-templates /></h1> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="document-author" match="document/author"> |
---|
| | <html><p><xsl:apply-templates /></p></html> |
---|
| | </template> |
---|
| | <common formats="/html/xhtml/"><p><xsl:apply-templates /></p></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="document-date" match="document/date" /> |
---|
| | |
---|
| | <!-- |
---|
| |
---|
| | 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> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <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> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Generate section title with nested numbering, e.g., 1.1.3. --> |
---|
| | <template name="section-title" match="section/title"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:param name="label" /> |
---|
| | <xsl:text>\</xsl:text> |
---|
| | <!-- Generate the correct number of "sub"s for LaTeX. --> |
---|
| | <xsl:call-template name="generate-subs"> |
---|
| |
---|
| | <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> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <!-- 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: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> |
---|
| | <xsl:text disable-output-escaping="yes"></h</xsl:text><xsl:number value="$depth" /><xsl:text disable-output-escaping="yes">></xsl:text> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| |
---|
| | 'center' | 'centre' |
---|
| | 'right' |
---|
| | --> |
---|
| | <template name="quotation" match="quotation"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="(@align = 'left') or (@align = 'right')"> |
---|
| | <xsl:text>\begin{flush</xsl:text> |
---|
| | <xsl:value-of select="@align" /> |
---|
| |
---|
| | <xsl:apply-templates /> |
---|
| | <xsl:text>\end{quote}</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </latex> |
---|
| | <!-- Nominally we should use <BLOCKQUOTE>, but it doesn't have alignment. --> |
---|
| | <html> |
---|
| | <P> |
---|
| | </common> |
---|
| | <!-- Nominally we should use <blockquote>, but it doesn't have alignment. --> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <p> |
---|
| | <xsl:if test="@align"> |
---|
| | <xsl:attribute name="ALIGN"> |
---|
| | <xsl:attribute name="align"> |
---|
| | <xsl:value-of select="@align" /> |
---|
| | </xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <I><xsl:apply-templates /></I> |
---|
| | </P> |
---|
| | </html> |
---|
| | </template> |
---|
| | <i><xsl:apply-templates /></i> |
---|
| | </p> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Anything inside a <metadata> is ignored completely. (More |
---|
| |
---|
| | <!-- |
---|
| | 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> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text> |
---|
| | \begin{comment}</xsl:text> |
---|
| | <xsl:apply-templates /> |
---|
| | <xsl:text>\end{comment} |
---|
| | </xsl:text> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:comment> |
---|
| | <xsl:apply-templates /> |
---|
| | </xsl:comment> |
---|
| | </html> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Tabular structures (LaTeX {tabular}, HTML <TABLE>). |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Tabular structures (LaTeX {tabular}, HTML <table>). |
---|
| | |
---|
| | @align: The alignment of the table as a whole. |
---|
| | 'left' [default] |
---|
| | 'center' | 'centre' |
---|
| |
---|
| | @rotate (LaTeX only): Rotation angle of tabular in degrees |
---|
| | anti-clockwise. |
---|
| | --> |
---|
| | <template name="tabular" match="tabular"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <!-- spacing --> |
---|
| | <xsl:text> |
---|
| | |
---|
| | </xsl:text> |
---|
| |
---|
| | <!-- spacing --> |
---|
| | <xsl:text> |
---|
| | |
---|
| | </xsl:text> |
---|
| | </latex> |
---|
| | <html> |
---|
| | <TABLE> |
---|
| | <xsl:attribute name="BORDER"> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <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:attribute name="align"> |
---|
| | <xsl:value-of select="@align" /> |
---|
| | </xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <!-- |
---|
| |
---|
| | --> |
---|
| | <xsl:apply-templates select="tabular-header" /> |
---|
| | <xsl:apply-templates select="tabular-footer" /> |
---|
| | <xsl:apply-templates select="tabular-body" /> |
---|
| | </TABLE> |
---|
| | </html> |
---|
| | </template> |
---|
| | </table> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Specify column formatting, mainly for LaTeX, although |
---|
| | HTML does get <TD> ALIGN values from here. |
---|
| | HTML does get <td> ALIGN values from here. |
---|
| | |
---|
| | @align: The alignment of this particular column. |
---|
| | 'left' [default] |
---|
| | 'center' | 'centre' |
---|
| |
---|
| | required, because \multicolumn overrides the default border |
---|
| | specification. |
---|
| | --> |
---|
| | <template name="aligned-tabular-column" match="tabular-columns/column[@align]"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:value-of select="@left-border" /> |
---|
| | <xsl:value-of select="substring(@align, 1, 1)" /> |
---|
| | <xsl:value-of select="@right-border" /> |
---|
| | </latex> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="unaligned-tabular-column" match="tabular-columns/column[not(@align)]"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:value-of select="@left-border" /> |
---|
| | <xsl:text>l</xsl:text> |
---|
| | <xsl:value-of select="@right-border" /> |
---|
| | </latex> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="tabular-header" match="tabular-header"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <THEAD> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <thead> |
---|
| | <xsl:apply-templates /> |
---|
| | </THEAD> |
---|
| | </html> |
---|
| | </thead> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="tabular-footer" match="tabular-footer"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <TFOOT> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <tfoot> |
---|
| | <xsl:apply-templates /> |
---|
| | </TFOOT> |
---|
| | </html> |
---|
| | </tfoot> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="tabular-body" match="tabular-body"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <TBODY> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <tbody> |
---|
| | <xsl:apply-templates /> |
---|
| | </TBODY> |
---|
| | </html> |
---|
| | </tbody> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | @no-page-break: Inhibit page breaks after this row (LaTeX only). |
---|
| | --> |
---|
| | <template name="row" match="row"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:apply-templates /> |
---|
| | <!-- TODO: Don't put a \\ on the last row of a tabular. --> |
---|
| | <xsl:text> \\</xsl:text> |
---|
| | <xsl:if test="@no-page-break = 'yes'">*</xsl:if> |
---|
| | <xsl:text> </xsl:text> |
---|
| | </latex> |
---|
| | <html> |
---|
| | <TR> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <tr> |
---|
| | <xsl:if test="@valign"> |
---|
| | <xsl:attribute name="VALIGN"><xsl:value-of select="@valign" /></xsl:attribute> |
---|
| | <xsl:attribute name="valign"><xsl:value-of select="@valign" /></xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <xsl:apply-templates /> |
---|
| | </TR> |
---|
| | </html> |
---|
| | </tr> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Horizontal rules (LaTeX only). |
---|
| |
---|
| | 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> |
---|
| | <common formats="/latex/xelatex/"><xsl:text>\hline </xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="row-rule-partial" match="row-rule[@columns]"> |
---|
| | <latex>\cline{<xsl:value-of select="@columns" />}</latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\cline{<xsl:value-of select="@columns" />}</common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Hmm, the multi-row stuff is somewhat broken in LaTeX, oops. |
---|
| | Need to insert missing columns (as was done in the calendar |
---|
| |
---|
| | @rows: The number of rows this cell spans. |
---|
| | @header: Is this a header cell? [yes, NO] |
---|
| | --> |
---|
| | <template name="multirow-cell" match="cell" mode="latex-multi-row"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\multirow{</xsl:text> |
---|
| | <xsl:value-of select="@rows" /> |
---|
| | <xsl:text>}{*}{</xsl:text> |
---|
| | <xsl:if test="@header = 'yes'"><xsl:text>\textbf{</xsl:text></xsl:if> |
---|
| |
---|
| | <xsl:text>\end{tabular} |
---|
| | </xsl:text></xsl:if> |
---|
| | <xsl:if test="@header = 'yes'"><xsl:text>}</xsl:text></xsl:if> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </latex> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Multi-column cells (LaTeX only, as this is pretty trivial to |
---|
| | achieve in HTML). |
---|
| |
---|
| | $num-columns: The number of rows this cell spans. |
---|
| | @header: Is this a header cell? [yes, NO] |
---|
| | --> |
---|
| | <template name="multicolumn-cell" match="cell" mode="latex-multi-column"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:param name="num-columns">1</xsl:param> |
---|
| | <xsl:text>\multicolumn{</xsl:text> |
---|
| | <xsl:value-of select="$num-columns" /> |
---|
| | <xsl:text>}{</xsl:text> |
---|
| |
---|
| | <xsl:if test="@header = 'yes'"><xsl:text>}</xsl:text></xsl:if> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </latex> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Top-level template for generating cells. |
---|
| | |
---|
| |
---|
| | |
---|
| | This is the sort of algorithm that can only really be |
---|
| | clearly described by a flow chart :) |
---|
| | --> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@columns"> |
---|
| | <xsl:apply-templates select="." mode="latex-multi-column"> |
---|
| | <xsl:with-param name="num-columns" select="@columns" /> |
---|
| |
---|
| | <xsl:if test="@header = 'yes'"><xsl:text>}</xsl:text></xsl:if> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:if test="$column-no != last()"> & </xsl:if> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <!-- |
---|
| | It's much easier in HTML, because a <TD> is a <TD> is a |
---|
| | <TD>, regardless of the attributes supplied. |
---|
| | It's much easier in HTML, because a <td> is a <td> is a |
---|
| | <td>, regardless of the attributes supplied. |
---|
| | --> |
---|
| | <html> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <!-- |
---|
| | Hmm, how to generate either a TD or TH as required, |
---|
| | including attributes, without repeating code? |
---|
| | |
---|
| | Aha, the answer is attribute value templates! |
---|
| | --> |
---|
| | <xsl:variable name="celltype"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@header = 'yes'">TH</xsl:when> |
---|
| | <xsl:otherwise>TD</xsl:otherwise> |
---|
| | <xsl:when test="@header = 'yes'">th</xsl:when> |
---|
| | <xsl:otherwise>td</xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:variable> |
---|
| | <xsl:element name="{$celltype}"> |
---|
| | <xsl:attribute name="ALIGN"> |
---|
| | <xsl:attribute name="align"> |
---|
| | <xsl:value-of select="@align" /> |
---|
| | <xsl:if test="not(@align)"> |
---|
| | <xsl:value-of select="ancestor::tabular/tabular-columns/column[position() = $column-no]/@align" /> |
---|
| | <xsl:if test="not(ancestor::tabular/tabular-columns/column[position() = $column-no]/@align)">left</xsl:if> |
---|
| | </xsl:if> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="VALIGN"> |
---|
| | <xsl:attribute name="valign"> |
---|
| | <xsl:value-of select="@valign" /> |
---|
| | <xsl:if test="not(@valign)">middle</xsl:if> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="COLSPAN"> |
---|
| | <xsl:attribute name="colspan"> |
---|
| | <xsl:value-of select="@columns" /> |
---|
| | <xsl:if test="not(@columns)">1</xsl:if> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="ROWSPAN"> |
---|
| | <xsl:attribute name="rowspan"> |
---|
| | <xsl:value-of select="@rows" /> |
---|
| | <xsl:if test="not(@rows)">1</xsl:if> |
---|
| | </xsl:attribute> |
---|
| | <xsl:apply-templates /> |
---|
| | </xsl:element> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Hyperlinks. The content of the element is the hyperlink text. |
---|
| |
---|
| | @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 and node()]"> |
---|
| | <latex>\hyperref[<xsl:value-of select="@label" />]{<xsl:apply-templates />}</latex> |
---|
| | <html><A HREF="#{@label}"><xsl:apply-templates /></A></html> |
---|
| | <common formats="/latex/xelatex/">\hyperref[<xsl:value-of select="@label" />]{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><a href="#{@label}"><xsl:apply-templates /></a></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="empty-hyperlink-label" match="hyperlink[@label and not(node())]"> |
---|
| | <common> |
---|
| |
---|
| | </common> |
---|
| | </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> |
---|
| | <common formats="/latex/xelatex/">\href{<xsl:value-of select="@url" />}{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><a href="{@url}"><xsl:apply-templates /></a></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"> |
---|
| | <!-- Note: not safe to use the url package here because \url{...} is fragile. --> |
---|
| | <latex>\url{<xsl:value-of select="@url" />}</latex> |
---|
| | <html><A HREF="{@url}"><CODE><xsl:value-of select="@url" /></CODE></A></html> |
---|
| | <common formats="/latex/xelatex/">\url{<xsl:value-of select="@url" />}</common> |
---|
| | <common formats="/html/xhtml/"><a href="{@url}"><code><xsl:value-of select="@url" /></code></a></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="hyperlink-bogus" match="hyperlink[@url and @label]" priority="2"> |
---|
| | <common> |
---|
| |
---|
| | |
---|
| | <!-- Internal parameterised hyperlink template to be called by the likes of the empty Oracle documentation elements. --> |
---|
| | <template name="hyperlink-internal" match="hyperlink" mode="hyperlink-internal"> |
---|
| | <common> |
---|
| | <xsl:param xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" name="url" /> |
---|
| | <xsl:param xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" name="label" /> |
---|
| | </common> |
---|
| | <latex>\href{<xsl:value-of select="$url" />}{<xsl:apply-templates select="exsl:node-set($label)" />}</latex> |
---|
| | <html><A HREF="{$url}"><xsl:apply-templates select="exsl:node-set($label)" /></A></html> |
---|
| | <xsl:param name="url" /> |
---|
| | <xsl:param name="label" /> |
---|
| | </common> |
---|
| | <common formats="/latex/xelatex/">\href{<xsl:value-of select="$url" />}{<xsl:apply-templates select="exsl:node-set($label)" />}</common> |
---|
| | <common formats="/html/xhtml/"><a href="{$url}"><xsl:apply-templates select="exsl:node-set($label)" /></a></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="empty-hyperlink-url-internal" match="hyperlink" mode="empty-hyperlink-internal"> |
---|
| | <common><xsl:param xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" name="url" /></common> |
---|
| | <latex>\url{<xsl:value-of select="$url" />}</latex> |
---|
| | <html><A HREF="{$url}"><CODE><xsl:value-of select="$url" /></CODE></A></html> |
---|
| | <common><xsl:param name="url" /></common> |
---|
| | <common formats="/latex/xelatex/">\url{<xsl:value-of select="$url" />}</common> |
---|
| | <common formats="/html/xhtml/"><a href="{$url}"><code><xsl:value-of select="$url" /></code></a></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- A plain URL (i.e., not necessarily a hyperlink). --> |
---|
| | <template name="url" match="url|uri|email|e-mail|email-address|e-mail-address"> |
---|
| |
---|
| | Not really what we want (as the link aspect is already dealt |
---|
| | with by the <hyperlink> templates), so we'll just use |
---|
| | \texttt{...}. |
---|
| | --> |
---|
| | <latex>\nolinkurl{<xsl:apply-templates />}</latex> |
---|
| | <html><CODE><xsl:apply-templates /></CODE></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\nolinkurl{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><code><xsl:apply-templates /></code></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> |
---|
| | <common formats="/latex/xelatex/">Section~\ref*{<xsl:value-of select="@label" />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:text disable-output-escaping="yes">Section&nbsp;</xsl:text> |
---|
| | <xsl:number count="section" level="multiple" format="1.1.1.1.1.1" /> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="figure-reference" match="figure" mode="reference"> |
---|
| | <latex>Figure~\ref*{<xsl:value-of select="@label" />}</latex> |
---|
| | <html> |
---|
| | <common formats="/latex/xelatex/">Figure~\ref*{<xsl:value-of select="@label" />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:text disable-output-escaping="yes">Figure&nbsp;</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="$showanswers='yes'"> |
---|
| | <xsl:number count="figure" level="any" format="1" /> |
---|
| |
---|
| | <xsl:otherwise> |
---|
| | <xsl:number count="figure[not(ancestor::answer) and not(ancestor::omit) and not(ancestor::comment)]" level="any" format="1" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="table-reference" match="table" mode="reference"> |
---|
| | <latex>Table~\ref*{<xsl:value-of select="@label" />}</latex> |
---|
| | <html> |
---|
| | <common formats="/latex/xelatex/">Table~\ref*{<xsl:value-of select="@label" />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:text disable-output-escaping="yes">Table&nbsp;</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="$showanswers='yes'"> |
---|
| | <xsl:number count="table" level="any" format="1" /> |
---|
| |
---|
| | <xsl:otherwise> |
---|
| | <xsl:number count="table[not(ancestor::answer) and not(ancestor::omit) and not(ancestor::comment)]" level="any" format="1" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Figures & tables (in the LaTeX sense, i.e., "floating" items). --> |
---|
| | <template name="figure" match="figure"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | \begin{figure}<xsl:if test="@latex-placement">[<xsl:value-of select="@latex-placement" />]</xsl:if> |
---|
| | \centering |
---|
| | <xsl:apply-templates select="*[not(self::caption)]" /> |
---|
| | <xsl:if test="count(caption) != 0"> |
---|
| |
---|
| | <xsl:if test="@label">\label{<xsl:value-of select="@label" />}</xsl:if> |
---|
| | <xsl:if test="count(id) != 0">\label{<xsl:value-of select="id" />}</xsl:if> |
---|
| | </xsl:if> |
---|
| | \end{figure} |
---|
| | </latex> |
---|
| | <html> |
---|
| | <DIV CLASS="figure"> |
---|
| | <CENTER> |
---|
| | <xsl:if test="@label"><A NAME="{@label}"></A></xsl:if> |
---|
| | <xsl:if test="count(id) != 0"><A NAME="{id}"></A></xsl:if> |
---|
| | <xsl:apply-templates select="*[not(self::caption)]" /> |
---|
| | <xsl:if test="count(caption) != 0"> |
---|
| | <BR /> |
---|
| | <xsl:apply-templates select="caption" /> |
---|
| | </xsl:if> |
---|
| | </CENTER> |
---|
| | </DIV> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <div class="figure" style="margin-left, margin-right: auto;"> |
---|
| | <xsl:if test="@label"><a id="{@label}"></a></xsl:if> |
---|
| | <xsl:if test="count(id) != 0"><a id="{id}"></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> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="table" match="table"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | \begin{table}<xsl:if test="@latex-placement">[<xsl:value-of select="@latex-placement" />]</xsl:if> |
---|
| | \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"> |
---|
| | <CENTER> |
---|
| | <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> |
---|
| | </CENTER> |
---|
| | </DIV> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <div class="table" style="margin-left, margin-right: auto;"> |
---|
| | <xsl:if test="@label"><a id="{@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> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="multipart-table" match="table[count(part) > 0]"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:for-each select="part"> |
---|
| | \begin{table}[p] |
---|
| | \centering |
---|
| | <xsl:apply-templates /> |
---|
| |
---|
| | \addtocounter{table}{-1} |
---|
| | \clearpage |
---|
| | </xsl:for-each> |
---|
| | \stepcounter{table} |
---|
| | </latex> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="figure-caption" match="figure/caption"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <STRONG> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <strong> |
---|
| | <xsl:text>Figure </xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="$showanswers='yes'"> |
---|
| | <xsl:number count="figure" level="any" format="1" /> |
---|
| |
---|
| | <xsl:number count="figure[not(ancestor::answer) and not(ancestor::omit) and not(ancestor::comment)]" level="any" format="1" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>. </xsl:text> |
---|
| | </STRONG> |
---|
| | </strong> |
---|
| | <xsl:apply-templates /> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="table-caption" match="table/caption"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <STRONG> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <strong> |
---|
| | <xsl:text>Table </xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="$showanswers='yes'"> |
---|
| | <xsl:number count="table" level="any" format="1" /> |
---|
| |
---|
| | <xsl:number count="table[not(ancestor::answer) and not(ancestor::omit) and not(ancestor::comment)]" level="any" format="1" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>. </xsl:text> |
---|
| | </STRONG> |
---|
| | </strong> |
---|
| | <xsl:apply-templates /> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Images. Includes a scaling factor for LaTeX. |
---|
| |
---|
| | --> |
---|
| | |
---|
| | <!-- LaTeX images are always handled the same way regardless. --> |
---|
| | <template name="latex-image" match="image" mode="latex"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\includegraphics</xsl:text> |
---|
| | <xsl:if test="count(latex-scaling) != 0"> |
---|
| | <xsl:message terminate="no"><latex-scaling> element is deprecated in <image>; please use latex-options attribute instead.</xsl:message> |
---|
| | <xsl:text>[scale=</xsl:text> |
---|
| |
---|
| | <xsl:value-of select="$image-format" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </latex> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="normal-image" match="image[count(provide-large-version) = 0]"> |
---|
| | <latex><xsl:apply-templates select="." mode="latex" /></latex> |
---|
| | <html> |
---|
| | <IMG CLASS="padded" BORDER="0"> |
---|
| | <xsl:attribute name="SRC"> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates select="." mode="latex" /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <img class="padded" style="border: none;"> |
---|
| | <xsl:attribute name="src"> |
---|
| | <!-- |
---|
| | Work out the full path specification for the file |
---|
| | to be included = base-path + location (if specified) + basename. |
---|
| | --> |
---|
| |
---|
| | <xsl:value-of select="$image-format" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="ALT"><xsl:apply-templates select="description" /></xsl:attribute> |
---|
| | </IMG> |
---|
| | </html> |
---|
| | <xsl:attribute name="alt"><xsl:apply-templates select="description" /></xsl:attribute> |
---|
| | </img> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="zoomable-image" match="image[count(provide-large-version) != 0]"> |
---|
| | <latex><xsl:apply-templates select="." mode="latex" /></latex> |
---|
| | <html> |
---|
| | <A> |
---|
| | <xsl:attribute name="HREF"> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates select="." mode="latex" /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <a> |
---|
| | <xsl:attribute name="href"> |
---|
| | <!-- |
---|
| | Work out the full path specification for the file |
---|
| | to be included = base-path + location (if specified) + basename. |
---|
| | --> |
---|
| |
---|
| | <xsl:value-of select="$image-format" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | <IMG CLASS="padded" BORDER="0"> |
---|
| | <xsl:attribute name="SRC"> |
---|
| | <img class="padded" style="border: none;"> |
---|
| | <xsl:attribute name="src"> |
---|
| | <!-- |
---|
| | Work out the full path specification for the file |
---|
| | to be included = base-path + location (if specified) + basename. |
---|
| | --> |
---|
| |
---|
| | <xsl:value-of select="$image-format" /> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="ALT"> |
---|
| | <xsl:attribute name="alt"> |
---|
| | <xsl:apply-templates select="description" /> |
---|
| | </xsl:attribute> |
---|
| | </IMG> |
---|
| | <BR CLEAR="right" /> |
---|
| | </img> |
---|
| | <br clear="right" /> |
---|
| | <xsl:text>(Larger version)</xsl:text> |
---|
| | </A> |
---|
| | </html> |
---|
| | </template> |
---|
| | </a> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Include another XML/HTML/LaTeX document into the current one. If |
---|
| |
---|
| | generate a DOCTYPE when producing HTML, whether you want it or |
---|
| | not, which means that you can only really include entire HTML |
---|
| | documents, rather than HTML fragments (maybe you can turn this |
---|
| | off?). The workaround currently is to embed the HTML document |
---|
| | inside an <OBJECT>. |
---|
| | inside an <object>. |
---|
| | |
---|
| | A similar argument applies for plain text documents (such as |
---|
| | code listings) that we want to include, but are externally |
---|
| | generated and so can't just be embedded in the source XML. |
---|
| |
---|
| | </xsl:if> |
---|
| | <xsl:value-of select="@basename" /> |
---|
| | </xsl:variable> |
---|
| | </common> |
---|
| | <html> |
---|
| | <DIV> |
---|
| | <xsl:attribute name="ALIGN"> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <div> |
---|
| | <xsl:attribute name="align"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@align"><xsl:value-of select="@align" /></xsl:when> |
---|
| | <xsl:otherwise>LEFT</xsl:otherwise> |
---|
| | <xsl:otherwise>left</xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | |
---|
| | <OBJECT DATA="{$file}"> |
---|
| | <object data="{$file}"> |
---|
| | <!-- Output text/html or text/plain as appropriate. --> |
---|
| | <xsl:attribute name="TYPE"> |
---|
| | <xsl:attribute name="type"> |
---|
| | <xsl:text>text/</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@type"><xsl:value-of select="@type" /></xsl:when> |
---|
| | <xsl:otherwise><xsl:text>html</xsl:text></xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="WIDTH"> |
---|
| | <xsl:attribute name="width"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@width"><xsl:value-of select="@width" /></xsl:when> |
---|
| | <xsl:otherwise><xsl:text>100%</xsl:text></xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | <xsl:attribute name="HEIGHT"> |
---|
| | <xsl:attribute name="height"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@height"><xsl:value-of select="@height" /></xsl:when> |
---|
| | <xsl:otherwise><xsl:text>100%</xsl:text></xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xsl:attribute> |
---|
| | </OBJECT> |
---|
| | </DIV> |
---|
| | </html> |
---|
| | <latex> |
---|
| | </object> |
---|
| | </div> |
---|
| | </common> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\</xsl:text> |
---|
| | <!-- |
---|
| | Note that input text files are currently verbatim'd in |
---|
| | LaTeX. We may want to change this in future? |
---|
| |
---|
| | </xsl:if> |
---|
| | <xsl:text>input{</xsl:text> |
---|
| | <xsl:value-of select="$file" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </latex> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Note that including XML documents is currently problematic, |
---|
| | as the document() function expects a valid XML document. |
---|
| |
---|
| | |
---|
| | @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> |
---|
| | <common formats="/latex/xelatex/">\usepackage<xsl:if test="@options">[<xsl:value-of select="@options" />]</xsl:if>{<xsl:value-of select="." />}</common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Execute a preamble LaTeX command. Use to set up things like |
---|
| | counters, fonts, hyperref options, etc. |
---|
| | --> |
---|
| | <template name="latex-command" match="latex-commands/command"> |
---|
| | <latex><xsl:value-of select="." /></latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/"><xsl:value-of select="." /></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | LaTeX hyphenation. A space-delimited list of hyphenated words. |
---|
| | --> |
---|
| | <template name="latex-hyphenation" match="latex-commands/hyphenation"> |
---|
| | <latex>\hyphenation{<xsl:value-of select="." />}</latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\hyphenation{<xsl:value-of select="." />}</common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Hmm, the following may be more complex than I thought... |
---|
| |
---|
| | |
---|
| | @options: The required document class options. [optional] |
---|
| | --> |
---|
| | <template name="latex-documentclass" match="latex-documentclass|documentclass"> |
---|
| | <latex>\documentclass{<xsl:value-of select="." />}</latex> |
---|
| | <common formats="/latex/xelatex/">\documentclass[<xsl:value-of select="@options" />]{<xsl:value-of select="." />}</common> |
---|
| | </template> |
---|
| | <template name="latex-documentclass-options" match="latex-documentclass[@options]|documentclass[@options]"> |
---|
| | <latex>\documentclass[<xsl:value-of select="@options" />]{<xsl:value-of select="." />}</latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\documentclass[<xsl:value-of select="@options" />]{<xsl:value-of select="." />}</common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Specify additional LaTeX document class options (i.e., in |
---|
| | addition to the defaults). These should be a comma-separated |
---|
| | list of the required options. These will be appended to the |
---|
| | standard defaults (a4paper, 12pt). |
---|
| | --> |
---|
| | <template name="latex-document-options" match="latex-document-options"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Sometimes we might need to embed raw code to handle something tricky. |
---|
| | --> |
---|
| | <template name="raw-latex" match="raw-code[@format = 'latex']|raw-latex"> |
---|
| | <latex><xsl:apply-templates /></latex> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | This can be a tricky if the document being processed declares any |
---|
| | namespaces, as they generally end up attached to the first element |
---|
| | of the raw HTML. I haven't discovered a workaround yet :(. |
---|
| | --> |
---|
| | <template name="raw-html" match="raw-code[@format = 'html']|raw-html"> |
---|
| | <html><xsl:copy-of select="*" /></html> |
---|
| | <common formats="/html/xhtml/"><xsl:copy-of select="*" /></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Generate a LaTeX \input{} macro. --> |
---|
| | <template name="latex-input" match="latex-input"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:message>Use of latex-input is deprecated. Please use include-document instead.</xsl:message> |
---|
| | \input{<xsl:value-of select="." />} |
---|
| | </latex> |
---|
| | </template> |
---|
| | |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Conditional processing depending on the format. It may appear |
---|
| | redundant to have two templates, but this is the only way to |
---|
| |
---|
| | @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> |
---|
| | <common formats="/latex/xelatex/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="process-when-html" match="process-when[@format = 'html']"> |
---|
| | <html><xsl:apply-templates /></html> |
---|
| | </template> |
---|
| | <common formats="/html/xhtml/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Basic maths stuff. Anything more complicated is... complicated. |
---|
| |
---|
| | 'inline' [default] display expression inline |
---|
| | 'display' display expression in its own paragraph |
---|
| | --> |
---|
| | <template name="math-inline" match="math|math[@style='inline']"> |
---|
| | <latex>\(<xsl:apply-templates />\)</latex> |
---|
| | <html><xsl:apply-templates /></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\(<xsl:apply-templates />\)</common> |
---|
| | <common formats="/html/xhtml/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="math-display" match="math[@style='display']"> |
---|
| | <latex>\[<xsl:apply-templates />\]</latex> |
---|
| | <html><P ALIGN="center"><xsl:apply-templates /></P></html> |
---|
| | </template> |
---|
| | |
---|
| | <common formats="/latex/xelatex/">\[<xsl:apply-templates />\]</common> |
---|
| | <common formats="/html/xhtml/"><p align="center"><xsl:apply-templates /></p></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Equation arrays --> |
---|
| | |
---|
| | <template name="equation-array" match="equation-array"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <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> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <table class="equation" border="0" align="center"><xsl:apply-templates /></table> |
---|
| | </common> |
---|
| | </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> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <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> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <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> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- Roman (upright) text inside math environments. \mathrm sounds like it's probably more correct, but doesn't retain spaces (which \textup does). --> |
---|
| | <template name="math-text" match="text"> |
---|
| | <latex>\textup{<xsl:apply-templates />}</latex> |
---|
| | <html><xsl:apply-templates /></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\textup{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:apply-templates /></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Calligraphic letters (upper case only for LaTeX). |
---|
| | --> |
---|
| | <template name="calligraphic-text" match="calligraphic|cursive"> |
---|
| | <latex>\ensuremath{\mathcal{<xsl:apply-templates />}}</latex> |
---|
| | <html><FONT FACE="cursive"><xsl:apply-templates /></FONT></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\mathcal{<xsl:apply-templates />}}</common> |
---|
| | <common formats="/html/xhtml/"><font face="cursive"><xsl:apply-templates /></font></common> |
---|
| | </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|digitsep"> |
---|
| | <common><xsl:call-template name="thin-space" /></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Mathematical super- and subscript. --> |
---|
| | <template name="superscript-math" match="math//superscript"> |
---|
| | <latex>\ensuremath{^{<xsl:apply-templates />}}</latex> |
---|
| | <html><SUP><xsl:apply-templates /></SUP></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{^{<xsl:apply-templates />}}</common> |
---|
| | <common formats="/html/xhtml/"><sup><xsl:apply-templates /></sup></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="subscript-math" match="math//subscript"> |
---|
| | <latex>\ensuremath{_{<xsl:apply-templates />}}</latex> |
---|
| | <html><SUB><xsl:apply-templates /></SUB></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{_{<xsl:apply-templates />}}</common> |
---|
| | <common formats="/html/xhtml/"><sub><xsl:apply-templates /></sub></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Basic mathematical operators. |
---|
| | |
---|
| |
---|
| | <common>+</common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="minus-operator" match="minus"> |
---|
| | <latex>\ensuremath{-}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{-}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&minus;</xsl:text></html> |
---|
| | </template> |
---|
| | <xhtml>−</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="times-operator" match="times"> |
---|
| | <latex>\ensuremath{\times}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\times}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&times;</xsl:text></html> |
---|
| | </template> |
---|
| | <xhtml>×</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="divide-operator" match="divide"> |
---|
| | <common>/</common> |
---|
| | </template> |
---|
| |
---|
| | </template> |
---|
| | |
---|
| | <template name="not-equals-operator" match="not-equals|ne"> |
---|
| | <!-- Need spaces for HTML as they seem to get munched otherwise. --> |
---|
| | <latex>\ensuremath{\neq}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\neq}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&ne;</xsl:text></html> |
---|
| | <xhtml>≠</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="greater-than-operator" match="greater-than|gt"> |
---|
| | <!-- Need spaces for HTML as they seem to get munched otherwise. --> |
---|
| | <latex> \ensuremath{>} </latex> |
---|
| | <html><xsl:text disable-output-escaping="yes">&gt;</xsl:text></html> |
---|
| | <common formats="/latex/xelatex/"> \ensuremath{<} </common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">&gt;</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="greater-equals-operator" match="greater-equals|ge"> |
---|
| | <!-- Need spaces for HTML as they seem to get munched otherwise. --> |
---|
| | <latex> \ensuremath{\geq} </latex> |
---|
| | <common formats="/latex/xelatex/"> \ensuremath{\geq} </common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&ge;</xsl:text></html> |
---|
| | <xhtml>≥</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="less-than-operator" match="less-than|lt"> |
---|
| | <!-- Need spaces for HTML as they seem to get munched otherwise. --> |
---|
| | <latex> \ensuremath{<} </latex> |
---|
| | <html><xsl:text disable-output-escaping="yes">&lt;</xsl:text></html> |
---|
| | <common formats="/latex/xelatex/"> \ensuremath{<} </common> |
---|
| | <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes">&lt;</xsl:text></common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="less-equals-operator" match="less-equals|le"> |
---|
| | <!-- Need spaces for HTML as they seem to get munched otherwise. --> |
---|
| | <latex> \ensuremath{\leq} </latex> |
---|
| | <common formats="/latex/xelatex/"> \ensuremath{\leq} </common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&le;</xsl:text></html> |
---|
| | <xhtml>≤</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="approximately-equals-operator" match="approximately-equals|approximately-equal-to|approx"> |
---|
| | <latex>\ensuremath{\approx}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\approx}</common> |
---|
| | <html><xsl:text disable-output-escaping="yes">&asymp;</xsl:text></html> |
---|
| | </template> |
---|
| | <xhtml>≈</xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="right-arrow" match="right-arrow|rightarrow|implies|rarr|rarrow"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text> \ensuremath{\</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@weight='double'">R</xsl:when> |
---|
| | <xsl:otherwise>r</xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>ightarrow} </xsl:text> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <html> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@weight='double'"> |
---|
| | <xsl:text disable-output-escaping="yes">&rArr;</xsl:text> |
---|
| |
---|
| | <xsl:text disable-output-escaping="yes">&rarr;</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | <xhtml> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@weight='double'"> |
---|
| | <xsl:text disable-output-escaping="yes">⇒</xsl:text> |
---|
| | </xsl:when> |
---|
| | <xsl:otherwise> |
---|
| | <xsl:text disable-output-escaping="yes">→</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <template name="left-arrow" match="left-arrow|leftarrow|larr|larrow"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text> \ensuremath{\</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@weight='double'">L</xsl:when> |
---|
| | <xsl:otherwise>l</xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>eftarrow} </xsl:text> |
---|
| | </latex> |
---|
| | </common> |
---|
| | <html> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@weight='double'"> |
---|
| | <xsl:text disable-output-escaping="yes">&lArr;</xsl:text> |
---|
| |
---|
| | <xsl:text disable-output-escaping="yes">&larr;</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </html> |
---|
| | </template> |
---|
| | <xhtml> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@weight='double'"> |
---|
| | <xsl:text disable-output-escaping="yes">⇐</xsl:text> |
---|
| | </xsl:when> |
---|
| | <xsl:otherwise> |
---|
| | <xsl:text disable-output-escaping="yes">←</xsl:text> |
---|
| | </xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | </xhtml> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | The equivalent of LaTeX's "log-like functions". |
---|
| | |
---|
| |
---|
| | 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="function"> |
---|
| | <latex>\ensuremath{\<xsl:value-of select="@name" />}</latex> |
---|
| | <html><xsl:value-of select="@name" /></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\<xsl:value-of select="@name" />}</common> |
---|
| | <common formats="/html/xhtml/"><xsl:value-of select="@name" /></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Any mathematical variable names. --> |
---|
| | <template name="math-variable" match="variable|var"> |
---|
| | <latex>\ensuremath{\mathit{<xsl:apply-templates />}}</latex> |
---|
| | <html><I><xsl:apply-templates /></I></html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\mathit{<xsl:apply-templates />}}</common> |
---|
| | <common formats="/html/xhtml/"><i><xsl:apply-templates /></i></common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- A displayed fraction. Is there a nicer way of doing this in HTML? --> |
---|
| | <template name="math-fraction" match="fraction"> |
---|
| | <latex>\ensuremath{\frac{<xsl:apply-templates select="numerator" />}{<xsl:apply-templates select="denominator" />}}</latex> |
---|
| | <common formats="/latex/xelatex/">\ensuremath{\frac{<xsl:apply-templates select="numerator" />}{<xsl:apply-templates select="denominator" />}}</common> |
---|
| | <html> |
---|
| | <SUP><xsl:apply-templates select="numerator" /></SUP> |
---|
| | <sup><xsl:apply-templates select="numerator" /></sup> |
---|
| | <xsl:text disable-output-escaping="yes">&frasl;</xsl:text> |
---|
| | <SUB><xsl:apply-templates select="denominator" /></SUB> |
---|
| | <sub><xsl:apply-templates select="denominator" /></sub> |
---|
| | </html> |
---|
| | </template> |
---|
| | <xhtml> |
---|
| | <sup><xsl:apply-templates select="numerator" /></sup> |
---|
| | <xsl:text disable-output-escaping="yes">⁄</xsl:text> |
---|
| | <sub><xsl:apply-templates select="denominator" /></sub> |
---|
| | </xhtml> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Format a University paper code. These normally appear in the form |
---|
| |
---|
| | multiplied by 100 for HTML). Individual column widths are then |
---|
| | expressed as a fraction of this total width. [default is 1] |
---|
| | --> |
---|
| | <template name="multi-column" match="multi-column"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:variable name="total-width"> |
---|
| | <xsl:value-of select="1" /> |
---|
| | <xsl:if test="@width"><xsl:value-of select="@width" /></xsl:if> |
---|
| | </xsl:variable> |
---|
| |
---|
| | <xsl:when test="@vspace = 'medium'">\medskip</xsl:when> |
---|
| | <xsl:when test="@vspace = 'big'">\bigskip</xsl:when> |
---|
| | <xsl:when test="@vspace">\vskip<xsl:value-of select="@vspace" /></xsl:when> |
---|
| | </xsl:choose> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:variable name="total-width"> |
---|
| | <xsl:value-of select="100" /> |
---|
| | <xsl:if test="@width"><xsl:value-of select="@width * 100" /></xsl:if> |
---|
| | </xsl:variable> |
---|
| | <xsl:if test="@vspace"><BR /></xsl:if> |
---|
| | <TABLE BORDER="0" WIDTH="{$total-width}%"> |
---|
| | <xsl:if test="@vspace"><br /></xsl:if> |
---|
| | <table border="0" width="{$total-width}%"> |
---|
| | <xsl:if test="@align"> |
---|
| | <xsl:attribute name="ALIGN"> |
---|
| | <xsl:attribute name="align"> |
---|
| | <xsl:value-of select="@align" /> |
---|
| | </xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <TR> |
---|
| | <tr> |
---|
| | <xsl:apply-templates> |
---|
| | <xsl:with-param name="default-width"> |
---|
| | <xsl:value-of select="round($total-width div count(column))" /> |
---|
| | </xsl:with-param> |
---|
| | </xsl:apply-templates> |
---|
| | </TR> |
---|
| | </TABLE> |
---|
| | <xsl:if test="@vspace"><BR /></xsl:if> |
---|
| | </html> |
---|
| | </template> |
---|
| | </tr> |
---|
| | </table> |
---|
| | <xsl:if test="@vspace"><br /></xsl:if> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | A column within a multi-column element. |
---|
| | |
---|
| |
---|
| | |
---|
| | @align: How each individual column is to be aligned internally. |
---|
| | --> |
---|
| | <template name="multi-column-column" match="multi-column/column"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:param name="default-width">1</xsl:param> |
---|
| | <xsl:text>\begin{minipage}{</xsl:text> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@width"><xsl:value-of select="@width" /></xsl:when> |
---|
| |
---|
| | </xsl:choose> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </xsl:if> |
---|
| | <xsl:text>\end{minipage}</xsl:text> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:param name="default-width">100</xsl:param> |
---|
| | <TD> |
---|
| | <xsl:attribute name="WIDTH"> |
---|
| | <td> |
---|
| | <xsl:attribute name="width"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="@width"><xsl:value-of select="@width * 100" /></xsl:when> |
---|
| | <xsl:otherwise><xsl:value-of select="$default-width" /></xsl:otherwise> |
---|
| | </xsl:choose> |
---|
| | <xsl:text>%</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:if test="@align"> |
---|
| | <xsl:attribute name="ALIGN"> |
---|
| | <xsl:attribute name="align"> |
---|
| | <xsl:value-of select="@align" /> |
---|
| | </xsl:attribute> |
---|
| | </xsl:if> |
---|
| | <xsl:apply-templates /> |
---|
| | </TD> |
---|
| | </html> |
---|
| | </template> |
---|
| | </td> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Center stuff on the page. |
---|
| | --> |
---|
| | <template name="center" match="center|centering|centre|centring"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | \begin{center} |
---|
| | <xsl:apply-templates /> |
---|
| | \end{center} |
---|
| | </latex> |
---|
| | <html> |
---|
| | <CENTER> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <div style="margin-left, margin-right: auto;"> |
---|
| | <xsl:apply-templates /> |
---|
| | </CENTER> |
---|
| | </html> |
---|
| | </template> |
---|
| | </div> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Simple numbered bibliographies and reference lists (equivalent |
---|
| |
---|
| | "References" is used if not specified. |
---|
| | |
---|
| | --> |
---|
| | <template name="bibliography" match="bibliography"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:if test="@name"> |
---|
| | \renewcommand{\refname}{<xsl:value-of select="@name" />} |
---|
| | </xsl:if> |
---|
| | \bibliographystyle{plain} |
---|
| | \begin{thebibliography}{99} |
---|
| | <xsl:apply-templates /> |
---|
| | \end{thebibliography} |
---|
| | </latex> |
---|
| | <html> |
---|
| | <H1> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <h1> |
---|
| | <xsl:value-of select="@name" /> |
---|
| | <xsl:if test="not(@name)">References</xsl:if> |
---|
| | </H1> |
---|
| | <OL> |
---|
| | </h1> |
---|
| | <ol> |
---|
| | <xsl:apply-templates /> |
---|
| | </OL> |
---|
| | </html> |
---|
| | </template> |
---|
| | </ol> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | An item within a bibliography. |
---|
| | |
---|
| | @label: The unique label of the bibliography item, so it can |
---|
| | be cited. [REQUIRED] |
---|
| | --> |
---|
| | <template name="bibitem" match="bibliography/item"> |
---|
| | <latex>\bibitem{<xsl:value-of select="@label" />} <xsl:apply-templates /></latex> |
---|
| | <html> |
---|
| | <LI><A NAME="{@label}"></A><xsl:apply-templates /></LI> |
---|
| | </html> |
---|
| | </template> |
---|
| | <common formats="/latex/xelatex/">\bibitem{<xsl:value-of select="@label" />} <xsl:apply-templates /></common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <li><a id="{@label}"></a><xsl:apply-templates /></li> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | A citation. To cater for multiple cited items, the items are |
---|
| | specified using nested <item> elements rather than a "label" |
---|
| | attribute. There must be at least one item. Each item must have |
---|
| | a "label" attribute. |
---|
| | --> |
---|
| | <template name="citation" match="cite"> |
---|
| | <latex>\cite{<xsl:apply-templates select="item" />}</latex> |
---|
| | <html> |
---|
| | <common formats="/latex/xelatex/">\cite{<xsl:apply-templates select="item" />}</common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:variable name="id"> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | </xsl:variable> |
---|
| | <xsl:text> [</xsl:text> |
---|
| | <xsl:apply-templates select="item" /> |
---|
| | <xsl:text>]</xsl:text> |
---|
| | </html> |
---|
| | </template> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | A cited item. |
---|
| | |
---|
| | @label: The unique label of the cited item. [REQUIRED] |
---|
| | --> |
---|
| | <template name="citation-item" match="cite/item"> |
---|
| | <latex> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:if test="position() != last()"><xsl:text>,</xsl:text></xsl:if> |
---|
| | </latex> |
---|
| | <html> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:variable name="id"> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | </xsl:variable> |
---|
| | <A HREF="#{@label}"><xsl:value-of select="1 + count(//bibliography/item[@label = $id]/preceding-sibling::*)" /></A> |
---|
| | <a href="#{@label}"><xsl:value-of select="1 + count(//bibliography/item[@label = $id]/preceding-sibling::*)" /></a> |
---|
| | <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if> |
---|
| | </html> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | </stylesheet> |
---|