| |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <strong style="border: 1px solid black;">!!<xsl:apply-templates />!!</strong> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | |
---|
| | <!-- Tabular structures (LaTeX {tabular}, HTML <table>). --> |
---|
| | <include href="modules/tabular.xml" /> |
---|
| | |
---|
| | <!-- |
---|
| | Hyperlinks. The content of the element is the hyperlink text. |
---|
| | |
---|
| | @label: A label that the hyperlink links to. The value should |
---|
| | be an acceptable label in both LaTeX and HTML. [optional] |
---|
| | |
---|
| | @url: A URL that the hyperlink links to. If no link text is |
---|
| | provided, the URL is used as the link text. [optional] |
---|
| | --> |
---|
| | <template name="hyperlink-label" match="hyperlink[@label and node()]"> |
---|
| | <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> |
---|
| | <xsl:message terminate="yes"><hyperlink> with @label must include link text.</xsl:message> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="hyperlink-url" match="hyperlink[@url and node()]"> |
---|
| | <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. --> |
---|
| | <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> |
---|
| | <xsl:message terminate="yes">Cannot use both @url and @label in <hyperlink>.</xsl:message> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- 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 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 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"> |
---|
| | <!-- |
---|
| | Hmm, \url{...} appears to turn the URL into a non-functional |
---|
| | link in PDF output (probably an interaction with hyperref). |
---|
| | Not really what we want (as the link aspect is already dealt |
---|
| | with by the <hyperlink> templates), so we'll just use |
---|
| | \texttt{...}. |
---|
| | --> |
---|
| | <common formats="/latex/xelatex/">\nolinkurl{<xsl:apply-templates />}</common> |
---|
| | <common formats="/html/xhtml/"><code><xsl:apply-templates /></code></common> |
---|
| | </template> |
---|
| | |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | References. Note the distinction betwen these and hyperlinks: a reference is merely something like "see Section 2.3", and doesn't necessarily imply a hyperlink, or vice versa. |
---|
| | |
---|
| | @label: The label of the item that we're referencing. It must be a valid label in both LaTeX and HTML. [required] |
---|
| | |
---|
| | @include-pageref: If "yes", also append a page reference (LaTeX only; this is handled by the "item-page-reference" template below). |
---|
| | --> |
---|
| | <template name="reference" match="reference[@label]"> |
---|
| | <common> |
---|
| | <!-- Find the element whose label is the same as our label. --> |
---|
| | <xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" /> |
---|
| | <xsl:if test="@include-pageref = 'yes'"> |
---|
| | <xsl:apply-templates select="//*[@label = current()/@label]" mode="page-reference" /> |
---|
| | </xsl:if> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="broken-reference" match="reference[not( @label )]"> |
---|
| | <common> |
---|
| | <xsl:message terminate="yes">Reference elements must include a label attribute.</xsl:message> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- Do a separate template for each type of referenced item; 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. --> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>Section~\ref*{</xsl:text> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </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" /> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="figure-reference" match="figure" mode="reference"> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>Figure~\ref*{</xsl:text> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </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:when> |
---|
| | <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> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="table-reference" match="table" mode="reference"> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>Table~\ref*{</xsl:text> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </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:when> |
---|
| | <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> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Standalone direct reference to a page (i.e., not associated with some other item like a figure or table). This only really makes sense in LaTeX, as HTML doesn't have page numbers. For HTML, we fudge things by inserting the string "here", which will make sense if the reference is wrapped with a hyperlink (as they usually are). |
---|
| | --> |
---|
| | <template name="page-reference" match="page[@label]" mode="reference"> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>page~\pageref{</xsl:text> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:text disable-output-escaping="yes">here</xsl:text> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Common template for appended page references, as they're identical for all items except for standalone page references, which aren't included in this template. The include-pageref attribute is therefore ignored on standalone page references. |
---|
| | --> |
---|
| | <template name="item-page-reference" match="section|figure|table" mode="page-reference"> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text> on page~\pageref{</xsl:text> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <!-- |
---|
| | Generate a standalone label for use in direct page references. |
---|
| | |
---|
| | TODO: Hmm, this seems to generate the correct page number in LaTeX but the hyperlink is to the wrong page (one lower?). Something to worry about later. |
---|
| | |
---|
| | @label: The label to be inserted. It must be a valid label in both LaTeX and HTML. [required] |
---|
| | --> |
---|
| | <template name="page" match="page[@label]"> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:text>\label{</xsl:text> |
---|
| | <xsl:value-of select="@label" /> |
---|
| | <xsl:text>}</xsl:text> |
---|
| | </common> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <a id="{@label}"></a> |
---|
| | </common> |
---|
| | </template> |
---|
| | |
---|
| | <template name="broken-page" match="page[not( @label )]"> |
---|
| | <common> |
---|
| | <xsl:message terminate="yes">Page elements must include a label attribute.</xsl:message> |
---|
| | </common> |
---|
| | </template> |
---|
| | <!-- Hyperlinks. --> |
---|
| | <include href="modules/hyperlinks.xml" /> |
---|
| | |
---|
| | <!-- Cross-references. --> |
---|
| | <include href="modules/cross-references.xml" /> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Figures & tables (in the LaTeX sense, i.e., "floating" items). |
---|
| |
---|
|