GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
1
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
XML
Browse code
Added support for basic text colouring
master
1 parent
ab16136
commit
03303405a91b5549e8ca2a9c0a121a200a38141f
Nigel Stanger
authored
on 5 Apr 2019
Patch
Showing
3 changed files
modules/basic-text-formatting.xml
quick-reference.markdown
xml2xslt.xsl
Ignore Space
Show notes
View
modules/basic-text-formatting.xml
<?xml version="1.0" encoding="utf-8"?> <!-- Basic text formatting, like emphasis, bold, etc. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- "Logical" styles. --> <!-- Emphasis (normally italic). --> <template name="emph" match="emph|em"> <common formats="/latex/xelatex/"> <xsl:text>\emph{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </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"> <common formats="/latex/xelatex/"> <xsl:text>\emph{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <strong><xsl:apply-templates /></strong> </common> </template> <!-- Strong emphasis (normally bold). --> <template name="strong" match="strong"> <common formats="/latex/xelatex/"> <xsl:text>\textbf{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <strong><xsl:apply-templates /></strong> </common> </template> <!-- A defined term. --> <template name="term" match="term"> <common formats="/latex/xelatex/"> <xsl:text>\term{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <i class="term"><xsl:apply-templates /></i> </common> </template> <!-- A foreign word or phrase. --> <template name="foreign" match="foreign"> <common formats="/latex/xelatex/"> <xsl:text>\foreign{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <i class="foreign"><xsl:apply-templates /></i> </common> </template> <!-- "Physical" styles. --> <!-- Italics. --> <template name="italic" match="italic"> <common formats="/latex/xelatex/"> <xsl:text>\textit{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <i><xsl:apply-templates /></i> </common> </template> <!-- Bold face. --> <template name="bold" match="bold"> <common formats="/latex/xelatex/"> <xsl:text>\textbf{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <b><xsl:apply-templates /></b> </common> </template> <!-- Underlining. --> <template name="underline" match="underline|u"> <common formats="/latex/xelatex/"> <xsl:text>\uline{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <span style="text-decoration: underline;"><xsl:apply-templates /></span> </common> </template> <!-- Strike-through. --> <template name="strike-through" match="strike-through|line-through|strikethrough|linethrough"> <common formats="/latex/xelatex/"> <xsl:text>\sout{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <span style="text-decoration: line-through;"><xsl:apply-templates /></span> </common> </template> <!-- Center stuff on the page. --> <template name="center" match="center|centering|centre|centring"> <common formats="/latex/xelatex/"> <xsl:text>\begin{center}</xsl:text> <xsl:call-template name="newline-internal" /> <xsl:apply-templates /> <xsl:text>\end{center}</xsl:text> <xsl:call-template name="newline-internal" /> </common> <common formats="/html/xhtml/"> <div style="text-align: center;"> <xsl:apply-templates /> </div> </common> </template> <!-- Simple inline text colors using CSS colour names. (This requires the css-colors package in LaTeX.) TODO: RGB colours? @name: The CSS name of the colour. [REQUIRED] --> <template name="colour" match="color|colour"> <common formats="/latex/xelatex/"> <xsl:text>\textcolor{</xsl:text> <xsl:value-of select="@name" /> <xsl:text>}{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <div style="color: {@name};"> <xsl:apply-templates /> </div> </common> </template> <!-- Convert the input string into Title Case. $input-string: The string to be converted. Returns: The converted string. --> <function name="infosci:title-case" as="xs:string"> <common> <xsl:param name="input-string" /> <xsl:variable name="output-string"> <xsl:choose> <xsl:when test="contains($input-string, ' ')"> <xsl:value-of select="infosci:title-case(substring-before($input-string, ' '))" /> <xsl:text> </xsl:text> <xsl:value-of select="infosci:title-case(substring-after($input-string, ' '))" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(upper-case(substring($input-string, 1, 1)), substring($input-string, 2))" /> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:sequence select="$output-string" /> </common> </function> </stylesheet>
<?xml version="1.0" encoding="utf-8"?> <!-- Basic text formatting, like emphasis, bold, etc. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- "Logical" styles. --> <!-- Emphasis (normally italic). --> <template name="emph" match="emph|em"> <common formats="/latex/xelatex/"> <xsl:text>\emph{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </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"> <common formats="/latex/xelatex/"> <xsl:text>\emph{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <strong><xsl:apply-templates /></strong> </common> </template> <!-- Strong emphasis (normally bold). --> <template name="strong" match="strong"> <common formats="/latex/xelatex/"> <xsl:text>\textbf{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <strong><xsl:apply-templates /></strong> </common> </template> <!-- A defined term. --> <template name="term" match="term"> <common formats="/latex/xelatex/"> <xsl:text>\term{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <i class="term"><xsl:apply-templates /></i> </common> </template> <!-- A foreign word or phrase. --> <template name="foreign" match="foreign"> <common formats="/latex/xelatex/"> <xsl:text>\foreign{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <i class="foreign"><xsl:apply-templates /></i> </common> </template> <!-- "Physical" styles. --> <!-- Italics. --> <template name="italic" match="italic"> <common formats="/latex/xelatex/"> <xsl:text>\textit{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <i><xsl:apply-templates /></i> </common> </template> <!-- Bold face. --> <template name="bold" match="bold"> <common formats="/latex/xelatex/"> <xsl:text>\textbf{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <b><xsl:apply-templates /></b> </common> </template> <!-- Underlining. --> <template name="underline" match="underline|u"> <common formats="/latex/xelatex/"> <xsl:text>\uline{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <span style="text-decoration: underline;"><xsl:apply-templates /></span> </common> </template> <!-- Strike-through. --> <template name="strike-through" match="strike-through|line-through|strikethrough|linethrough"> <common formats="/latex/xelatex/"> <xsl:text>\sout{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </common> <common formats="/html/xhtml/"> <span style="text-decoration: line-through;"><xsl:apply-templates /></span> </common> </template> <!-- Center stuff on the page. --> <template name="center" match="center|centering|centre|centring"> <common formats="/latex/xelatex/"> <xsl:text>\begin{center}</xsl:text> <xsl:call-template name="newline-internal" /> <xsl:apply-templates /> <xsl:text>\end{center}</xsl:text> <xsl:call-template name="newline-internal" /> </common> <common formats="/html/xhtml/"> <div style="text-align: center;"> <xsl:apply-templates /> </div> </common> </template> <!-- Convert the input string into Title Case. $input-string: The string to be converted. Returns: The converted string. --> <function name="infosci:title-case" as="xs:string"> <common> <xsl:param name="input-string" /> <xsl:variable name="output-string"> <xsl:choose> <xsl:when test="contains($input-string, ' ')"> <xsl:value-of select="infosci:title-case(substring-before($input-string, ' '))" /> <xsl:text> </xsl:text> <xsl:value-of select="infosci:title-case(substring-after($input-string, ' '))" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(upper-case(substring($input-string, 1, 1)), substring($input-string, 2))" /> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:sequence select="$output-string" /> </common> </function> </stylesheet>
Ignore Space
Show notes
View
quick-reference.markdown
# XML authoring framework quick reference ## Conventions * All items and elements are listed in alphabetical order. Attributes are listed in alphabetical order with required attributes first. When there are multiple elements for the same item, there is no preference for any particular element over another, as long as the resulting markup is well-formed. * Typical EBNF-style notation applies: `[ ]` indicates optional, `|` indicates alternation, `{ }` indicates repetition, etc. * **bold** indicates a default value. ## Basic formatting ### Page elements (`basic-page-elements.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | horizontal rule | `horizontal-rule` | | | | `hr` | | | | `hrule` | | | horizontal skip | `horizontal-skip` | `size=fill|`*`<LaTeX length>`* | HTML: no effect | | `hskip` | | | forced line break | `br` | | | | `line-break` | | | | `newline` | | | no page break | `mbox` | | | | `no-break` | | | page break | `new-page` | `[caption-text=`*`<string>`*`]` | “**`continues over…`**” | | `newpage` | `[print-caption=`**`no`**`|yes]` | | | `page-break` | | | | `pagebreak` | | | paragraph | `P` | `[align=center|left|right]` | | | `p` | `[border=`**`no`**`|yes]` | | | `para` | `[indent=no|`**`yes`**`]` | | | `paragraph` | | | vertical skip | `vertical-skip` | `[size=fill|large|medium|small|`*`<LaTeX length>`*`]` | **inserts a paragraph skip** | | `vskip` | | ### Text formatting and layout (`basic-text-formatting.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | bold face | `bold` | | | colour | `color` | `name=`*`<CSS colour name>`* | (Xe)LaTeX: via `css-color` package | | `colour` | | | center | `center` | | | | `centering` | | | | `centre` | | | | `centring` | | | emphasis | `em` | | | | `emph` | | | foreign word | `foreign` | | | italics | `italic` | | | strikethrough | `line-through` | | | | `linethrough` | | | | `strike-through` | | | | `strikethrough` | | | strong emphasis | `strong` | | | term | `term` | | | underline | `u` | | | | `underline` | | ### Number formatting (`number-formatting.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | formatted number | `number` | | ### Font size and style (`fonts.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | monospaced type | `monospace` | | | | `tt` | | | | `typewriter` | | | sans-serif type | `sans` | | | | `sans-serif` | | | | `sf` | | | | `ss` | | | font family | `font` | `[fontspec-options=`*`<string>`*`]` | XeLaTeX: `fontspec` package options | | `typeface` | `[html=`*`<name>`*`]` | HTML: CSS font name(s) | | | `[latex=`*`<name>`*`]` | LaTeX: LaTeX font name | | | `[xelatex=`*`<name>`*`]` | XeLaTeX: `fontspec` font name | “tiny” font size | `tiny` | | HTML: `<smaller>` × 4 | | | | LaTeX: `\tiny` | “script” font size | `scriptsize` | | HTML: `<smaller>` × 3 | | | | LaTeX: `\scriptsize` | “footnote” font size | `footnotesize` | | HTML: `<smaller>` × 2 | | | | LaTeX: `\footnotesize` | “small” font size | `small` | | HTML: `<smaller>` | | | | LaTeX: `\small` | “large” font size | `large` | | HTML: `<larger>` | | | | LaTeX: `\large` | “Large” font size | `Large` | | HTML: `<larger>` × 2 | | | | LaTeX: `\Large` | “LARGE” font size | `LARGE` | | HTML: `<larger>` × 3 | | | | LaTeX: `\LARGE` | “huge” font size | `huge` | | HTML: `<larger>` × 4 | | | | LaTeX: `\huge` | “Huge” font size | `Huge` | | HTML: `<larger>` × 5 | | | | LaTeX: `\Huge` | superscript | `superscript` | | | subscript | `subscript` | | ### Inline code and code blocks (`code-formatting.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | code (block) | `code-block` | `[allow-breaks=no|`**`yes`**`]` | `code-block` requires `<![CDATA[ … ]]>` | | | `[language=`*`<name>`*`]` | LaTeX: `listings` language name | code (inline) | `code` | `[language=`*`<name>`*`]` | LaTeX: `listings` language name | verbatim (block) | `verbatim` | | | | `verbatim-block` | | | verbatim (inline) | `inline-verbatim` | | | | `verb` | | ### Quoted text (`quotations.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | inline quoted text | `quote` | `[single=`**`no`**`|yes]` | | | `q` | `[single=`**`no`**`|yes]` | | | `qq` | | double quotes only | block quotation | `quotation` | `[align=center|centre|`**`left`**`|right]` | ### Footnotes (`footnotes.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | footnote | `footnote` | | ### Miscellaneous symbols (`miscellaneous-symbols.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | # | `hash` | | U+0023 NUMBER SIGN | | `number-sign` | | | | `sharp` | | | $ | `dollar` | | U+0024 DOLLAR SIGN | | `dollar-sign` | | | % | `percent` | | U+0025 PERCENT SIGN | | `percent-sign` | | | | `percentage-sign` | | | & | `ampersand` | | U+0026 AMPERSAND | \ | `backslash` | | U+005C REVERSE SOLIDUS | _ | `low-line` | | U+005F LOW LINE | | `underscore` | | | { | `left-brace` | | U+007B LEFT CURLY BRACKET | | `left-curly-brace` | | | | `left-curly-bracket` | | | } | `right-brace` | | U+007D RIGHT CURLY BRACKET | | `right-curly-brace` | | | | `right-curly-bracket` | | | ° | `degree-sign` | | U+00B0 DEGREE SIGN | | `degrees` | | | § | `section-sign` | | U+00A7 SECTION SIGN | © | `copyright-sign` | | U+00A9 COPYRIGHT SIGN | ¶ | `paragraph-sign` | | U+00B6 PILCROW SIGN | | `pilcrow` | | | | `pilcrow-sign` | | | ‒ (number dash) | `figure-dash` | | U+2012 FIGURE DASH | | `number-dash` | | | – (en dash) | `en-dash` | | U+2013 EN DASH | | `endash` | | | | `n-dash` | | | | `ndash` | | | — (em dash) | `em-dash` | | U+2014 EM DASH | | `emdash` | | | | `m-dash` | | | | `mdash` | | | ’ | `apostrophe` | | U+2019 RIGHT SINGLE QUOTATION MARK | | `right-single-quotation-mark` | | | † | `dag` | | U+2020 DAGGER | | `dagger` | | | ‡ | `ddag` | | U+2021 DOUBLE DAGGER | | `ddagger` | | | | `double-dagger` | | | … | `dots` | | U+2026 HORIZONTAL ELLIPSIS | | `ellipsis` | | | | `ellipsis-sign` | | | | `etc` | | | | `horizontal-ellipsis` | | | ™ | `tm` | | U+2122 TRADE MARK SIGN | | `trade-mark-sign` | | | | `trademark` | | | | `trademark-sign` | | | LaTeX logo | `LaTeX` | | | | `latex` | | ### Special characters (`special-characters.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | discretionary hyphen | `hyphen` | | | forced space | `space` | | U+0020 SPACE | non-breaking space | `nbsp` | | | | `no-break-space` | | | | `non-breaking-space` | | | thin space | `thin-space` | | | | `thinspace` | | ## Document content ### Root document (`xml2xslt.xsl`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | document | `document` | `class=calendar|fragment|general|laboratory|tutorial` | | | | `[auto-latex-build-date=no|`**`yes`**`]` | | | | `[generate-latex-toc=`**`no`**`|yes]` | doesn’t override document class ToC | | | `[latex-class-options=`*`<string>`*`]` | | | | `[latex-document-class=`*`<string>`*`]` | **`article`** | | | `[latex-font-size=`*`<string>`*`]` | **`12pt`** | | | `[latex-paper-size=`*`<string>`*`]` | **`a4paper`** | | | `[sequence-number=`*`<integer>`*`]` | | | | `[suppress-latex-title=`**`no`**`|yes]` | ### Sections (`sectioning.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | section | `section` | `[label=`*`<string>`*`]` | | section title | `title` | | within `<section>` ### Document title (`titling.xml`) These all occur at the top level of the enclosing `<document>` element. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | document author | `author` | | | document date | `date` | | | assessment due date | `due-date` | | only relevant if `/document/@class = "assignment"` | document title | `title` | | | document sub-title | `subtitle` | | ### Lists (`lists.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | definition | `DD` | | | | `dd` | | | | `definition` | | | | `description` | | | | `discourse` | | | definition list | `definition-list` | | | | `description-list` | | | | `DL` | | | | `dl` | | | keyword | `DT` | `[linebreak=`**`no`**`|yes]` | | | `dt` | | | | `keyword` | | | | `term` | | | | `topic` | | | list item | `item` | `[label=`*`<string>`*`]` | `label` for ordered lists only | | | `[value=`*`<integer>`*`]` | `value` for ordered lists only | ordered list | `enumerate` | `[start=`*`<integer>`*`]` | **`1`** | | `enumerated-list` | | | | `numbered-list` | | | | `OL` | | | | `ol` | | | | `ordered-list` | | | | `question-list` | | | unordered list | `bullet-list` | | | | `bullet-points` | | | | `bulleted-list` | | | | `itemised-list` | | | | `itemize` | | | | `UL` | | | | `ul` | | | | `unordered-list` | | ### Tabular material (`tabular.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | caption | `caption` | | onyl within long tables | cell | `cell` | `[align=center|`**`left`**`|right]` | | | | `[columns=`*`<integer>`*`]` | **`1`** | | | `[header=`**`no`**`|yes]` | | | | `[rows=`*`<integer>`*`]` | **`1`** (somewhat broken?) | column | `column` | `[align=center|centre|`**`left`**`|right]` | | | | `[left-border="|"]` | i.e., literal “`|`” | | | `[right-border="|"]` | i.e., literal “`|`” | horizontal rule | `row-rule` | `[columns=`*`<integer>`*`]` | **`1`** | | | `[weight=double|`*`single`*`]` | | row | `row` | `[page-break=no|`**`yes`**`]` | LaTeX only | | | `[valign=bottom|middle|top]` | HTML only | tabular body | `tabular-body` | | | tabular footer | `tabular-footer` | | | tabular header | `tabular-header` | | | tabular layout | `tabular` | `[align=center|centre|`**`left`**`|right]` | | | | `[border=`*`<integer>`*`]` | **`0`**; HTML only | | | `[long-table=`**`no`**`|yes]` | LaTeX only | | | `[rotate=`*`<integer>`*`]` | LaTeX only | | | `[scale=`*`<decimal>`*`]` | LaTeX only | | | `[valign=bottom|`**`center|centre`**`|top]` | LaTeX only ### Images (`images.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | image | `image` | `basename=`*`<filename>`* | without suffix | | | `format=`*`<string>`* | e.g., “png”, “pdf” | | | `location=`*`<path>`* | | | | `[inline=`**`no`**`|yes]` | image will be scaled to line height | | | `[latex-options=`*`<string>]`* | pass-through LaTeX options | zoomable image | `provide-large-version` | | within `<image>` ### Floating elements (`floaters.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | caption | `caption` | | within `<figure>` or `<table>` | figure | `figure` | `[border-placement=box|`**`none`**`|{bottom|left|right|top}]` | | | | `[label=`*`<string>]`* | | | | `[latex-placement=`*`<string>]`* | LaTeX only; usually `b|h|p|t` | multipart table | `part` | | within `<table>` | table | `table` | `[border-placement=box|`**`none`**`|{bottom|left|right|top}]` | | | | `[label=`*`<string>]`* | | | | `[latex-placement=`*`<string>]`* | ### Cross references (`cross-references.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | page label | `page` | `label=`*`<string>`* | | reference | `reference` | `label=`*`<string>`* | | | | `[include-pageref=`**`no`**`|yes]` | ### Bibliographies (`bibliography.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | bibliography | `bibliography` | `[name=`*`<section title>`*`]` | “**`References`**” | bibliography entry | `item` | `label=`*`<string>`* | within `<bibliography>` | citation | `cite` | | | cited item | `item` | `label=`*`<string>`* | within `<cite>` ## Maths ### Equations, etc. (`maths.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | calligraphic text | `calligraphic` | | LaTeX: `\mathcal` | | `cursive` | | | denominator | `denominator` | | within `<fraction>` | digit group separator | `digit-group-separator` | | **thin space** | | `digitsep` | | | equation array | `equation-array` | | | equation array row | `row` | | within `<equation-array>` | | `text` | | | formula | `math` | `[style=display|`**`inline`**`]` | | fraction | `fraction` | | | log-like function | `function` | | | numerator | `numerator` | | within `<fraction>` | subscript | `subscript` | | within `<math>` | superscript | `superscript` | | within `<math>` | variable | `var` | | | | `variable` | | ### Symbols (`mathematical-symbols.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | + | `plus` | | U+002B PLUS SIGN | | `plus-sign` | | | × | `times` | | U+00D7 MULTIPLICATION SIGN | | `multiply` | | | | `multiplication` | | | | `multiplication-sign` | | | − | `minus` | | U+2212 MINUS SIGN | | `minus-sign` | | | | `subtract` | | | ∕ | `divide` | | U+2215 DIVISION SLASH | | `division` | | | | `division-slash` | | | = | `eq` | | U+003D EQUALS SIGN | | `equality` | | | | `equals` | | | | `equals-sign` | | | ≠ | `ne` | | U+2260 NOT EQUAL TO | | `not-equal-to` | | | | `not-equals` | | | | `inequality` | | | ≈ | `almost-equal-to` | | U+2248 ALMOST EQUAL TO | | `approx` | | | | `approximately-equal-to` | | | | `approximately-equals` | | | > | `greater-than` | | U+003E GREATER-THAN SIGN | | `greater-than-sign` | | | | `gt` | | | ≥ | `ge` | | U+2265 GREATER-THAN OR EQUAL TO | | `greater-equals` | | | | `greater-than-or-equal-to` | | | < | `less-than` | | U+003C LESS-THAN SIGN | | `less-than-sign` | | | | `lt` | | | ≤ | `le` | | U+2264 LESS-THAN OR EQUAL TO | | `less-equals` | | | | `less-than-or-equal-to` | | | ∅ | `empty-set` | | U+2205 EMPTY SET | | `empty-set-sign` | | | | `null` | | | ∈ | `element` | | U+2208 ELEMENT OF | | `element-of` | | | | `element-sign` | | | | `is-an-element-of` | | | | `is-element-of` | | | ∉ | `is-not-an-element-of` | | U+2209 NOT AN ELEMENT OF | | `is-not-element-of` | | | | `not-an-element-of` | | | | `not-element` | | | | `not-element-of` | | | | `not-element-sign` | | | ∩ | `cap` | | U+2229 INTERSECTION | | `intersect` | | | | `intersect-operator` | | | | `intersection` | | | ∪ | `cup` | | U+222A UNION | | `union` | | | | `union-operator` | | | ⊂ | `is-a-subset-of` | | U+2282 SUBSET OF | | `is-subset-of` | | | | `strict-subset` | | | | `subset` | | | | `subset-of` | | | | `subset-sign` | | | ⊃ | `is-a-superset-of` | | U+2283 SUPERSET OF | | `is-superset-of` | | | | `superset` | | | | `superset-of` | | | | `superset-sign` | | | ⊆ | `inclusive-subset` | | U+2286 SUBSET OF OR EQUAL TO | | `is-a-subset-of-or-equal-to` | | | | `is-subset-of-or-equal-to` | | | | `subset-of-or-equal-to` | | | | `subset-or-equal` | | | ⊇ | `inclusive-superset` | | U+2287 SUPERSET OF OR EQUAL TO | | `is-a-superset-of-or-equal-to` | | | | `is-superset-of-or-equal-to` | | | | `superset-of-or-equal-to` | | | | `superset-or-equal` | | | ¬ | `neg` | | U+00AC NOT SIGN | | `negation` | | | | `logical-negation` | | | | `logical-negation-operator` | | | | `logical-not` | | | | `logical-not-operator` | | | | `not` | | | | `not-sign` | | | ∧ | `and` | | U+2227 LOGICAL AND | | `and-operator` | | | | `hat` | | | | `logical-and` | | | | `logical-and-operator` | | | | `wedge` | | | ∨ | `logical-or` | | U+2228 LOGICAL OR | | `logical-or-operator` | | | | `or` | | | | `or-operator` | | | | `vee` | | | →, ⇒ | `implies` | `[weight=double|`**`single`**`]` | U+2192 RIGHTWARDS ARROW | | `rarr` | | U+21D2 RIGHTWARDS DOUBLE ARROW | | `rarrow` | | | | `right-arrow` | | | | `rightarrow` | | | | `rightwards-arrow` | | | ←, ⇐ | `larr` | `[weight=double|`**`single`**`]` | U+2190 LEFTWARDS ARROW | | `larrow` | | U+21D0 LEFTWARDS DOUBLE ARROW | | `left-arrow` | | | | `leftarrow` | | | | `leftwards-arrow` | | ### Relational algebra (`relational-algebra.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | project operator (π) | `project` | | U+03C0 GREEK SMALL LETTER PI | | `project-operator` | | | | `relational-project` | | | extend operator (ε) | `extend` | | U+03B5 GREEK SMALL LETTER EPSILON | | `extend-operator` | | | | `relational-extend` | | | rename operator (ρ) | `relational-rename` | | U+03C1 GREEK SMALL LETTER RHO | | `rename` | | | | `rename-operator` | | | restrict operator (σ) | `restrict` | | U+03C2 GREEK SMALL LETTER SIGMA | | `restrict-operator` | | | | `relational-restrict` | | | join operator (⋈) | `bowtie` | | U+22C8 BOWTIE | | `inner-join` | | (or U+2A1D JOIN) | | `join` | | | | `join-operator` | | | | `natural-join` | | | | `relational-join` | | | outer join operator | `outer-join` | `[type=`**`full`**`|left|right]` | U+27D5 LEFT OUTER JOIN | | `outer-join-operator` | | U+27D6 RIGHT OUTER JOIN | | `relational-outer-join` | | U+27D7 FULL OUTER JOIN ### Greek (`greek-characters.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | α | `alpha` | | U+03B1 GREEK SMALL LETTER ALPHA | Α | `capital-alpha` | | U+0391 GREEK CAPITAL LETTER ALPHA | β | `beta` | | U+03B2 GREEK SMALL LETTER BETA | Β | `capital-beta` | | U+0392 GREEK CAPITAL LETTER BETA | γ | `gamma` | | U+03B3 GREEK SMALL LETTER GAMMA | Γ | `capital-gamma` | | U+0393 GREEK CAPITAL LETTER GAMMA | δ | `delta` | | U+03B4 GREEK SMALL LETTER DELTA | Δ | `capital-delta` | | U+0394 GREEK CAPITAL LETTER DELTA | ε | `epsilon` | | U+03B5 GREEK SMALL LETTER EPSILON | Ε | `capital-epsilon` | | U+0395 GREEK CAPITAL LETTER EPSILON | ζ | `zeta` | | U+03B6 GREEK SMALL LETTER ZETA | Ζ | `capital-zeta` | | U+0396 GREEK CAPITAL LETTER ZETA | η | `eta` | | U+03B7 GREEK SMALL LETTER ETA | Η | `capital-eta` | | U+0397 GREEK CAPITAL LETTER ETA | θ | `theta` | | U+03B8 GREEK SMALL LETTER THETA | Θ | `capital-theta` | | U+0398 GREEK CAPITAL LETTER THETA | ι | `iota` | | U+03B9 GREEK SMALL LETTER IOTA | Ι | `capital-iota` | | U+0399 GREEK CAPITAL LETTER IOTA | κ | `kappa` | | U+03BA GREEK SMALL LETTER KAPPA | Κ | `capital-kappa` | | U+039A GREEK CAPITAL LETTER KAPPA | λ | `lambda` | | U+03BB GREEK SMALL LETTER LAMBDA | Λ | `capital-lambda` | | U+039B GREEK CAPITAL LETTER LAMBDA | μ | `mu` | | U+03BC GREEK SMALL LETTER MU | Μ | `capital-mu` | | U+039C GREEK CAPITAL LETTER MU | ν | `nu` | | U+03BD GREEK SMALL LETTER NU | Ν | `capital-nu` | | U+039D GREEK CAPITAL LETTER NU | ξ | `xi` | | U+03BE GREEK SMALL LETTER XI | Ξ | `capital-xi` | | U+039E GREEK CAPITAL LETTER XI | ο | `omicron` | | U+03BF GREEK SMALL LETTER OMICRON | Ο | `capital-omicron` | | U+039F GREEK CAPITAL LETTER OMICRON | π | `pi` | | U+03C0 GREEK SMALL LETTER PI | Π | `capital-pi` | | U+03A0 GREEK CAPITAL LETTER PI | ρ | `rho` | | U+03C1 GREEK SMALL LETTER RHO | Ρ | `capital-rho` | | U+03A1 GREEK CAPITAL LETTER RHO | σ | `sigma` | | U+03C2 GREEK SMALL LETTER SIGMA | Σ | `capital-sigma` | | U+03A3 GREEK CAPITAL LETTER SIGMA | τ | `tau` | | U+03C4 GREEK SMALL LETTER TAU | Τ | `capital-tau` | | U+03A4 GREEK CAPITAL LETTER TAU | υ | `upsilon` | | U+03C5 GREEK SMALL LETTER UPSILON | Υ | `capital-upsilon` | | U+03A5 GREEK CAPITAL LETTER UPSILON | φ | `phi` | | U+03C6 GREEK PHI SYMBOL (for consistency with LaTeX) | Φ | `capital-phi` | | U+03A6 GREEK CAPITAL LETTER PHI | χ | `chi` | | U+03C7 GREEK SMALL LETTER CHI | Χ | `capital-chi` | | U+03A7 GREEK CAPITAL LETTER CHI | ψ | `psi` | | U+03C8 GREEK SMALL LETTER PSI | Ψ | `capital-psi` | | U+03A8 GREEK CAPITAL LETTER PSI | ω | `omega` | | U+03C9 GREEK SMALL LETTER OMEGA | Ω | `capital-omega` | | U+03A9 GREEK CAPITAL LETTER OMEGA ## Teaching related items ### Otago specific elements (`otago-specific.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | paper code | `paper` | | | paper number | `paper-number` | | within `<paper>` | subject code | `subject-code` | | within `<paper>` ### Questions and answers (`q-and-a.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | answer | `answer` | `[hide=`**`no`**`|yes]` | | exercise | `exercise` | `label=`*`<string>`* | numbered exercise, in box | question | `question` | | ### Teaching dates (`paper-calendar-dates.xml`) Note that `paper-calendar-dates.xml` is generated for a particular year by `generate-calendar-dates.php`. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | date | `TeachingPeriodDate` | `period=FY|S1|S2|SS|YY` | | | | `week=`*`<integer>`* | within period | | | `[format=day|day-short|day-short+year|day+long-name|` | | | | `day+short-name|day+year|`**`ISO`**`|`*`<XML date picture>`*`]` | | | | `[offset=(+|-)`*`<XSLT duration>`*`]` | e.g., “P1D”, “-P4D” | date range | `TeachingPeriodDateRange` | `format=long|short` | | | | `period=FY|S1|S2|SS|YY` | | | | `week=`*`<integer>`* | within period | | | `[wrap=no|`**`yes`**`]` | ### Teaching calendar (`paper-calendar.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | assessment | `assessment` | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | calendar table | `calendar` | `lectures-per-week=`*`<integer>`* | | | | `number-of-weeks=`*`<integer>`* | | | | `[number-laboratories=no|`**`yes`**`]` | | | | `[number-lectures=no|`**`yes`**`]` | | | | `[number-tutorials=no|`**`yes`**`]` | | footer row | `footer` | | | header row | `header` | | | note | `note` | `[num-columns=`*`<integer>`*`]` | **all columns** | laboratory | `laboratory` | `[number=no|yes]` | **`yes`** or **`calendar/@number-laboratories`** | | | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | lecture | `lecture` | `[holiday=`**`no`**`|yes]` | | | | `[number=no|yes]` | **`yes`** or **`calendar/@number-lectures`** | | | `[rows=`*`<integer>`*`]` | **`1`** | page break | `latex-calendar-break` | `[caption=no|`**`yes`**`]` | | | | `[caption-text=`*`<string>`*`]` | | reading | `reading` | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | section | `section` | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | table heading | `heading` | `[num-columns=`*`<integer>`*`]` | **`1`** | table footing | `footing` | `[num-columns=`*`<integer>`*`]` | **`1`** | tutorial | `tutorial` | `[number=no|yes]` | **`yes`** or **`calendar/@number-tutorials`** | week | `week` | `[holiday=`**`no`**`|yes]` | | | | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** ### Oracle documentation links (`oracle-docs.xsl`) Note that `oracle-docs.xsl` is generated by `oracle-docs.perl`. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | documentation root | `OraDocsURL` | | | Administrator’s Guide | `OraAdmin` | | | Advanced Application Developer’s Guide | `OraAppDevAdv` | | | Concepts | `OraConcepts` | | | Data Warehousing Guide | `OraDataWarehousing` | | | Documentation Library | `OraDocs` | | | Error Messages | `OraErrors` | | | Java Developer’s Guide | `OraJava` | | | JDBC Developer’s Guide | `OraJDBC` | | | JDBC Java API Reference (Javadoc) | `OraJDBCRef` | | | Performance Tuning Guide | `OraTuning` | | | Object-Relational Developer’s Guide | `OraAppDevOR` | | | PL/SQL Language Reference | `OraPLSQL` | | | PL/SQL Packages and Types Reference | `OraPLSQLPkgTyp` | | | Reference | `OraReference` | | | SQL Language Reference | `OraSQL` | | ## Miscellaneous ### Hyperlinks (`hyperlinks.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | hyperlink | `hyperlink` | `[url=`*`<url>`*`]` | excluding anchor (i.e., after “#”) | | | `[label=`*`<string>`*`]` | HTML: anchor; LaTeX: label | | | `[target=`*`<string>`*`]` | HTML only (e.g., “_blank”) | URL | `e-mail` | | | | `e-mail-address` | | | | `email` | | | | `email-address` | | | | `uri` | | | | `url` | | ### Document build date (`build-date.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | displayed build date | `build-date` | `[format=`*`<XML date picture>`*`]` | **`YYYY-MM-DD hh:mm:ss`** | | | `[style=footer|`**`inline`**`]` | ### Conditional processing (`conditional-processing.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | process when format | `process-when` | `format=latex|html` | ### Native code (`native-code.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | raw code | `raw-code` | `format=html|latex` | | raw LaTeX | `raw-latex` | | | raw HTML | `raw-html` | | ### LaTeX specific (`latex.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | document class | `latex-documentclass` | `[options=`*`<options>`*`]` | | | `documentclass` | | | document options | `latex-document-options` | | | LaTeX environment | `environment` | | | LaTeX packages | `latex-packages` | | | | `package` | `[options=`*`<options>`*`]` | within `<latex-packages>` | preamble commands | `latex-commands` | | | | `command` | | within `<latex-commands>` | | `hyphenation` | | within `<latex-commands>` ### Global elements (`global-elements.xml`) These essentially define global “variables” within the document. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | assessment due date | `DueDate` | `[style={bold|italic|underline}]` | requires top-level `<due-date>` | | | | only relevant if `/document/@class = "assignment"` | Blackboard URL | `Blackboard` | | **`https://blackboard.otago.ac.nz/`** | full paper code | `PaperCode` | | e.g., “INFO 202” | Oracle “name” | `OracleServer` | | e.g., “Oracle11*g*” | Oracle release number | `OracleServerRelease` | | e.g., “2” | Oracle version number | `OracleServerVersion` | | e.g., “11.2” | paper number | `PaperNumber` | | e.g., “202” | period paper offered | `PaperPeriod` | | e.g., “Second Semester” | subject code | `SubjectCode` | | “**`INFO`**” | year paper offered | `PaperYear` | `[offset=`*`<integer>`*`]` | **`0`** ### File inclusions (`inclusions.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | include document | `include-document` | `basename=`*`<filename>`* | including suffix | | | `type=html|latex|plain|xml` | HTML: **`html`** | | | | LaTeX: **`latex`** | | | | `xml` currently unsupported | | | `[path=`*`<path>`*`]` | without trailiing / ### Meta-elements (`meta-elements.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | ignore markup | `omit` | | | to-do item | `check` | | | | `incomplete` | | | | `to-do` | | | | `todo` | | | XML comment | `comment` | | ### Emoticons (`emoticons.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | emoticon | `emoticon` | `[type=`**`happy`**`|meh|neutral|sad]` | happy = U+263A WHITE SMILING FACE | | `smiley` | | sad = U+2639 WHITE FROWNING FACE ### Path-like elements (`path-like-elements.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | file system path | `directory` | | | keystroke | `keys` | | | menu | `menu` | | | “path item” | `item` | | within `<directory>`, `<keys>`, or `<menu>` | alt graphics key | `alt-graphics-key` | | | alt key | `alt-key` | | | backspace key | `backspace-key` | | | caps lock key | `capslock-key` | | | command key (⌘) | `command-key` | | | control key | `control-key` | | | delete key | `delete-key` | | | down arrow key | `down-arrow-key` | | | enter key | `enter-key` | | | escape key | `escape-key` | | | left arrow key | `left-arrow-key` | | | return key | `return-key` | | | right arrow key | `right-arrow-key` | | | shift key | `shift-key` | | | space key | `space-key` | | | tab key | `tab-key` | | | up arrow key | `up-arrow-key` | | | windows key | `windows-key` | | ### Multi-column layouts (`multi-column.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | multi-column layout | `multi-column` | `[align=center|`**`left`**`|right]` | | | | `[vspace=big|medium|small|`*`<LaTeX length>`*`|`**_`<none>`_**`]` | | | | `[width=`*`<decimal>`*`]` | between `0` and **`1`** | column | `column` | `[align=center|`**`left`**`|right]` | | | | `[width=`*`<decimal>`*`]` | between `0` and `1`
# XML authoring framework quick reference ## Conventions * All items and elements are listed in alphabetical order. Attributes are listed in alphabetical order with required attributes first. When there are multiple elements for the same item, there is no preference for any particular element over another, as long as the resulting markup is well-formed. * Typical EBNF-style notation applies: `[ ]` indicates optional, `|` indicates alternation, `{ }` indicates repetition, etc. * **bold** indicates a default value. ## Basic formatting ### Page elements (`basic-page-elements.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | horizontal rule | `horizontal-rule` | | | | `hr` | | | | `hrule` | | | horizontal skip | `horizontal-skip` | `size=fill|`*`<LaTeX length>`* | HTML: no effect | | `hskip` | | | forced line break | `br` | | | | `line-break` | | | | `newline` | | | no page break | `mbox` | | | | `no-break` | | | page break | `new-page` | `[caption-text=`*`<string>`*`]` | “**`continues over…`**” | | `newpage` | `[print-caption=`**`no`**`|yes]` | | | `page-break` | | | | `pagebreak` | | | paragraph | `P` | `[align=center|left|right]` | | | `p` | `[border=`**`no`**`|yes]` | | | `para` | `[indent=no|`**`yes`**`]` | | | `paragraph` | | | vertical skip | `vertical-skip` | `[size=fill|large|medium|small|`*`<LaTeX length>`*`]` | **inserts a paragraph skip** | | `vskip` | | ### Text formatting and layout (`basic-text-formatting.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | bold face | `bold` | | | center | `center` | | | | `centering` | | | | `centre` | | | | `centring` | | | emphasis | `em` | | | | `emph` | | | foreign word | `foreign` | | | italics | `italic` | | | strikethrough | `line-through` | | | | `linethrough` | | | | `strike-through` | | | | `strikethrough` | | | strong emphasis | `strong` | | | term | `term` | | | underline | `u` | | | | `underline` | | ### Number formatting (`number-formatting.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | formatted number | `number` | | ### Font size and style (`fonts.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | monospaced type | `monospace` | | | | `tt` | | | | `typewriter` | | | sans-serif type | `sans` | | | | `sans-serif` | | | | `sf` | | | | `ss` | | | font family | `font` | `[fontspec-options=`*`<string>`*`]` | XeLaTeX: `fontspec` package options | | `typeface` | `[html=`*`<name>`*`]` | HTML: CSS font name(s) | | | `[latex=`*`<name>`*`]` | LaTeX: LaTeX font name | | | `[xelatex=`*`<name>`*`]` | XeLaTeX: `fontspec` font name | “tiny” font size | `tiny` | | HTML: `<smaller>` × 4 | | | | LaTeX: `\tiny` | “script” font size | `scriptsize` | | HTML: `<smaller>` × 3 | | | | LaTeX: `\scriptsize` | “footnote” font size | `footnotesize` | | HTML: `<smaller>` × 2 | | | | LaTeX: `\footnotesize` | “small” font size | `small` | | HTML: `<smaller>` | | | | LaTeX: `\small` | “large” font size | `large` | | HTML: `<larger>` | | | | LaTeX: `\large` | “Large” font size | `Large` | | HTML: `<larger>` × 2 | | | | LaTeX: `\Large` | “LARGE” font size | `LARGE` | | HTML: `<larger>` × 3 | | | | LaTeX: `\LARGE` | “huge” font size | `huge` | | HTML: `<larger>` × 4 | | | | LaTeX: `\huge` | “Huge” font size | `Huge` | | HTML: `<larger>` × 5 | | | | LaTeX: `\Huge` | superscript | `superscript` | | | subscript | `subscript` | | ### Inline code and code blocks (`code-formatting.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | code (block) | `code-block` | `[allow-breaks=no|`**`yes`**`]` | `code-block` requires `<![CDATA[ … ]]>` | | | `[language=`*`<name>`*`]` | LaTeX: `listings` language name | code (inline) | `code` | `[language=`*`<name>`*`]` | LaTeX: `listings` language name | verbatim (block) | `verbatim` | | | | `verbatim-block` | | | verbatim (inline) | `inline-verbatim` | | | | `verb` | | ### Quoted text (`quotations.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | inline quoted text | `quote` | `[single=`**`no`**`|yes]` | | | `q` | `[single=`**`no`**`|yes]` | | | `qq` | | double quotes only | block quotation | `quotation` | `[align=center|centre|`**`left`**`|right]` | ### Footnotes (`footnotes.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | footnote | `footnote` | | ### Miscellaneous symbols (`miscellaneous-symbols.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | # | `hash` | | U+0023 NUMBER SIGN | | `number-sign` | | | | `sharp` | | | $ | `dollar` | | U+0024 DOLLAR SIGN | | `dollar-sign` | | | % | `percent` | | U+0025 PERCENT SIGN | | `percent-sign` | | | | `percentage-sign` | | | & | `ampersand` | | U+0026 AMPERSAND | \ | `backslash` | | U+005C REVERSE SOLIDUS | _ | `low-line` | | U+005F LOW LINE | | `underscore` | | | { | `left-brace` | | U+007B LEFT CURLY BRACKET | | `left-curly-brace` | | | | `left-curly-bracket` | | | } | `right-brace` | | U+007D RIGHT CURLY BRACKET | | `right-curly-brace` | | | | `right-curly-bracket` | | | ° | `degree-sign` | | U+00B0 DEGREE SIGN | | `degrees` | | | § | `section-sign` | | U+00A7 SECTION SIGN | © | `copyright-sign` | | U+00A9 COPYRIGHT SIGN | ¶ | `paragraph-sign` | | U+00B6 PILCROW SIGN | | `pilcrow` | | | | `pilcrow-sign` | | | ‒ (number dash) | `figure-dash` | | U+2012 FIGURE DASH | | `number-dash` | | | – (en dash) | `en-dash` | | U+2013 EN DASH | | `endash` | | | | `n-dash` | | | | `ndash` | | | — (em dash) | `em-dash` | | U+2014 EM DASH | | `emdash` | | | | `m-dash` | | | | `mdash` | | | ’ | `apostrophe` | | U+2019 RIGHT SINGLE QUOTATION MARK | | `right-single-quotation-mark` | | | † | `dag` | | U+2020 DAGGER | | `dagger` | | | ‡ | `ddag` | | U+2021 DOUBLE DAGGER | | `ddagger` | | | | `double-dagger` | | | … | `dots` | | U+2026 HORIZONTAL ELLIPSIS | | `ellipsis` | | | | `ellipsis-sign` | | | | `etc` | | | | `horizontal-ellipsis` | | | ™ | `tm` | | U+2122 TRADE MARK SIGN | | `trade-mark-sign` | | | | `trademark` | | | | `trademark-sign` | | | LaTeX logo | `LaTeX` | | | | `latex` | | ### Special characters (`special-characters.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | discretionary hyphen | `hyphen` | | | forced space | `space` | | U+0020 SPACE | non-breaking space | `nbsp` | | | | `no-break-space` | | | | `non-breaking-space` | | | thin space | `thin-space` | | | | `thinspace` | | ## Document content ### Root document (`xml2xslt.xsl`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | document | `document` | `class=calendar|fragment|general|laboratory|tutorial` | | | | `[auto-latex-build-date=no|`**`yes`**`]` | | | | `[generate-latex-toc=`**`no`**`|yes]` | doesn’t override document class ToC | | | `[latex-class-options=`*`<string>`*`]` | | | | `[latex-document-class=`*`<string>`*`]` | **`article`** | | | `[latex-font-size=`*`<string>`*`]` | **`12pt`** | | | `[latex-paper-size=`*`<string>`*`]` | **`a4paper`** | | | `[sequence-number=`*`<integer>`*`]` | | | | `[suppress-latex-title=`**`no`**`|yes]` | ### Sections (`sectioning.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | section | `section` | `[label=`*`<string>`*`]` | | section title | `title` | | within `<section>` ### Document title (`titling.xml`) These all occur at the top level of the enclosing `<document>` element. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | document author | `author` | | | document date | `date` | | | assessment due date | `due-date` | | only relevant if `/document/@class = "assignment"` | document title | `title` | | | document sub-title | `subtitle` | | ### Lists (`lists.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | definition | `DD` | | | | `dd` | | | | `definition` | | | | `description` | | | | `discourse` | | | definition list | `definition-list` | | | | `description-list` | | | | `DL` | | | | `dl` | | | keyword | `DT` | `[linebreak=`**`no`**`|yes]` | | | `dt` | | | | `keyword` | | | | `term` | | | | `topic` | | | list item | `item` | `[label=`*`<string>`*`]` | `label` for ordered lists only | | | `[value=`*`<integer>`*`]` | `value` for ordered lists only | ordered list | `enumerate` | `[start=`*`<integer>`*`]` | **`1`** | | `enumerated-list` | | | | `numbered-list` | | | | `OL` | | | | `ol` | | | | `ordered-list` | | | | `question-list` | | | unordered list | `bullet-list` | | | | `bullet-points` | | | | `bulleted-list` | | | | `itemised-list` | | | | `itemize` | | | | `UL` | | | | `ul` | | | | `unordered-list` | | ### Tabular material (`tabular.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | caption | `caption` | | onyl within long tables | cell | `cell` | `[align=center|`**`left`**`|right]` | | | | `[columns=`*`<integer>`*`]` | **`1`** | | | `[header=`**`no`**`|yes]` | | | | `[rows=`*`<integer>`*`]` | **`1`** (somewhat broken?) | column | `column` | `[align=center|centre|`**`left`**`|right]` | | | | `[left-border="|"]` | i.e., literal “`|`” | | | `[right-border="|"]` | i.e., literal “`|`” | horizontal rule | `row-rule` | `[columns=`*`<integer>`*`]` | **`1`** | | | `[weight=double|`*`single`*`]` | | row | `row` | `[page-break=no|`**`yes`**`]` | LaTeX only | | | `[valign=bottom|middle|top]` | HTML only | tabular body | `tabular-body` | | | tabular footer | `tabular-footer` | | | tabular header | `tabular-header` | | | tabular layout | `tabular` | `[align=center|centre|`**`left`**`|right]` | | | | `[border=`*`<integer>`*`]` | **`0`**; HTML only | | | `[long-table=`**`no`**`|yes]` | LaTeX only | | | `[rotate=`*`<integer>`*`]` | LaTeX only | | | `[scale=`*`<decimal>`*`]` | LaTeX only | | | `[valign=bottom|`**`center|centre`**`|top]` | LaTeX only ### Images (`images.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | image | `image` | `basename=`*`<filename>`* | without suffix | | | `format=`*`<string>`* | e.g., “png”, “pdf” | | | `location=`*`<path>`* | | | | `[inline=`**`no`**`|yes]` | image will be scaled to line height | | | `[latex-options=`*`<string>]`* | pass-through LaTeX options | zoomable image | `provide-large-version` | | within `<image>` ### Floating elements (`floaters.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | caption | `caption` | | within `<figure>` or `<table>` | figure | `figure` | `[border-placement=box|`**`none`**`|{bottom|left|right|top}]` | | | | `[label=`*`<string>]`* | | | | `[latex-placement=`*`<string>]`* | LaTeX only; usually `b|h|p|t` | multipart table | `part` | | within `<table>` | table | `table` | `[border-placement=box|`**`none`**`|{bottom|left|right|top}]` | | | | `[label=`*`<string>]`* | | | | `[latex-placement=`*`<string>]`* | ### Cross references (`cross-references.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | page label | `page` | `label=`*`<string>`* | | reference | `reference` | `label=`*`<string>`* | | | | `[include-pageref=`**`no`**`|yes]` | ### Bibliographies (`bibliography.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | bibliography | `bibliography` | `[name=`*`<section title>`*`]` | “**`References`**” | bibliography entry | `item` | `label=`*`<string>`* | within `<bibliography>` | citation | `cite` | | | cited item | `item` | `label=`*`<string>`* | within `<cite>` ## Maths ### Equations, etc. (`maths.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | calligraphic text | `calligraphic` | | LaTeX: `\mathcal` | | `cursive` | | | denominator | `denominator` | | within `<fraction>` | digit group separator | `digit-group-separator` | | **thin space** | | `digitsep` | | | equation array | `equation-array` | | | equation array row | `row` | | within `<equation-array>` | | `text` | | | formula | `math` | `[style=display|`**`inline`**`]` | | fraction | `fraction` | | | log-like function | `function` | | | numerator | `numerator` | | within `<fraction>` | subscript | `subscript` | | within `<math>` | superscript | `superscript` | | within `<math>` | variable | `var` | | | | `variable` | | ### Symbols (`mathematical-symbols.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | + | `plus` | | U+002B PLUS SIGN | | `plus-sign` | | | × | `times` | | U+00D7 MULTIPLICATION SIGN | | `multiply` | | | | `multiplication` | | | | `multiplication-sign` | | | − | `minus` | | U+2212 MINUS SIGN | | `minus-sign` | | | | `subtract` | | | ∕ | `divide` | | U+2215 DIVISION SLASH | | `division` | | | | `division-slash` | | | = | `eq` | | U+003D EQUALS SIGN | | `equality` | | | | `equals` | | | | `equals-sign` | | | ≠ | `ne` | | U+2260 NOT EQUAL TO | | `not-equal-to` | | | | `not-equals` | | | | `inequality` | | | ≈ | `almost-equal-to` | | U+2248 ALMOST EQUAL TO | | `approx` | | | | `approximately-equal-to` | | | | `approximately-equals` | | | > | `greater-than` | | U+003E GREATER-THAN SIGN | | `greater-than-sign` | | | | `gt` | | | ≥ | `ge` | | U+2265 GREATER-THAN OR EQUAL TO | | `greater-equals` | | | | `greater-than-or-equal-to` | | | < | `less-than` | | U+003C LESS-THAN SIGN | | `less-than-sign` | | | | `lt` | | | ≤ | `le` | | U+2264 LESS-THAN OR EQUAL TO | | `less-equals` | | | | `less-than-or-equal-to` | | | ∅ | `empty-set` | | U+2205 EMPTY SET | | `empty-set-sign` | | | | `null` | | | ∈ | `element` | | U+2208 ELEMENT OF | | `element-of` | | | | `element-sign` | | | | `is-an-element-of` | | | | `is-element-of` | | | ∉ | `is-not-an-element-of` | | U+2209 NOT AN ELEMENT OF | | `is-not-element-of` | | | | `not-an-element-of` | | | | `not-element` | | | | `not-element-of` | | | | `not-element-sign` | | | ∩ | `cap` | | U+2229 INTERSECTION | | `intersect` | | | | `intersect-operator` | | | | `intersection` | | | ∪ | `cup` | | U+222A UNION | | `union` | | | | `union-operator` | | | ⊂ | `is-a-subset-of` | | U+2282 SUBSET OF | | `is-subset-of` | | | | `strict-subset` | | | | `subset` | | | | `subset-of` | | | | `subset-sign` | | | ⊃ | `is-a-superset-of` | | U+2283 SUPERSET OF | | `is-superset-of` | | | | `superset` | | | | `superset-of` | | | | `superset-sign` | | | ⊆ | `inclusive-subset` | | U+2286 SUBSET OF OR EQUAL TO | | `is-a-subset-of-or-equal-to` | | | | `is-subset-of-or-equal-to` | | | | `subset-of-or-equal-to` | | | | `subset-or-equal` | | | ⊇ | `inclusive-superset` | | U+2287 SUPERSET OF OR EQUAL TO | | `is-a-superset-of-or-equal-to` | | | | `is-superset-of-or-equal-to` | | | | `superset-of-or-equal-to` | | | | `superset-or-equal` | | | ¬ | `neg` | | U+00AC NOT SIGN | | `negation` | | | | `logical-negation` | | | | `logical-negation-operator` | | | | `logical-not` | | | | `logical-not-operator` | | | | `not` | | | | `not-sign` | | | ∧ | `and` | | U+2227 LOGICAL AND | | `and-operator` | | | | `hat` | | | | `logical-and` | | | | `logical-and-operator` | | | | `wedge` | | | ∨ | `logical-or` | | U+2228 LOGICAL OR | | `logical-or-operator` | | | | `or` | | | | `or-operator` | | | | `vee` | | | →, ⇒ | `implies` | `[weight=double|`**`single`**`]` | U+2192 RIGHTWARDS ARROW | | `rarr` | | U+21D2 RIGHTWARDS DOUBLE ARROW | | `rarrow` | | | | `right-arrow` | | | | `rightarrow` | | | | `rightwards-arrow` | | | ←, ⇐ | `larr` | `[weight=double|`**`single`**`]` | U+2190 LEFTWARDS ARROW | | `larrow` | | U+21D0 LEFTWARDS DOUBLE ARROW | | `left-arrow` | | | | `leftarrow` | | | | `leftwards-arrow` | | ### Relational algebra (`relational-algebra.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | project operator (π) | `project` | | U+03C0 GREEK SMALL LETTER PI | | `project-operator` | | | | `relational-project` | | | extend operator (ε) | `extend` | | U+03B5 GREEK SMALL LETTER EPSILON | | `extend-operator` | | | | `relational-extend` | | | rename operator (ρ) | `relational-rename` | | U+03C1 GREEK SMALL LETTER RHO | | `rename` | | | | `rename-operator` | | | restrict operator (σ) | `restrict` | | U+03C2 GREEK SMALL LETTER SIGMA | | `restrict-operator` | | | | `relational-restrict` | | | join operator (⋈) | `bowtie` | | U+22C8 BOWTIE | | `inner-join` | | (or U+2A1D JOIN) | | `join` | | | | `join-operator` | | | | `natural-join` | | | | `relational-join` | | | outer join operator | `outer-join` | `[type=`**`full`**`|left|right]` | U+27D5 LEFT OUTER JOIN | | `outer-join-operator` | | U+27D6 RIGHT OUTER JOIN | | `relational-outer-join` | | U+27D7 FULL OUTER JOIN ### Greek (`greek-characters.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | α | `alpha` | | U+03B1 GREEK SMALL LETTER ALPHA | Α | `capital-alpha` | | U+0391 GREEK CAPITAL LETTER ALPHA | β | `beta` | | U+03B2 GREEK SMALL LETTER BETA | Β | `capital-beta` | | U+0392 GREEK CAPITAL LETTER BETA | γ | `gamma` | | U+03B3 GREEK SMALL LETTER GAMMA | Γ | `capital-gamma` | | U+0393 GREEK CAPITAL LETTER GAMMA | δ | `delta` | | U+03B4 GREEK SMALL LETTER DELTA | Δ | `capital-delta` | | U+0394 GREEK CAPITAL LETTER DELTA | ε | `epsilon` | | U+03B5 GREEK SMALL LETTER EPSILON | Ε | `capital-epsilon` | | U+0395 GREEK CAPITAL LETTER EPSILON | ζ | `zeta` | | U+03B6 GREEK SMALL LETTER ZETA | Ζ | `capital-zeta` | | U+0396 GREEK CAPITAL LETTER ZETA | η | `eta` | | U+03B7 GREEK SMALL LETTER ETA | Η | `capital-eta` | | U+0397 GREEK CAPITAL LETTER ETA | θ | `theta` | | U+03B8 GREEK SMALL LETTER THETA | Θ | `capital-theta` | | U+0398 GREEK CAPITAL LETTER THETA | ι | `iota` | | U+03B9 GREEK SMALL LETTER IOTA | Ι | `capital-iota` | | U+0399 GREEK CAPITAL LETTER IOTA | κ | `kappa` | | U+03BA GREEK SMALL LETTER KAPPA | Κ | `capital-kappa` | | U+039A GREEK CAPITAL LETTER KAPPA | λ | `lambda` | | U+03BB GREEK SMALL LETTER LAMBDA | Λ | `capital-lambda` | | U+039B GREEK CAPITAL LETTER LAMBDA | μ | `mu` | | U+03BC GREEK SMALL LETTER MU | Μ | `capital-mu` | | U+039C GREEK CAPITAL LETTER MU | ν | `nu` | | U+03BD GREEK SMALL LETTER NU | Ν | `capital-nu` | | U+039D GREEK CAPITAL LETTER NU | ξ | `xi` | | U+03BE GREEK SMALL LETTER XI | Ξ | `capital-xi` | | U+039E GREEK CAPITAL LETTER XI | ο | `omicron` | | U+03BF GREEK SMALL LETTER OMICRON | Ο | `capital-omicron` | | U+039F GREEK CAPITAL LETTER OMICRON | π | `pi` | | U+03C0 GREEK SMALL LETTER PI | Π | `capital-pi` | | U+03A0 GREEK CAPITAL LETTER PI | ρ | `rho` | | U+03C1 GREEK SMALL LETTER RHO | Ρ | `capital-rho` | | U+03A1 GREEK CAPITAL LETTER RHO | σ | `sigma` | | U+03C2 GREEK SMALL LETTER SIGMA | Σ | `capital-sigma` | | U+03A3 GREEK CAPITAL LETTER SIGMA | τ | `tau` | | U+03C4 GREEK SMALL LETTER TAU | Τ | `capital-tau` | | U+03A4 GREEK CAPITAL LETTER TAU | υ | `upsilon` | | U+03C5 GREEK SMALL LETTER UPSILON | Υ | `capital-upsilon` | | U+03A5 GREEK CAPITAL LETTER UPSILON | φ | `phi` | | U+03C6 GREEK PHI SYMBOL (for consistency with LaTeX) | Φ | `capital-phi` | | U+03A6 GREEK CAPITAL LETTER PHI | χ | `chi` | | U+03C7 GREEK SMALL LETTER CHI | Χ | `capital-chi` | | U+03A7 GREEK CAPITAL LETTER CHI | ψ | `psi` | | U+03C8 GREEK SMALL LETTER PSI | Ψ | `capital-psi` | | U+03A8 GREEK CAPITAL LETTER PSI | ω | `omega` | | U+03C9 GREEK SMALL LETTER OMEGA | Ω | `capital-omega` | | U+03A9 GREEK CAPITAL LETTER OMEGA ## Teaching related items ### Otago specific elements (`otago-specific.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | paper code | `paper` | | | paper number | `paper-number` | | within `<paper>` | subject code | `subject-code` | | within `<paper>` ### Questions and answers (`q-and-a.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | answer | `answer` | `[hide=`**`no`**`|yes]` | | exercise | `exercise` | `label=`*`<string>`* | numbered exercise, in box | question | `question` | | ### Teaching dates (`paper-calendar-dates.xml`) Note that `paper-calendar-dates.xml` is generated for a particular year by `generate-calendar-dates.php`. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | date | `TeachingPeriodDate` | `period=FY|S1|S2|SS|YY` | | | | `week=`*`<integer>`* | within period | | | `[format=day|day-short|day-short+year|day+long-name|` | | | | `day+short-name|day+year|`**`ISO`**`|`*`<XML date picture>`*`]` | | | | `[offset=(+|-)`*`<XSLT duration>`*`]` | e.g., “P1D”, “-P4D” | date range | `TeachingPeriodDateRange` | `format=long|short` | | | | `period=FY|S1|S2|SS|YY` | | | | `week=`*`<integer>`* | within period | | | `[wrap=no|`**`yes`**`]` | ### Teaching calendar (`paper-calendar.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | assessment | `assessment` | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | calendar table | `calendar` | `lectures-per-week=`*`<integer>`* | | | | `number-of-weeks=`*`<integer>`* | | | | `[number-laboratories=no|`**`yes`**`]` | | | | `[number-lectures=no|`**`yes`**`]` | | | | `[number-tutorials=no|`**`yes`**`]` | | footer row | `footer` | | | header row | `header` | | | note | `note` | `[num-columns=`*`<integer>`*`]` | **all columns** | laboratory | `laboratory` | `[number=no|yes]` | **`yes`** or **`calendar/@number-laboratories`** | | | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | lecture | `lecture` | `[holiday=`**`no`**`|yes]` | | | | `[number=no|yes]` | **`yes`** or **`calendar/@number-lectures`** | | | `[rows=`*`<integer>`*`]` | **`1`** | page break | `latex-calendar-break` | `[caption=no|`**`yes`**`]` | | | | `[caption-text=`*`<string>`*`]` | | reading | `reading` | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | section | `section` | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** | table heading | `heading` | `[num-columns=`*`<integer>`*`]` | **`1`** | table footing | `footing` | `[num-columns=`*`<integer>`*`]` | **`1`** | tutorial | `tutorial` | `[number=no|yes]` | **`yes`** or **`calendar/@number-tutorials`** | week | `week` | `[holiday=`**`no`**`|yes]` | | | | `[rows=`*`<integer>`*`]` | **`calendar/@lectures-per-week`** ### Oracle documentation links (`oracle-docs.xsl`) Note that `oracle-docs.xsl` is generated by `oracle-docs.perl`. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | documentation root | `OraDocsURL` | | | Administrator’s Guide | `OraAdmin` | | | Advanced Application Developer’s Guide | `OraAppDevAdv` | | | Concepts | `OraConcepts` | | | Data Warehousing Guide | `OraDataWarehousing` | | | Documentation Library | `OraDocs` | | | Error Messages | `OraErrors` | | | Java Developer’s Guide | `OraJava` | | | JDBC Developer’s Guide | `OraJDBC` | | | JDBC Java API Reference (Javadoc) | `OraJDBCRef` | | | Performance Tuning Guide | `OraTuning` | | | Object-Relational Developer’s Guide | `OraAppDevOR` | | | PL/SQL Language Reference | `OraPLSQL` | | | PL/SQL Packages and Types Reference | `OraPLSQLPkgTyp` | | | Reference | `OraReference` | | | SQL Language Reference | `OraSQL` | | ## Miscellaneous ### Hyperlinks (`hyperlinks.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | hyperlink | `hyperlink` | `[url=`*`<url>`*`]` | excluding anchor (i.e., after “#”) | | | `[label=`*`<string>`*`]` | HTML: anchor; LaTeX: label | | | `[target=`*`<string>`*`]` | HTML only (e.g., “_blank”) | URL | `e-mail` | | | | `e-mail-address` | | | | `email` | | | | `email-address` | | | | `uri` | | | | `url` | | ### Document build date (`build-date.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | displayed build date | `build-date` | `[format=`*`<XML date picture>`*`]` | **`YYYY-MM-DD hh:mm:ss`** | | | `[style=footer|`**`inline`**`]` | ### Conditional processing (`conditional-processing.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | process when format | `process-when` | `format=latex|html` | ### Native code (`native-code.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | raw code | `raw-code` | `format=html|latex` | | raw LaTeX | `raw-latex` | | | raw HTML | `raw-html` | | ### LaTeX specific (`latex.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | document class | `latex-documentclass` | `[options=`*`<options>`*`]` | | | `documentclass` | | | document options | `latex-document-options` | | | LaTeX environment | `environment` | | | LaTeX packages | `latex-packages` | | | | `package` | `[options=`*`<options>`*`]` | within `<latex-packages>` | preamble commands | `latex-commands` | | | | `command` | | within `<latex-commands>` | | `hyphenation` | | within `<latex-commands>` ### Global elements (`global-elements.xml`) These essentially define global “variables” within the document. | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | assessment due date | `DueDate` | `[style={bold|italic|underline}]` | requires top-level `<due-date>` | | | | only relevant if `/document/@class = "assignment"` | Blackboard URL | `Blackboard` | | **`https://blackboard.otago.ac.nz/`** | full paper code | `PaperCode` | | e.g., “INFO 202” | Oracle “name” | `OracleServer` | | e.g., “Oracle11*g*” | Oracle release number | `OracleServerRelease` | | e.g., “2” | Oracle version number | `OracleServerVersion` | | e.g., “11.2” | paper number | `PaperNumber` | | e.g., “202” | period paper offered | `PaperPeriod` | | e.g., “Second Semester” | subject code | `SubjectCode` | | “**`INFO`**” | year paper offered | `PaperYear` | `[offset=`*`<integer>`*`]` | **`0`** ### File inclusions (`inclusions.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | include document | `include-document` | `basename=`*`<filename>`* | including suffix | | | `type=html|latex|plain|xml` | HTML: **`html`** | | | | LaTeX: **`latex`** | | | | `xml` currently unsupported | | | `[path=`*`<path>`*`]` | without trailiing / ### Meta-elements (`meta-elements.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | ignore markup | `omit` | | | to-do item | `check` | | | | `incomplete` | | | | `to-do` | | | | `todo` | | | XML comment | `comment` | | ### Emoticons (`emoticons.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | emoticon | `emoticon` | `[type=`**`happy`**`|meh|neutral|sad]` | happy = U+263A WHITE SMILING FACE | | `smiley` | | sad = U+2639 WHITE FROWNING FACE ### Path-like elements (`path-like-elements.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | file system path | `directory` | | | keystroke | `keys` | | | menu | `menu` | | | “path item” | `item` | | within `<directory>`, `<keys>`, or `<menu>` | alt graphics key | `alt-graphics-key` | | | alt key | `alt-key` | | | backspace key | `backspace-key` | | | caps lock key | `capslock-key` | | | command key (⌘) | `command-key` | | | control key | `control-key` | | | delete key | `delete-key` | | | down arrow key | `down-arrow-key` | | | enter key | `enter-key` | | | escape key | `escape-key` | | | left arrow key | `left-arrow-key` | | | return key | `return-key` | | | right arrow key | `right-arrow-key` | | | shift key | `shift-key` | | | space key | `space-key` | | | tab key | `tab-key` | | | up arrow key | `up-arrow-key` | | | windows key | `windows-key` | | ### Multi-column layouts (`multi-column.xml`) | Item | Element(s) | Attributes | Notes | ---- | ---------- | ---------- | ----- | multi-column layout | `multi-column` | `[align=center|`**`left`**`|right]` | | | | `[vspace=big|medium|small|`*`<LaTeX length>`*`|`**_`<none>`_**`]` | | | | `[width=`*`<decimal>`*`]` | between `0` and **`1`** | column | `column` | `[align=center|`**`left`**`|right]` | | | | `[width=`*`<decimal>`*`]` | between `0` and `1`
Ignore Space
Show notes
View
xml2xslt.xsl
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl-out="[irrelevant]" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:infosci="http://info-nts-12.otago.ac.nz/infosci"> <!-- XSLT transformation for a master XML document defining how to transform elements in the course handbook source into HTML and LaTeX. Hmm, meta-stylesheet?! --> <xsl:output method="xml" encoding="utf-8" cdata-section-elements="html" /> <!-- What target format are we generating a styesheet for? Possible values: html, xhtml, latex (includes pdflatex), xelatex. --> <xsl:param name="target-format"><xsl:text>html</xsl:text></xsl:param> <!-- Define an alias for the xsl namespace to avoid confusion when generating xsl: elements in the output of this stylesheet. --> <xsl:namespace-alias stylesheet-prefix="xsl-out" result-prefix="xsl" /> <!-- Some useful variables. (Could some of these become callable templates?) --> <xsl:variable name="newline"> <xsl:text> </xsl:text> </xsl:variable> <xsl:variable name="space"><xsl:text> </xsl:text></xsl:variable> <!-- *** TEMPLATES *** --> <xsl:template match="/"> <xsl-out:stylesheet version="2.0"> <xsl-out:strip-space elements="*" /> <xsl-out:param name="subject-code"><xsl:text>INFO</xsl:text></xsl-out:param> <xsl-out:param name="paper-number" /> <xsl-out:param name="paper-year" select="year-from-date( current-date() )"/> <xsl-out:param name="period-code" /> <xsl-out:param name="showanswers"><xsl:text>no</xsl:text></xsl-out:param> <!-- This is normally the path to the current document directory. --> <xsl-out:param name="base-path"><xsl:text>.</xsl:text></xsl-out:param> <!-- This is normally the path to the root directory of the paper tree in the filesystem. --> <xsl-out:param name="paper-include-path"><xsl:text>.</xsl:text></xsl-out:param> <!-- This is normally the file paper_init.tex in the root of the paper tree. --> <xsl-out:param name="latex-initialisation-file"><xsl:text>paper_init</xsl:text></xsl-out:param> <!-- Full period string corresponding to the supplied period code. --> <xsl-out:variable name="period-string" select="infosci:expand-period-code( $period-code )" /> <!-- The date and time when the document was last built. --> <xsl-out:variable name="date-built" select="current-dateTime()" /> <!-- Get the name of the document being processed. --> <xsl-out:variable name="document-name" select="reverse( tokenize( base-uri(), '/' ) )[1]" /> <!-- Include the generated Oracle documentation code. --> <xsl-out:include href="oracle-docs.xsl" /> <!-- Boilerplate (Xe)LaTeX code for loading hyperref. If the package is already loaded (by the document class), attempting to load it again will cause an "option clash" error. To avoid this, check first whether it's already loaded. We apply the required settings afterwards regardless. --> <xsl-out:variable name="latex-hyperref-boilerplate"> <xsl-out:text> % Avoid option clash if document class already loaded it. \makeatletter \@ifpackageloaded{hyperref}{}{\usepackage{hyperref}} \makeatother % Safer to specify the hyperref options directly rather than relying on % the default hyperref.cfg, as XeLaTeX seems to ignore it :(. \hypersetup{pdfpagemode=UseNone,colorlinks,urlcolor=blue,citecolor=blue,% linkcolor=blue,breaklinks} % The menukeys documentation says it must be loaded aboslutely last (even after hyperref!). \usepackage[os=win]{menukeys} </xsl-out:text> </xsl-out:variable> <!-- We're going to use the text encoding in a few different places, so let's work out what it should be now. --> <xsl:variable name="text-encoding"> <xsl:choose> <xsl:when test="$target-format = ('latex', 'html')"> <xsl:text>iso-8859-1</xsl:text> </xsl:when> <xsl:when test="$target-format = ('xelatex', 'xhtml')"> <xsl:text>utf-8</xsl:text> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Sorry, unknown target format: </xsl:text><xsl:value-of select="$target-format" /> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- First, output the document preamble according to target format. This is generally different for each target format. --> <xsl:choose> <!-- The HTML formats are fairly simple: the only things that change are the doctypes, version number and text encoding. --> <xsl:when test="$target-format eq 'html'"> <xsl-out:output method="html" encoding="{$text-encoding}" version="4.01" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd" /> </xsl:when> <xsl:when test="$target-format eq 'xhtml'"> <xsl-out:output method="xml" encoding="{$text-encoding}" byte-order-mark="no" version="1.1" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" /> </xsl:when> <!-- The LaTeX formats, however have a bunch of miscellaneous boilerplate that appears at the start of every document, and requires more complex interleaving because of hyperref. Since we need to stuff this into a template later on, we define this using a callable template, so that we can do useful things like apply-templates within it (which wouldn't work if we just used a variable). --> <xsl:when test="$target-format eq 'latex'"> <xsl-out:output method="text" encoding="{$text-encoding}" media-type="text/plain" /> <!-- Set to no if you want this to be included inside another document. Appears here because it's used in the document preamble. --> <xsl-out:param name="standalone"><xsl:text>yes</xsl:text></xsl-out:param> <xsl-out:template name="latex-preamble"> <xsl-out:text> \usepackage{mathpazo} % mathpple is deprecated \usepackage[T1]{fontenc} \usepackage{textcomp} </xsl-out:text> <xsl-out:apply-templates select="environment/latex-packages" /> <xsl-out:value-of select="$latex-hyperref-boilerplate" /> <xsl-out:text> \renewcommand{\ttdefault}{blg} </xsl-out:text> </xsl-out:template> </xsl:when> <xsl:when test="$target-format eq 'xelatex'"> <xsl-out:output method="text" encoding="{$text-encoding}" media-type="text/plain" /> <!-- Set to no if you want this to be included inside another document. Appears here because it's used in the document preamble. --> <xsl-out:param name="standalone"><xsl:text>yes</xsl:text></xsl-out:param> <xsl-out:template name="latex-preamble"> <xsl-out:text> \usepackage[no-math]{fontspec} \usepackage{mathspec} \usepackage{xunicode} \usepackage{xltxtra} \usepackage{textcomp} % ??? </xsl-out:text> <xsl-out:apply-templates select="environment/latex-packages" /> <xsl-out:value-of select="$latex-hyperref-boilerplate" /> <xsl-out:text> % The following line is equivalent to: % \setmainfont{Minion Pro} % \setmathsfont(Latin,Digits){Minion Pro} % \setmathrm{Minion Pro} \setprimaryfont[Mapping=tex-text]{Minion Pro} \setsansfont[Mapping=tex-text, Scale=MatchUppercase, BoldFont={Open Sans}]{Open Sans Light} % Explicitly specify Mapping=tex-text only for the primary and sans fonts, % otherwise curly quotes will automatically appear in the mono font. Since % this is pretty much exclusively used for code listings, this is a bad thing. \setmonofont[Scale=MatchLowercase]{Letter Gothic 12 Pitch} % Hack to prevent digits in hyperlinks from being set in the main font instead of the mono font. % From http://tex.stackexchange.com/questions/99770/problem-with-digits-in-urls-when-using-mathspec-and-hyperref % Note: doesn't matter if this is executed multiple times. \makeatletter \DeclareMathSymbol{0}{\mathalpha}{\eu@DigitsArabic@symfont}{`0} \DeclareMathSymbol{1}{\mathalpha}{\eu@DigitsArabic@symfont}{`1} \DeclareMathSymbol{2}{\mathalpha}{\eu@DigitsArabic@symfont}{`2} \DeclareMathSymbol{3}{\mathalpha}{\eu@DigitsArabic@symfont}{`3} \DeclareMathSymbol{4}{\mathalpha}{\eu@DigitsArabic@symfont}{`4} \DeclareMathSymbol{5}{\mathalpha}{\eu@DigitsArabic@symfont}{`5} \DeclareMathSymbol{6}{\mathalpha}{\eu@DigitsArabic@symfont}{`6} \DeclareMathSymbol{7}{\mathalpha}{\eu@DigitsArabic@symfont}{`7} \DeclareMathSymbol{8}{\mathalpha}{\eu@DigitsArabic@symfont}{`8} \DeclareMathSymbol{9}{\mathalpha}{\eu@DigitsArabic@symfont}{`9} \makeatother </xsl-out:text> </xsl-out:template> </xsl:when> <!-- No need for an otherwise, as weird target formats will have already been trapped by the definition of the text-encoding variable above. --> </xsl:choose> <!-- Next, output the main document body according to target format. This is generally the same across similar target formats. --> <xsl:choose> <xsl:when test="$target-format = ('html', 'xhtml')"> <!-- *** (X)HTML Output *** --> <!-- Default to PNG images for web dispay. --> <xsl-out:param name="image-format"><xsl:text>png</xsl:text></xsl-out:param> <xsl-out:template match="/document"> <xsl-out:comment> THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:comment> <html> <head> <xsl-out:element name="link"> <xsl-out:attribute name="rel"> <xsl-out:text>Stylesheet</xsl-out:text> </xsl-out:attribute> <xsl-out:attribute name="href"> <xsl-out:text>https://blackboard.otago.ac.nz/bbcswebdav/courses/</xsl-out:text> <xsl-out:value-of select="$subject-code" /> <xsl-out:value-of select="$paper-number" /> <xsl-out:text>_</xsl-out:text> <xsl-out:value-of select="$period-code" /> <xsl-out:text>DNI_</xsl-out:text> <xsl-out:value-of select="$paper-year" /> <xsl-out:text>/db_styles.css</xsl-out:text> </xsl-out:attribute> <xsl-out:attribute name="type"> <xsl-out:text>text/css</xsl-out:text> </xsl-out:attribute> </xsl-out:element> <xsl-out:element name="meta"> <xsl-out:attribute name="http-equiv"> <xsl-out:text>Content-type</xsl-out:text> </xsl-out:attribute> <xsl-out:attribute name="content"> <xsl-out:text> <xsl:text>text/html;charset=</xsl:text> <xsl:value-of select="$text-encoding" /> </xsl-out:text> </xsl-out:attribute> </xsl-out:element> <title> <xsl-out:choose> <xsl-out:when test="@class eq 'calendar'"> <xsl-out:value-of select="$subject-code" /> <xsl-out:value-of select="$paper-number" /> <xsl-out:text> Teaching Calendar, </xsl-out:text> <xsl-out:value-of select="$period-string" /> <xsl-out:text>, </xsl-out:text> <xsl-out:value-of select="$paper-year" /> </xsl-out:when> <xsl-out:otherwise> <xsl-out:apply-templates select="title" mode="preamble" /> </xsl-out:otherwise> </xsl-out:choose> </title> </head> <body> <xsl-out:choose> <xsl-out:when test="@class eq 'calendar'" /> <xsl-out:otherwise> <xsl-out:apply-templates select="title" mode="title" /> <xsl-out:apply-templates select="date" mode="title" /> <xsl-out:apply-templates select="due-date" mode="title" /> </xsl-out:otherwise> </xsl-out:choose> <xsl-out:apply-templates /> <!-- How best to approach this - certain elements that need special handling (e.g. title, author) shouldn't be passed through here as well. --> <!-- How about we just match certain elements that we know can be handled safely, e.g. sections, paragraphs, ...? (...and their aliases?) --> <!-- Are introductions just another section, or should there be an introduction element? --> <!-- The solution is to get cleverer with our templates, e.g., multiple templates for <title> that have different match patterns (document/title, section/title). --> <!-- We also need to define an empty template for the <document-metadata> element so that its contents get ignored. --> <!-- Once these are done, we can just go apply-templates and forget about it. --> <hr /> <!-- Since HTML doesn't support footnotes as such, we instead include them as endnotes at the end of the document. --> <xsl-out:if test="count(//footnote) gt 0"> <h3>Notes</h3> <xsl-out:apply-templates select="//footnote" mode="list" /> <hr /> </xsl-out:if> <xsl-out:call-template name="build-date-internal"> <xsl-out:with-param name="format">long</xsl-out:with-param> <xsl-out:with-param name="style">footer</xsl-out:with-param> </xsl-out:call-template> </body> </html> </xsl-out:template> </xsl:when> <xsl:when test="$target-format = ('latex', 'xelatex')"> <!-- Set to pdf if using PDFLaTeX, otherwise eps. --> <xsl-out:param name="image-format"><xsl:text>pdf</xsl:text></xsl-out:param> <!-- Generate macro to encode the document class name. Note that if the document class loads a package that the boilerplate in this template also attempts to load, it may cause an "option clash" error. If so, the loading of that package will need to be made conditional in the boilerplate (using \@ifpackageloaded). So far this applies to the following packages: * geometry * hyperref Other packages that *might* cause similar problems (guessing here): * listings --> <xsl-out:template name="setup-document-class"> <xsl-out:text> \def\DocumentClass{</xsl-out:text> <xsl-out:value-of select="@latex-document-class" /> <xsl-out:if test="not( @latex-document-class )"> <xsl-out:text>article</xsl-out:text> </xsl-out:if> <xsl-out:text>} </xsl-out:text> </xsl-out:template> <!-- Generate macro to specify document class options. --> <xsl-out:template name="setup-class-options"> <xsl-out:text> \def\LaTeXOptions{</xsl-out:text> <xsl-out:value-of select="string-join(( if (@latex-font-size) then @latex-font-size else '12pt', if (@latex-paper-size) then @latex-paper-size else 'a4paper', @latex-class-options), ',')" /> <xsl-out:text>} </xsl-out:text> </xsl-out:template> <!-- *** (Xe)LaTeX Source Output *** --> <xsl-out:template match="/document"> <xsl-out:choose> <!-- standalone = "yes" means generate an entire valid (Xe)LaTeX source document. --> <xsl-out:when test="$standalone eq 'yes'"> <xsl-out:text> % THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:text> <xsl-out:call-template name="setup-class-options" /> <xsl-out:call-template name="setup-document-class" /> <xsl-out:text> \PassOptionsToClass{\LaTeXOptions}{\DocumentClass} \documentclass{\DocumentClass} % Set up paper variables, if applicable. \makeatletter \@ifpackageloaded{lecturecommon}{\input{</xsl-out:text><xsl-out:value-of select="$paper-include-path" /><xsl-out:text>/</xsl-out:text><xsl-out:value-of select="$latex-initialisation-file" /><xsl-out:text>}} \makeatother % Avoid option clash if document class already loaded it. \makeatletter \@ifpackageloaded{geometry}{}{\usepackage[margin=1in]{geometry}} \makeatother \usepackage{multirow} \usepackage{longtable} \usepackage{graphicx} \usepackage{verbatim} % needed for \verbatiminput \usepackage{relalg} % needed for join operators \usepackage{pifont} \usepackage[mode=text]{siunitx} % number and SI unit formatting ([mode=text] needed to make it use the correct % maths typeface under Unicode/fontspec, otherwise it uses Computer Modern. Works % fine in non-Unicode regardless.) \usepackage{listings} % nicely formatted code listings \usepackage[normalem]{ulem} % fancy underlining, strikeout, etc. \usepackage{boxedminipage} \usepackage{parskip} % Space-separated rather than indented paragraphs. \usepackage{rotating} % Rotate stuff. \usepackage{microtype} % For better typesetting in general. \usepackage{css-colors} % For cross-format colour specification. \makeatletter \@ifpackageloaded{amsmath}{}{\usepackage{amsmath}} \makeatother </xsl-out:text> <xsl-out:call-template name="latex-preamble" /> <xsl-out:apply-templates select="environment/latex-commands" /> <xsl-out:text> \newenvironment{answer}{\par\vspace{0.5em}\itshape}{\normalfont\vspace{1.5em}} % Listings setup. We preload the most commonly used languages to speed things % up. Other languages will still work, just not quite as quickly. \lstloadlanguages{Oracle} \lstset{basicstyle=\ttfamily,basewidth=0.5em,escapeinside={(@}{@)}, showspaces=false,showstringspaces=false} % Menukeys configuration (via Mark George). \renewmenumacro{\menu}[>]{roundedmenus} \renewmenumacro{\keys}[>]{roundedkeys} \renewmenumacro{\directory}[>]{pathswithfolder} \changemenucolortheme{roundedmenus}{blacknwhite} \changemenucolortheme{pathswithfolder}{blacknwhite} \changemenucolortheme{roundedkeys}{blacknwhite} % Length for tracking paragraph width so that we can draw borders (frames) % to the correct width. \newlength{\parwidth} \setlength{\parwidth}{\textwidth} </xsl-out:text> <xsl-out:choose> <xsl-out:when test="@latex-document-class eq 'lectureassignment'"> <xsl-out:text>\SetAssignmentNumber{</xsl-out:text> <xsl-out:value-of select="@sequence-number" /> <xsl-out:text>}</xsl-out:text> <xsl-out:call-template name="newline-internal" /> </xsl-out:when> <xsl-out:when test="@latex-document-class eq 'lectureworksheet'"> <xsl-out:text>\SetWeekNumber{</xsl-out:text> <xsl-out:value-of select="@sequence-number" /> <xsl-out:text>}</xsl-out:text> <xsl-out:call-template name="newline-internal" /> </xsl-out:when> <xsl-out:otherwise /> </xsl-out:choose> <xsl-out:apply-templates select="title" mode="preamble" /> <xsl-out:call-template name="newline-internal" /> <xsl-out:apply-templates select="author" mode="preamble" /> <xsl-out:call-template name="newline-internal" /> <xsl-out:apply-templates select="date|due-date" mode="preamble" /> <xsl-out:call-template name="newline-internal" /> <xsl-out:text> \begin{document} </xsl-out:text> <xsl-out:if test="not(@suppress-latex-title) or not(@suppress-latex-title = ('yes', 'y', 'true', 't', '1'))"> <xsl-out:text> \maketitle </xsl-out:text> </xsl-out:if> <!-- Note that the generate-latex-toc attribute doesn't override anything that the document class does. If the document class generates a table of contents anyway, the value of the attribute is irrelevant. --> <xsl-out:if test="@generate-latex-toc eq 'yes'"> <xsl-out:text> \tableofcontents </xsl-out:text> </xsl-out:if> <xsl-out:text> </xsl-out:text> <xsl-out:apply-templates /> <!-- If you're having problems with the build date appearing in weird or annoying locations (usually because of floating items like tables and figures), set document/@auto-latex-build-date to "no". You can then use the build-date element to insert the build date wherever you like, if necessary. This really only applies to LaTeX documents. The behaviour of HTML documents is much more predictable because they don't have elements with "minds of their own", so the build date is guaranteed to always appear at the very end. --> <xsl-out:if test="not(@auto-latex-build-date) or not(@auto-latex-build-date = ('no', 'n', 'false', 'f', '0'))"> <xsl-out:call-template name="build-date-internal"> <xsl-out:with-param name="format">long</xsl-out:with-param> <xsl-out:with-param name="style">footer</xsl-out:with-param> </xsl-out:call-template> </xsl-out:if> <xsl-out:text>\end{document}</xsl-out:text> </xsl-out:when> <!-- standalone = "no" means generate a (Xe)LaTeX source fragment. --> <xsl-out:otherwise> <xsl-out:apply-templates select="title" mode="chapter" /> <xsl-out:apply-templates select="*[not(self::title)]" /> <xsl-out:if test="not(@auto-latex-build-date) or not(@auto-latex-build-date = ('no', 'n', 'false', 'f', '0'))"> <xsl-out:call-template name="build-date-internal"> <xsl-out:with-param name="format">long</xsl-out:with-param> <xsl-out:with-param name="style">footer</xsl-out:with-param> </xsl-out:call-template> </xsl-out:if> </xsl-out:otherwise> </xsl-out:choose> </xsl-out:template> </xsl:when> <!-- No need for an otherwise, as weird formats will have already been trapped by the definition of the text-encoding variable above. --> </xsl:choose> <xsl:apply-templates /> </xsl-out:stylesheet> </xsl:template> <!-- Copy across templates according to the target format. If there's no common code for a particular format, an empty template is generated. --> <xsl:template match="template"> <xsl-out:template> <!-- Much easier to just copy all attributes across verbatim rather than copying specific named attributes, because we might want to use attributes that weren't originally anticipated. Might this be a problem in future? --> <xsl:copy-of select="@*" /> <!-- Copy across code that is common to ALL target formats. Any code not specific to a particular target format will therefore always appear FIRST in the resulting template. --> <xsl:copy-of select="common[not(@formats)]/node()" /> <!-- Copy across code that is specific to the current format. --> <xsl:copy-of select="common[contains(@formats, concat('/', $target-format, '/'))]/node()" /> <xsl:copy-of select="*[name(.) = $target-format]/node()" /> </xsl-out:template> </xsl:template> <!-- Dealing with functions is slightly more complex than templates, as functions aren't allowed to be empty. We therefore have to completely ignore function definitions that have no code for the target format. The second, more specific template will match in preference to the empty one. --> <xsl:template match="function" /> <xsl:template match="function[common[contains( @formats, concat( '/', $target-format, '/' ) )]]|function[common[not( @formats )]]"> <xsl-out:function> <!-- Much easier to just copy all attributes across verbatim rather than copying specific named attributes, because we might want to use attributes that weren't originally anticipated. Might this be a problem in future? --> <xsl:copy-of select="@*" /> <!-- Copy across code that is common to ALL target formats. Any code not specific to a particular target format will therefore always appear FIRST in the resulting template. --> <xsl:copy-of select="common[not( @formats )]/node()" /> <!-- Copy across code that is specific to the current format. --> <xsl:copy-of select="common[contains( @formats, concat( '/', $target-format, '/' ) )]/node()" /> <xsl:copy-of select="*[name( . )=$target-format]/node()" /> </xsl-out:function> </xsl:template> <!-- Include templates from a stylesheet sub-module. This enables us to modularise the master stylesheet. --> <xsl:template match="include"> <xsl:apply-templates select="document( @href )/stylesheet/*" /> </xsl:template> <!-- This template produces a template that calls another template, i.e., it implements a template alias. The generated template probably doesn't need a name, but we'll put one in anyway. --> <xsl:template match="alias"> <xsl-out:template> <xsl:attribute name="name"><xsl:value-of select="@source" /></xsl:attribute> <xsl:attribute name="match"><xsl:value-of select="@source" /></xsl:attribute> <xsl-out:call-template> <xsl:attribute name="name"><xsl:value-of select="@target" /></xsl:attribute> </xsl-out:call-template> </xsl-out:template> </xsl:template> </xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl-out="[irrelevant]" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:infosci="http://info-nts-12.otago.ac.nz/infosci"> <!-- XSLT transformation for a master XML document defining how to transform elements in the course handbook source into HTML and LaTeX. Hmm, meta-stylesheet?! --> <xsl:output method="xml" encoding="utf-8" cdata-section-elements="html" /> <!-- What target format are we generating a styesheet for? Possible values: html, xhtml, latex (includes pdflatex), xelatex. --> <xsl:param name="target-format"><xsl:text>html</xsl:text></xsl:param> <!-- Define an alias for the xsl namespace to avoid confusion when generating xsl: elements in the output of this stylesheet. --> <xsl:namespace-alias stylesheet-prefix="xsl-out" result-prefix="xsl" /> <!-- Some useful variables. (Could some of these become callable templates?) --> <xsl:variable name="newline"> <xsl:text> </xsl:text> </xsl:variable> <xsl:variable name="space"><xsl:text> </xsl:text></xsl:variable> <!-- *** TEMPLATES *** --> <xsl:template match="/"> <xsl-out:stylesheet version="2.0"> <xsl-out:strip-space elements="*" /> <xsl-out:param name="subject-code"><xsl:text>INFO</xsl:text></xsl-out:param> <xsl-out:param name="paper-number" /> <xsl-out:param name="paper-year" select="year-from-date( current-date() )"/> <xsl-out:param name="period-code" /> <xsl-out:param name="showanswers"><xsl:text>no</xsl:text></xsl-out:param> <!-- This is normally the path to the current document directory. --> <xsl-out:param name="base-path"><xsl:text>.</xsl:text></xsl-out:param> <!-- This is normally the path to the root directory of the paper tree in the filesystem. --> <xsl-out:param name="paper-include-path"><xsl:text>.</xsl:text></xsl-out:param> <!-- This is normally the file paper_init.tex in the root of the paper tree. --> <xsl-out:param name="latex-initialisation-file"><xsl:text>paper_init</xsl:text></xsl-out:param> <!-- Full period string corresponding to the supplied period code. --> <xsl-out:variable name="period-string" select="infosci:expand-period-code( $period-code )" /> <!-- The date and time when the document was last built. --> <xsl-out:variable name="date-built" select="current-dateTime()" /> <!-- Get the name of the document being processed. --> <xsl-out:variable name="document-name" select="reverse( tokenize( base-uri(), '/' ) )[1]" /> <!-- Include the generated Oracle documentation code. --> <xsl-out:include href="oracle-docs.xsl" /> <!-- Boilerplate (Xe)LaTeX code for loading hyperref. If the package is already loaded (by the document class), attempting to load it again will cause an "option clash" error. To avoid this, check first whether it's already loaded. We apply the required settings afterwards regardless. --> <xsl-out:variable name="latex-hyperref-boilerplate"> <xsl-out:text> % Avoid option clash if document class already loaded it. \makeatletter \@ifpackageloaded{hyperref}{}{\usepackage{hyperref}} \makeatother % Safer to specify the hyperref options directly rather than relying on % the default hyperref.cfg, as XeLaTeX seems to ignore it :(. \hypersetup{pdfpagemode=UseNone,colorlinks,urlcolor=blue,citecolor=blue,% linkcolor=blue,breaklinks} % The menukeys documentation says it must be loaded aboslutely last (even after hyperref!). \usepackage[os=win]{menukeys} </xsl-out:text> </xsl-out:variable> <!-- We're going to use the text encoding in a few different places, so let's work out what it should be now. --> <xsl:variable name="text-encoding"> <xsl:choose> <xsl:when test="$target-format = ('latex', 'html')"> <xsl:text>iso-8859-1</xsl:text> </xsl:when> <xsl:when test="$target-format = ('xelatex', 'xhtml')"> <xsl:text>utf-8</xsl:text> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Sorry, unknown target format: </xsl:text><xsl:value-of select="$target-format" /> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- First, output the document preamble according to target format. This is generally different for each target format. --> <xsl:choose> <!-- The HTML formats are fairly simple: the only things that change are the doctypes, version number and text encoding. --> <xsl:when test="$target-format eq 'html'"> <xsl-out:output method="html" encoding="{$text-encoding}" version="4.01" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd" /> </xsl:when> <xsl:when test="$target-format eq 'xhtml'"> <xsl-out:output method="xml" encoding="{$text-encoding}" byte-order-mark="no" version="1.1" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" /> </xsl:when> <!-- The LaTeX formats, however have a bunch of miscellaneous boilerplate that appears at the start of every document, and requires more complex interleaving because of hyperref. Since we need to stuff this into a template later on, we define this using a callable template, so that we can do useful things like apply-templates within it (which wouldn't work if we just used a variable). --> <xsl:when test="$target-format eq 'latex'"> <xsl-out:output method="text" encoding="{$text-encoding}" media-type="text/plain" /> <!-- Set to no if you want this to be included inside another document. Appears here because it's used in the document preamble. --> <xsl-out:param name="standalone"><xsl:text>yes</xsl:text></xsl-out:param> <xsl-out:template name="latex-preamble"> <xsl-out:text> \usepackage{mathpazo} % mathpple is deprecated \usepackage[T1]{fontenc} \usepackage{textcomp} </xsl-out:text> <xsl-out:apply-templates select="environment/latex-packages" /> <xsl-out:value-of select="$latex-hyperref-boilerplate" /> <xsl-out:text> \renewcommand{\ttdefault}{blg} </xsl-out:text> </xsl-out:template> </xsl:when> <xsl:when test="$target-format eq 'xelatex'"> <xsl-out:output method="text" encoding="{$text-encoding}" media-type="text/plain" /> <!-- Set to no if you want this to be included inside another document. Appears here because it's used in the document preamble. --> <xsl-out:param name="standalone"><xsl:text>yes</xsl:text></xsl-out:param> <xsl-out:template name="latex-preamble"> <xsl-out:text> \usepackage[no-math]{fontspec} \usepackage{mathspec} \usepackage{xunicode} \usepackage{xltxtra} \usepackage{textcomp} % ??? </xsl-out:text> <xsl-out:apply-templates select="environment/latex-packages" /> <xsl-out:value-of select="$latex-hyperref-boilerplate" /> <xsl-out:text> % The following line is equivalent to: % \setmainfont{Minion Pro} % \setmathsfont(Latin,Digits){Minion Pro} % \setmathrm{Minion Pro} \setprimaryfont[Mapping=tex-text]{Minion Pro} \setsansfont[Mapping=tex-text, Scale=MatchUppercase, BoldFont={Open Sans}]{Open Sans Light} % Explicitly specify Mapping=tex-text only for the primary and sans fonts, % otherwise curly quotes will automatically appear in the mono font. Since % this is pretty much exclusively used for code listings, this is a bad thing. \setmonofont[Scale=MatchLowercase]{Letter Gothic 12 Pitch} % Hack to prevent digits in hyperlinks from being set in the main font instead of the mono font. % From http://tex.stackexchange.com/questions/99770/problem-with-digits-in-urls-when-using-mathspec-and-hyperref % Note: doesn't matter if this is executed multiple times. \makeatletter \DeclareMathSymbol{0}{\mathalpha}{\eu@DigitsArabic@symfont}{`0} \DeclareMathSymbol{1}{\mathalpha}{\eu@DigitsArabic@symfont}{`1} \DeclareMathSymbol{2}{\mathalpha}{\eu@DigitsArabic@symfont}{`2} \DeclareMathSymbol{3}{\mathalpha}{\eu@DigitsArabic@symfont}{`3} \DeclareMathSymbol{4}{\mathalpha}{\eu@DigitsArabic@symfont}{`4} \DeclareMathSymbol{5}{\mathalpha}{\eu@DigitsArabic@symfont}{`5} \DeclareMathSymbol{6}{\mathalpha}{\eu@DigitsArabic@symfont}{`6} \DeclareMathSymbol{7}{\mathalpha}{\eu@DigitsArabic@symfont}{`7} \DeclareMathSymbol{8}{\mathalpha}{\eu@DigitsArabic@symfont}{`8} \DeclareMathSymbol{9}{\mathalpha}{\eu@DigitsArabic@symfont}{`9} \makeatother </xsl-out:text> </xsl-out:template> </xsl:when> <!-- No need for an otherwise, as weird target formats will have already been trapped by the definition of the text-encoding variable above. --> </xsl:choose> <!-- Next, output the main document body according to target format. This is generally the same across similar target formats. --> <xsl:choose> <xsl:when test="$target-format = ('html', 'xhtml')"> <!-- *** (X)HTML Output *** --> <!-- Default to PNG images for web dispay. --> <xsl-out:param name="image-format"><xsl:text>png</xsl:text></xsl-out:param> <xsl-out:template match="/document"> <xsl-out:comment> THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:comment> <html> <head> <xsl-out:element name="link"> <xsl-out:attribute name="rel"> <xsl-out:text>Stylesheet</xsl-out:text> </xsl-out:attribute> <xsl-out:attribute name="href"> <xsl-out:text>https://blackboard.otago.ac.nz/bbcswebdav/courses/</xsl-out:text> <xsl-out:value-of select="$subject-code" /> <xsl-out:value-of select="$paper-number" /> <xsl-out:text>_</xsl-out:text> <xsl-out:value-of select="$period-code" /> <xsl-out:text>DNI_</xsl-out:text> <xsl-out:value-of select="$paper-year" /> <xsl-out:text>/db_styles.css</xsl-out:text> </xsl-out:attribute> <xsl-out:attribute name="type"> <xsl-out:text>text/css</xsl-out:text> </xsl-out:attribute> </xsl-out:element> <xsl-out:element name="meta"> <xsl-out:attribute name="http-equiv"> <xsl-out:text>Content-type</xsl-out:text> </xsl-out:attribute> <xsl-out:attribute name="content"> <xsl-out:text> <xsl:text>text/html;charset=</xsl:text> <xsl:value-of select="$text-encoding" /> </xsl-out:text> </xsl-out:attribute> </xsl-out:element> <title> <xsl-out:choose> <xsl-out:when test="@class eq 'calendar'"> <xsl-out:value-of select="$subject-code" /> <xsl-out:value-of select="$paper-number" /> <xsl-out:text> Teaching Calendar, </xsl-out:text> <xsl-out:value-of select="$period-string" /> <xsl-out:text>, </xsl-out:text> <xsl-out:value-of select="$paper-year" /> </xsl-out:when> <xsl-out:otherwise> <xsl-out:apply-templates select="title" mode="preamble" /> </xsl-out:otherwise> </xsl-out:choose> </title> </head> <body> <xsl-out:choose> <xsl-out:when test="@class eq 'calendar'" /> <xsl-out:otherwise> <xsl-out:apply-templates select="title" mode="title" /> <xsl-out:apply-templates select="date" mode="title" /> <xsl-out:apply-templates select="due-date" mode="title" /> </xsl-out:otherwise> </xsl-out:choose> <xsl-out:apply-templates /> <!-- How best to approach this - certain elements that need special handling (e.g. title, author) shouldn't be passed through here as well. --> <!-- How about we just match certain elements that we know can be handled safely, e.g. sections, paragraphs, ...? (...and their aliases?) --> <!-- Are introductions just another section, or should there be an introduction element? --> <!-- The solution is to get cleverer with our templates, e.g., multiple templates for <title> that have different match patterns (document/title, section/title). --> <!-- We also need to define an empty template for the <document-metadata> element so that its contents get ignored. --> <!-- Once these are done, we can just go apply-templates and forget about it. --> <hr /> <!-- Since HTML doesn't support footnotes as such, we instead include them as endnotes at the end of the document. --> <xsl-out:if test="count(//footnote) gt 0"> <h3>Notes</h3> <xsl-out:apply-templates select="//footnote" mode="list" /> <hr /> </xsl-out:if> <xsl-out:call-template name="build-date-internal"> <xsl-out:with-param name="format">long</xsl-out:with-param> <xsl-out:with-param name="style">footer</xsl-out:with-param> </xsl-out:call-template> </body> </html> </xsl-out:template> </xsl:when> <xsl:when test="$target-format = ('latex', 'xelatex')"> <!-- Set to pdf if using PDFLaTeX, otherwise eps. --> <xsl-out:param name="image-format"><xsl:text>pdf</xsl:text></xsl-out:param> <!-- Generate macro to encode the document class name. Note that if the document class loads a package that the boilerplate in this template also attempts to load, it may cause an "option clash" error. If so, the loading of that package will need to be made conditional in the boilerplate (using \@ifpackageloaded). So far this applies to the following packages: * geometry * hyperref Other packages that *might* cause similar problems (guessing here): * listings --> <xsl-out:template name="setup-document-class"> <xsl-out:text> \def\DocumentClass{</xsl-out:text> <xsl-out:value-of select="@latex-document-class" /> <xsl-out:if test="not( @latex-document-class )"> <xsl-out:text>article</xsl-out:text> </xsl-out:if> <xsl-out:text>} </xsl-out:text> </xsl-out:template> <!-- Generate macro to specify document class options. --> <xsl-out:template name="setup-class-options"> <xsl-out:text> \def\LaTeXOptions{</xsl-out:text> <xsl-out:value-of select="string-join(( if (@latex-font-size) then @latex-font-size else '12pt', if (@latex-paper-size) then @latex-paper-size else 'a4paper', @latex-class-options), ',')" /> <xsl-out:text>} </xsl-out:text> </xsl-out:template> <!-- *** (Xe)LaTeX Source Output *** --> <xsl-out:template match="/document"> <xsl-out:choose> <!-- standalone = "yes" means generate an entire valid (Xe)LaTeX source document. --> <xsl-out:when test="$standalone eq 'yes'"> <xsl-out:text> % THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:text> <xsl-out:call-template name="setup-class-options" /> <xsl-out:call-template name="setup-document-class" /> <xsl-out:text> \PassOptionsToClass{\LaTeXOptions}{\DocumentClass} \documentclass{\DocumentClass} % Set up paper variables, if applicable. \makeatletter \@ifpackageloaded{lecturecommon}{\input{</xsl-out:text><xsl-out:value-of select="$paper-include-path" /><xsl-out:text>/</xsl-out:text><xsl-out:value-of select="$latex-initialisation-file" /><xsl-out:text>}} \makeatother % Avoid option clash if document class already loaded it. \makeatletter \@ifpackageloaded{geometry}{}{\usepackage[margin=1in]{geometry}} \makeatother \usepackage{multirow} \usepackage{longtable} \usepackage{graphicx} \usepackage{verbatim} % needed for \verbatiminput \usepackage{relalg} % needed for join operators \usepackage{pifont} \usepackage[mode=text]{siunitx} % number and SI unit formatting ([mode=text] needed to make it use the correct % maths typeface under Unicode/fontspec, otherwise it uses Computer Modern. Works % fine in non-Unicode regardless.) \usepackage{listings} % nicely formatted code listings \usepackage[normalem]{ulem} % fancy underlining, strikeout, etc. \usepackage{boxedminipage} \usepackage{parskip} % Space-separated rather than indented paragraphs. \usepackage{rotating} % Rotate stuff. \usepackage{microtype} % For better typesetting in general. \makeatletter \@ifpackageloaded{amsmath}{}{\usepackage{amsmath}} \makeatother </xsl-out:text> <xsl-out:call-template name="latex-preamble" /> <xsl-out:apply-templates select="environment/latex-commands" /> <xsl-out:text> \newenvironment{answer}{\par\vspace{0.5em}\itshape}{\normalfont\vspace{1.5em}} % Listings setup. We preload the most commonly used languages to speed things % up. Other languages will still work, just not quite as quickly. \lstloadlanguages{Oracle} \lstset{basicstyle=\ttfamily,basewidth=0.5em,escapeinside={(@}{@)}, showspaces=false,showstringspaces=false} % Menukeys configuration (via Mark George). \renewmenumacro{\menu}[>]{roundedmenus} \renewmenumacro{\keys}[>]{roundedkeys} \renewmenumacro{\directory}[>]{pathswithfolder} \changemenucolortheme{roundedmenus}{blacknwhite} \changemenucolortheme{pathswithfolder}{blacknwhite} \changemenucolortheme{roundedkeys}{blacknwhite} % Length for tracking paragraph width so that we can draw borders (frames) % to the correct width. \newlength{\parwidth} \setlength{\parwidth}{\textwidth} </xsl-out:text> <xsl-out:choose> <xsl-out:when test="@latex-document-class eq 'lectureassignment'"> <xsl-out:text>\SetAssignmentNumber{</xsl-out:text> <xsl-out:value-of select="@sequence-number" /> <xsl-out:text>}</xsl-out:text> <xsl-out:call-template name="newline-internal" /> </xsl-out:when> <xsl-out:when test="@latex-document-class eq 'lectureworksheet'"> <xsl-out:text>\SetWeekNumber{</xsl-out:text> <xsl-out:value-of select="@sequence-number" /> <xsl-out:text>}</xsl-out:text> <xsl-out:call-template name="newline-internal" /> </xsl-out:when> <xsl-out:otherwise /> </xsl-out:choose> <xsl-out:apply-templates select="title" mode="preamble" /> <xsl-out:call-template name="newline-internal" /> <xsl-out:apply-templates select="author" mode="preamble" /> <xsl-out:call-template name="newline-internal" /> <xsl-out:apply-templates select="date|due-date" mode="preamble" /> <xsl-out:call-template name="newline-internal" /> <xsl-out:text> \begin{document} </xsl-out:text> <xsl-out:if test="not(@suppress-latex-title) or not(@suppress-latex-title = ('yes', 'y', 'true', 't', '1'))"> <xsl-out:text> \maketitle </xsl-out:text> </xsl-out:if> <!-- Note that the generate-latex-toc attribute doesn't override anything that the document class does. If the document class generates a table of contents anyway, the value of the attribute is irrelevant. --> <xsl-out:if test="@generate-latex-toc eq 'yes'"> <xsl-out:text> \tableofcontents </xsl-out:text> </xsl-out:if> <xsl-out:text> </xsl-out:text> <xsl-out:apply-templates /> <!-- If you're having problems with the build date appearing in weird or annoying locations (usually because of floating items like tables and figures), set document/@auto-latex-build-date to "no". You can then use the build-date element to insert the build date wherever you like, if necessary. This really only applies to LaTeX documents. The behaviour of HTML documents is much more predictable because they don't have elements with "minds of their own", so the build date is guaranteed to always appear at the very end. --> <xsl-out:if test="not(@auto-latex-build-date) or not(@auto-latex-build-date = ('no', 'n', 'false', 'f', '0'))"> <xsl-out:call-template name="build-date-internal"> <xsl-out:with-param name="format">long</xsl-out:with-param> <xsl-out:with-param name="style">footer</xsl-out:with-param> </xsl-out:call-template> </xsl-out:if> <xsl-out:text>\end{document}</xsl-out:text> </xsl-out:when> <!-- standalone = "no" means generate a (Xe)LaTeX source fragment. --> <xsl-out:otherwise> <xsl-out:apply-templates select="title" mode="chapter" /> <xsl-out:apply-templates select="*[not(self::title)]" /> <xsl-out:if test="not(@auto-latex-build-date) or not(@auto-latex-build-date = ('no', 'n', 'false', 'f', '0'))"> <xsl-out:call-template name="build-date-internal"> <xsl-out:with-param name="format">long</xsl-out:with-param> <xsl-out:with-param name="style">footer</xsl-out:with-param> </xsl-out:call-template> </xsl-out:if> </xsl-out:otherwise> </xsl-out:choose> </xsl-out:template> </xsl:when> <!-- No need for an otherwise, as weird formats will have already been trapped by the definition of the text-encoding variable above. --> </xsl:choose> <xsl:apply-templates /> </xsl-out:stylesheet> </xsl:template> <!-- Copy across templates according to the target format. If there's no common code for a particular format, an empty template is generated. --> <xsl:template match="template"> <xsl-out:template> <!-- Much easier to just copy all attributes across verbatim rather than copying specific named attributes, because we might want to use attributes that weren't originally anticipated. Might this be a problem in future? --> <xsl:copy-of select="@*" /> <!-- Copy across code that is common to ALL target formats. Any code not specific to a particular target format will therefore always appear FIRST in the resulting template. --> <xsl:copy-of select="common[not(@formats)]/node()" /> <!-- Copy across code that is specific to the current format. --> <xsl:copy-of select="common[contains(@formats, concat('/', $target-format, '/'))]/node()" /> <xsl:copy-of select="*[name(.) = $target-format]/node()" /> </xsl-out:template> </xsl:template> <!-- Dealing with functions is slightly more complex than templates, as functions aren't allowed to be empty. We therefore have to completely ignore function definitions that have no code for the target format. The second, more specific template will match in preference to the empty one. --> <xsl:template match="function" /> <xsl:template match="function[common[contains( @formats, concat( '/', $target-format, '/' ) )]]|function[common[not( @formats )]]"> <xsl-out:function> <!-- Much easier to just copy all attributes across verbatim rather than copying specific named attributes, because we might want to use attributes that weren't originally anticipated. Might this be a problem in future? --> <xsl:copy-of select="@*" /> <!-- Copy across code that is common to ALL target formats. Any code not specific to a particular target format will therefore always appear FIRST in the resulting template. --> <xsl:copy-of select="common[not( @formats )]/node()" /> <!-- Copy across code that is specific to the current format. --> <xsl:copy-of select="common[contains( @formats, concat( '/', $target-format, '/' ) )]/node()" /> <xsl:copy-of select="*[name( . )=$target-format]/node()" /> </xsl-out:function> </xsl:template> <!-- Include templates from a stylesheet sub-module. This enables us to modularise the master stylesheet. --> <xsl:template match="include"> <xsl:apply-templates select="document( @href )/stylesheet/*" /> </xsl:template> <!-- This template produces a template that calls another template, i.e., it implements a template alias. The generated template probably doesn't need a name, but we'll put one in anyway. --> <xsl:template match="alias"> <xsl-out:template> <xsl:attribute name="name"><xsl:value-of select="@source" /></xsl:attribute> <xsl:attribute name="match"><xsl:value-of select="@source" /></xsl:attribute> <xsl-out:call-template> <xsl:attribute name="name"><xsl:value-of select="@target" /></xsl:attribute> </xsl-out:call-template> </xsl-out:template> </xsl:template> </xsl:stylesheet>
Show line notes below