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
- Made more consistent use of xsl:text.
master
1 parent
637ed56
commit
00efef2c928d07f18de8117b05846d2580d054b5
nstanger
authored
on 22 Feb 2012
Patch
Showing
2 changed files
modules/mathematical-symbols.xml
modules/quotations.xml
Ignore Space
Show notes
View
modules/mathematical-symbols.xml
<?xml version="1.0" encoding="utf-8"?> <!-- Various mathematical operators and symbols. We get around the problem of math vs. non-math mode operators in LaTeX by liberally sprinkling \ensuremath around. If we're not in math mode, it enables it, and if we're already in math mode, it ignores it. This means we don't need identical templates for math and non-math modes. Yay! Note that some operators (binary in particular) need spaces around them in the HTML templates, as they seem to get munched otherwise. The "strip" mode forms of the templates are for use in the context of an HTML <title> element (so the mode is only relevant to the HTML formats). Embedding HTML markup inside the <title> element causes the markup to appear verbatim in the window title, i.e., <title><em>foo</em> bar</title> will appear in the window title as "<em>foo</em> bar", not "foo bar". Putting the stylesheet into strip mode means that it will only output text nodes unless otherwise specified for a particular element. Generally the "strip" templates will simply call-template to the original, unless the original contains markup that needs to be eliminated (e.g., see space below). The downside of this approach, of course, is that you need "strip" mode templates for quite a lot of things, but that can't really be helped. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- BASIC OPERATORS AND SYMBOLS. --> <!-- Addition binary operation symbol (+). --> <template name="plus-operator" match="plus|plus-sign"> <!-- U+002B PLUS SIGN --> <common><xsl:text>+</xsl:text></common> </template> <!-- Multiplication binary operation symbol (×). --> <template name="times-operator" match="times|multiply|multiplication|multiplication-sign"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\times}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&times;</xsl:text></html> <!-- U+00D7 MULTIPLICATION SIGN --> <xhtml><span class="unicode"><xsl:text>×</xsl:text></span></xhtml> </template> <!-- Subtraction binary operation symbol (−). --> <template name="minus-operator" match="minus|subtract|minus-sign"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{-}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&minus;</xsl:text></html> <!-- U+2212 MINUS SIGN --> <xhtml><span class="unicode"><xsl:text>−</xsl:text></span></xhtml> </template> <!-- Division binary operation symbol (∕). --> <template name="divide-operator" match="divide|division|division-slash"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{/}</xsl:text></common> <html><xsl:text>/</xsl:text></html> <!-- U+2215 DIVISION SLASH --> <xhtml><span class="unicode"><xsl:text>∕</xsl:text></span></xhtml> </template> <!-- Equality relation symbol (=). --> <template name="equals-operator" match="equals|eq|equals-sign|equality"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{=}</xsl:text></common> <!-- U+003D EQUALS SIGN --> <common formats="/html/xhtml/"><xsl:text> = </xsl:text></common> </template> <!-- Inequality relation symbol (≠). --> <template name="not-equals-operator" match="not-equals|ne|inequality|not-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\neq}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &ne; </xsl:text></html> <!-- U+2260 NOT EQUAL TO --> <xhtml><xsl:text> ≠ </xsl:text></xhtml> </template> <!-- Approximation relation symbol (≈). --> <template name="approximately-equals-operator" match="approximately-equals|approximately-equal-to|approx|almost-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\approx}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&asymp;</xsl:text></html> <!-- U+2248 ALMOST EQUAL TO --> <xhtml><xsl:text>≈</xsl:text></xhtml> </template> <!-- Greater than relation symbol (>). --> <template name="greater-than-operator" match="greater-than|gt|greater-than-sign"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{>}</xsl:text></common> <!-- U+003E GREATER-THAN SIGN --> <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes"> &gt; </xsl:text></common> </template> <!-- Greater than or equal to relation symbol (≥). --> <template name="greater-equals-operator" match="greater-equals|ge|greater-than-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\geq}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &ge; </xsl:text></html> <!-- U+2265 GREATER-THAN OR EQUAL TO --> <xhtml><xsl:text> ≥ </xsl:text></xhtml> </template> <!-- Less than relation symbol (<). --> <template name="less-than-operator" match="less-than|lt|less-than-sign"> <common formats="/latex/xelatex/"><xsl:text> \ensuremath{<} </xsl:text></common> <!-- U+003C LESS-THAN SIGN --> <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes"> &lt; </xsl:text></common> </template> <!-- Less than or equal to relation symbol (≤). --> <template name="less-equals-operator" match="less-equals|le|less-than-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text> \ensuremath{\leq} </xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &le; </xsl:text></html> <!-- U+2264 LESS-THAN OR EQUAL TO --> <xhtml><xsl:text> ≤ </xsl:text></xhtml> </template> <!-- SYMBOLS RELATING TO SETS. --> <!-- Empty set symbol (∅). --> <template name="empty-set-sign" match="empty-set-sign|empty-set|null"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\emptyset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&empty;</xsl:text></html> <!-- U+2205 EMPTY SET --> <xhtml><span class="unicode"><xsl:text>∅</xsl:text></span></xhtml> </template> <template name="empty-set-sign-strip" match="empty-set-sign|empty-set|null" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="empty-set-sign" /> </common> </template> <!-- Element-of relation symbol (∈). --> <template name="element-sign" match="element-sign|element|element-of|is-element-of|is-an-element-of"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\in}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&isin;</xsl:text></html> <!-- U+2208 ELEMENT OF --> <xhtml><span class="unicode"><xsl:text>∈</xsl:text></span></xhtml> </template> <template name="element-sign-strip" match="element-sign|element|element-of|is-element-of|is-an-element-of" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="element-sign" /> </common> </template> <!-- Not-element-of relation symbol (∉). --> <template name="not-element-sign" match="not-element-sign|not-element|not-element-of|is-not-element-of|is-not-an-element-of|not-an-element-of"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\not\in}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&notin;</xsl:text></html> <!-- U+2209 NOT AN ELEMENT OF --> <xhtml><span class="unicode"><xsl:text>∉</xsl:text></span></xhtml> </template> <template name="not-element-sign-strip" match="not-element-sign|not-element|not-element-of|is-not-element-of|is-not-an-element-of|not-an-element-of" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="not-element-sign" /> </common> </template> <!-- Intersection binary operation symbol (∩). --> <template name="intersect-operator" match="intersect-operator|intersect|intersection|cap"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\cap}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &cap; </xsl:text></html> <!-- U+2229 INTERSECTION --> <xhtml><span class="unicode"><xsl:text> ∩ </xsl:text></span></xhtml> </template> <template name="intersect-operator-strip" match="intersect-operator|intersect|intersection|cap" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="intersect-operator" /> </common> </template> <!-- Union binary operation symbol (∪). --> <template name="union-operator" match="union-operator|union|cup"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\cup}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &cup; </xsl:text></html> <!-- U+222A UNION --> <xhtml><span class="unicode"><xsl:text> ∪ </xsl:text></span></xhtml> </template> <template name="union-operator-strip" match="union-operator|union|cup" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="union-operator" /> </common> </template> <!-- Strict subset relation symbol (⊂). --> <template name="strict-subset-sign" match="subset-sign|subset|subset-of|is-subset-of|is-a-subset-of|strict-subset"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\subset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&sub;</xsl:text></html> <!-- U+2282 SUBSET OF --> <xhtml><span class="unicode"><xsl:text>⊂</xsl:text></span></xhtml> </template> <template name="strict-subset-sign-strip" match="subset-sign|subset|subset-of|is-subset-of|is-a-subset-of|strict-subset" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="strict-subset-sign" /> </common> </template> <!-- Strict superset relation symbol (⊃). --> <template name="strict-superset-sign" match="superset-sign|superset|superset-of|is-superset-of|is-a-superset-of"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\supset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&sup;</xsl:text></html> <!-- U+2283 SUPERSET OF --> <xhtml><span class="unicode"><xsl:text>⊃</xsl:text></span></xhtml> </template> <template name="strict-superset-sign-strip" match="superset-sign|superset|superset-of|is-superset-of|is-a-superset-of" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="strict-superset-sign" /> </common> </template> <!-- Inclusive subset relation symbol (⊆). --> <template name="inclusive-subset-sign" match="inclusive-subset|subset-or-equal|subset-of-or-equal-to|is-subset-of-or-equal-to|is-a-subset-of-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\subseteq}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&sube;</xsl:text></html> <!-- U+2286 SUBSET OF OR EQUAL TO --> <xhtml><span class="unicode"><xsl:text>⊆</xsl:text></span></xhtml> </template> <template name="inclusive-subset-sign-strip" match="inclusive-subset|subset-or-equal|subset-of-or-equal-to|is-subset-of-or-equal-to|is-a-subset-of-or-equal-to" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="inclusive-subset-sign" /> </common> </template> <!-- Inclusive superset relation symbol (⊇). --> <template name="inclusive-superset-sign" match="inclusive-superset|superset-or-equal|superset-of-or-equal-to|is-superset-of-or-equal-to|is-a-superset-of-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\supset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&supe;</xsl:text></html> <!-- U+2287 SUPERSET OF OR EQUAL TO --> <xhtml><span class="unicode"><xsl:text>⊇</xsl:text></span></xhtml> </template> <template name="inclusive-superset-sign-strip" match="inclusive-superset|superset-or-equal|superset-of-or-equal-to|is-superset-of-or-equal-to|is-a-superset-of-or-equal-to" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="inclusive-superset-sign" /> </common> </template> <!-- SYMBOLS RELATING TO LOGIC. --> <!-- Logical NOT binary operation symbol (¬). --> <template name="logical-not-operator" match="logical-not-operator|logical-negation-operator|logical-negation|logical-not|not|negation|neg|not-sign"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\neg}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&not;</xsl:text></html> <!-- U+00AC NOT SIGN --> <xhtml><span class="unicode"><xsl:text>¬</xsl:text></span></xhtml> </template> <template name="logical-not-operator-strip" match="logical-not-operator|logical-negation-operator|logical-negation|logical-not|not|negation|neg|not-sign" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="logical-not-operator" /> </common> </template> <!-- Logical AND binary operation symbol (∧). --> <template name="logical-and-operator" match="logical-and-operator|logical-and|and|and-operator|hat|wedge"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\wedge}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &and; </xsl:text></html> <!-- U+2227 LOGICAL AND --> <xhtml><span class="unicode"><xsl:text> ∧ </xsl:text></span></xhtml> </template> <template name="logical-and-operator-strip" match="logical-and-operator|logical-and|and|and-operator|hat|wedge" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="logical-and-operator" /> </common> </template> <!-- Logical OR binary operation symbol (∨). --> <template name="logical-or-operator" match="logical-or-operator|logical-or|or|or-operator|vee"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\vee}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &or; </xsl:text></html> <!-- U+2228 LOGICAL OR --> <xhtml><span class="unicode"><xsl:text> ∨ </xsl:text></span></xhtml> </template> <template name="logical-or-operator-strip" match="logical-or-operator|logical-or|or|or-operator|vee" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="logical-or-operator" /> </common> </template> <!-- ARROWS. --> <!-- Rightwards arrow, both single and double (→, ⇒). We can't include the Unicode name in the match list, because the template handles more than one style of arrow. The closest we can manage is "rightwards-arrow". --> <template name="right-arrow" match="right-arrow|rightarrow|implies|rarr|rarrow|rightwards-arrow"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\</xsl:text> <xsl:choose> <xsl:when test="@weight='double'"><xsl:text>R</xsl:text></xsl:when> <xsl:otherwise><xsl:text>r</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text>ightarrow}</xsl:text> </common> <html> <xsl:choose> <xsl:when test="@weight='double'"> <xsl:text disable-output-escaping="yes"> &rArr; </xsl:text> </xsl:when> <xsl:otherwise> <xsl:text disable-output-escaping="yes"> &rarr; </xsl:text> </xsl:otherwise> </xsl:choose> </html> <xhtml> <xsl:choose> <xsl:when test="@weight='double'"> <!-- U+21D2 RIGHTWARDS DOUBLE ARROW --> <span class="unicode"> <xsl:text> ⇒ </xsl:text> </span> </xsl:when> <xsl:otherwise> <!-- U+2192 RIGHTWARDS ARROW --> <xsl:text> → </xsl:text> </xsl:otherwise> </xsl:choose> </xhtml> </template> <!-- Leftwards arrow, both single and double (←, ⇐). We can't include the Unicode name in the match list, because the template handles more than one style of arrow. The closest we can manage is "leftwards-arrow". --> <template name="left-arrow" match="left-arrow|leftarrow|larr|larrow|leftwards-arrow"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\</xsl:text> <xsl:choose> <xsl:when test="@weight='double'"><xsl:text>L</xsl:text></xsl:when> <xsl:otherwise><xsl:text>l</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text>eftarrow}</xsl:text> </common> <html> <xsl:choose> <xsl:when test="@weight='double'"> <xsl:text disable-output-escaping="yes"> &lArr; </xsl:text> </xsl:when> <xsl:otherwise> <xsl:text disable-output-escaping="yes"> &larr; </xsl:text> </xsl:otherwise> </xsl:choose> </html> <xhtml> <xsl:choose> <xsl:when test="@weight='double'"> <!-- U+21D0 LEFTWARDS DOUBLE ARROW --> <xsl:text> ⇐ </xsl:text> </xsl:when> <xsl:otherwise> <!-- U+2190 LEFTWARDS ARROW --> <xsl:text> ← </xsl:text> </xsl:otherwise> </xsl:choose> </xhtml> </template> </stylesheet>
<?xml version="1.0" encoding="utf-8"?> <!-- Various mathematical operators and symbols. We get around the problem of math vs. non-math mode operators in LaTeX by liberally sprinkling \ensuremath around. If we're not in math mode, it enables it, and if we're already in math mode, it ignores it. This means we don't need identical templates for math and non-math modes. Yay! Note that some operators (binary in particular) need spaces around them in the HTML templates, as they seem to get munched otherwise. The "strip" mode forms of the templates are for use in the context of an HTML <title> element (so the mode is only relevant to the HTML formats). Embedding HTML markup inside the <title> element causes the markup to appear verbatim in the window title, i.e., <title><em>foo</em> bar</title> will appear in the window title as "<em>foo</em> bar", not "foo bar". Putting the stylesheet into strip mode means that it will only output text nodes unless otherwise specified for a particular element. Generally the "strip" templates will simply call-template to the original, unless the original contains markup that needs to be eliminated (e.g., see space below). The downside of this approach, of course, is that you need "strip" mode templates for quite a lot of things, but that can't really be helped. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- BASIC OPERATORS AND SYMBOLS. --> <!-- Addition binary operation symbol (+). --> <template name="plus-operator" match="plus|plus-sign"> <!-- U+002B PLUS SIGN --> <common>+</common> </template> <!-- Multiplication binary operation symbol (×). --> <template name="times-operator" match="times|multiply|multiplication|multiplication-sign"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\times}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&times;</xsl:text></html> <!-- U+00D7 MULTIPLICATION SIGN --> <xhtml><span class="unicode"><xsl:text>×</xsl:text></span></xhtml> </template> <!-- Subtraction binary operation symbol (−). --> <template name="minus-operator" match="minus|subtract|minus-sign"> <common formats="/latex/xelatex/">\ensuremath{-}</common> <html><xsl:text disable-output-escaping="yes">&minus;</xsl:text></html> <!-- U+2212 MINUS SIGN --> <xhtml><span class="unicode"><xsl:text>−</xsl:text></span></xhtml> </template> <!-- Division binary operation symbol (∕). --> <template name="divide-operator" match="divide|division|division-slash"> <common formats="/latex/xelatex/">\ensuremath{/}</common> <html><xsl:text>/</xsl:text></html> <!-- U+2215 DIVISION SLASH --> <xhtml><span class="unicode"><xsl:text>∕</xsl:text></span></xhtml> </template> <!-- Equality relation symbol (=). --> <template name="equals-operator" match="equals|eq|equals-sign|equality"> <common formats="/latex/xelatex/">\ensuremath{=}</common> <!-- U+003D EQUALS SIGN --> <common formats="/html/xhtml/"><xsl:text> = </xsl:text></common> </template> <!-- Inequality relation symbol (≠). --> <template name="not-equals-operator" match="not-equals|ne|inequality|not-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\neq}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &ne; </xsl:text></html> <!-- U+2260 NOT EQUAL TO --> <xhtml><xsl:text> ≠ </xsl:text></xhtml> </template> <!-- Approximation relation symbol (≈). --> <template name="approximately-equals-operator" match="approximately-equals|approximately-equal-to|approx|almost-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\approx}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&asymp;</xsl:text></html> <!-- U+2248 ALMOST EQUAL TO --> <xhtml><xsl:text>≈</xsl:text></xhtml> </template> <!-- Greater than relation symbol (>). --> <template name="greater-than-operator" match="greater-than|gt|greater-than-sign"> <common formats="/latex/xelatex/">\ensuremath{>}</common> <!-- U+003E GREATER-THAN SIGN --> <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes"> &gt; </xsl:text></common> </template> <!-- Greater than or equal to relation symbol (≥). --> <template name="greater-equals-operator" match="greater-equals|ge|greater-than-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\geq}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &ge; </xsl:text></html> <!-- U+2265 GREATER-THAN OR EQUAL TO --> <xhtml><xsl:text> ≥ </xsl:text></xhtml> </template> <!-- Less than relation symbol (<). --> <template name="less-than-operator" match="less-than|lt|less-than-sign"> <common formats="/latex/xelatex/"> \ensuremath{<} </common> <!-- U+003C LESS-THAN SIGN --> <common formats="/html/xhtml/"><xsl:text disable-output-escaping="yes"> &lt; </xsl:text></common> </template> <!-- Less than or equal to relation symbol (≤). --> <template name="less-equals-operator" match="less-equals|le|less-than-or-equal-to"> <common formats="/latex/xelatex/"> \ensuremath{\leq} </common> <html><xsl:text disable-output-escaping="yes"> &le; </xsl:text></html> <!-- U+2264 LESS-THAN OR EQUAL TO --> <xhtml><xsl:text> ≤ </xsl:text></xhtml> </template> <!-- SYMBOLS RELATING TO SETS. --> <!-- Empty set symbol (∅). --> <template name="empty-set-sign" match="empty-set-sign|empty-set|null"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\emptyset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&empty;</xsl:text></html> <!-- U+2205 EMPTY SET --> <xhtml><span class="unicode"><xsl:text>∅</xsl:text></span></xhtml> </template> <template name="empty-set-sign-strip" match="empty-set-sign|empty-set|null" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="empty-set-sign" /> </common> </template> <!-- Element-of relation symbol (∈). --> <template name="element-sign" match="element-sign|element|element-of|is-element-of|is-an-element-of"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\in}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&isin;</xsl:text></html> <!-- U+2208 ELEMENT OF --> <xhtml><span class="unicode"><xsl:text>∈</xsl:text></span></xhtml> </template> <template name="element-sign-strip" match="element-sign|element|element-of|is-element-of|is-an-element-of" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="element-sign" /> </common> </template> <!-- Not-element-of relation symbol (∉). --> <template name="not-element-sign" match="not-element-sign|not-element|not-element-of|is-not-element-of|is-not-an-element-of|not-an-element-of"> <common formats="/latex/xelatex/">\ensuremath{\not\in}</common> <html><xsl:text disable-output-escaping="yes">&notin;</xsl:text></html> <!-- U+2209 NOT AN ELEMENT OF --> <xhtml><span class="unicode"><xsl:text>∉</xsl:text></span></xhtml> </template> <template name="not-element-sign-strip" match="not-element-sign|not-element|not-element-of|is-not-element-of|is-not-an-element-of|not-an-element-of" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="not-element-sign" /> </common> </template> <!-- Intersection binary operation symbol (∩). --> <template name="intersect-operator" match="intersect-operator|intersect|intersection|cap"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\cap}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &cap; </xsl:text></html> <!-- U+2229 INTERSECTION --> <xhtml><span class="unicode"><xsl:text> ∩ </xsl:text></span></xhtml> </template> <template name="intersect-operator-strip" match="intersect-operator|intersect|intersection|cap" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="intersect-operator" /> </common> </template> <!-- Union binary operation symbol (∪). --> <template name="union-operator" match="union-operator|union|cup"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\cup}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &cup; </xsl:text></html> <!-- U+222A UNION --> <xhtml><span class="unicode"><xsl:text> ∪ </xsl:text></span></xhtml> </template> <template name="union-operator-strip" match="union-operator|union|cup" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="union-operator" /> </common> </template> <!-- Strict subset relation symbol (⊂). --> <template name="strict-subset-sign" match="subset-sign|subset|subset-of|is-subset-of|is-a-subset-of|strict-subset"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\subset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&sub;</xsl:text></html> <!-- U+2282 SUBSET OF --> <xhtml><span class="unicode"><xsl:text>⊂</xsl:text></span></xhtml> </template> <template name="strict-subset-sign-strip" match="subset-sign|subset|subset-of|is-subset-of|is-a-subset-of|strict-subset" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="strict-subset-sign" /> </common> </template> <!-- Strict superset relation symbol (⊃). --> <template name="strict-superset-sign" match="superset-sign|superset|superset-of|is-superset-of|is-a-superset-of"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\supset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&sup;</xsl:text></html> <!-- U+2283 SUPERSET OF --> <xhtml><span class="unicode"><xsl:text>⊃</xsl:text></span></xhtml> </template> <template name="strict-superset-sign-strip" match="superset-sign|superset|superset-of|is-superset-of|is-a-superset-of" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="strict-superset-sign" /> </common> </template> <!-- Inclusive subset relation symbol (⊆). --> <template name="inclusive-subset-sign" match="inclusive-subset|subset-or-equal|subset-of-or-equal-to|is-subset-of-or-equal-to|is-a-subset-of-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\subseteq}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&sube;</xsl:text></html> <!-- U+2286 SUBSET OF OR EQUAL TO --> <xhtml><span class="unicode"><xsl:text>⊆</xsl:text></span></xhtml> </template> <template name="inclusive-subset-sign-strip" match="inclusive-subset|subset-or-equal|subset-of-or-equal-to|is-subset-of-or-equal-to|is-a-subset-of-or-equal-to" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="inclusive-subset-sign" /> </common> </template> <!-- Inclusive superset relation symbol (⊇). --> <template name="inclusive-superset-sign" match="inclusive-superset|superset-or-equal|superset-of-or-equal-to|is-superset-of-or-equal-to|is-a-superset-of-or-equal-to"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\supset}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&supe;</xsl:text></html> <!-- U+2287 SUPERSET OF OR EQUAL TO --> <xhtml><span class="unicode"><xsl:text>⊇</xsl:text></span></xhtml> </template> <template name="inclusive-superset-sign-strip" match="inclusive-superset|superset-or-equal|superset-of-or-equal-to|is-superset-of-or-equal-to|is-a-superset-of-or-equal-to" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="inclusive-superset-sign" /> </common> </template> <!-- SYMBOLS RELATING TO LOGIC. --> <!-- Logical NOT binary operation symbol (¬). --> <template name="logical-not-operator" match="logical-not-operator|logical-negation-operator|logical-negation|logical-not|not|negation|neg|not-sign"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\neg}</xsl:text></common> <html><xsl:text disable-output-escaping="yes">&not;</xsl:text></html> <!-- U+00AC NOT SIGN --> <xhtml><span class="unicode"><xsl:text>¬</xsl:text></span></xhtml> </template> <template name="logical-not-operator-strip" match="logical-not-operator|logical-negation-operator|logical-negation|logical-not|not|negation|neg|not-sign" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="logical-not-operator" /> </common> </template> <!-- Logical AND binary operation symbol (∧). --> <template name="logical-and-operator" match="logical-and-operator|logical-and|and|and-operator|hat|wedge"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\wedge}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &and; </xsl:text></html> <!-- U+2227 LOGICAL AND --> <xhtml><span class="unicode"><xsl:text> ∧ </xsl:text></span></xhtml> </template> <template name="logical-and-operator-strip" match="logical-and-operator|logical-and|and|and-operator|hat|wedge" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="logical-and-operator" /> </common> </template> <!-- Logical OR binary operation symbol (∨). --> <template name="logical-or-operator" match="logical-or-operator|logical-or|or|or-operator|vee"> <common formats="/latex/xelatex/"><xsl:text>\ensuremath{\vee}</xsl:text></common> <html><xsl:text disable-output-escaping="yes"> &or; </xsl:text></html> <!-- U+2228 LOGICAL OR --> <xhtml><span class="unicode"><xsl:text> ∨ </xsl:text></span></xhtml> </template> <template name="logical-or-operator-strip" match="logical-or-operator|logical-or|or|or-operator|vee" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="logical-or-operator" /> </common> </template> <!-- ARROWS. --> <!-- Rightwards arrow, both single and double (→, ⇒). We can't include the Unicode name in the match list, because the template handles more than one style of arrow. The closest we can manage is "rightwards-arrow". --> <template name="right-arrow" match="right-arrow|rightarrow|implies|rarr|rarrow|rightwards-arrow"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\</xsl:text> <xsl:choose> <xsl:when test="@weight='double'">R</xsl:when> <xsl:otherwise>r</xsl:otherwise> </xsl:choose> <xsl:text>ightarrow}</xsl:text> </common> <html> <xsl:choose> <xsl:when test="@weight='double'"> <xsl:text disable-output-escaping="yes"> &rArr; </xsl:text> </xsl:when> <xsl:otherwise> <xsl:text disable-output-escaping="yes"> &rarr; </xsl:text> </xsl:otherwise> </xsl:choose> </html> <xhtml> <xsl:choose> <xsl:when test="@weight='double'"> <!-- U+21D2 RIGHTWARDS DOUBLE ARROW --> <span class="unicode"> <xsl:text> ⇒ </xsl:text> </span> </xsl:when> <xsl:otherwise> <!-- U+2192 RIGHTWARDS ARROW --> <xsl:text> → </xsl:text> </xsl:otherwise> </xsl:choose> </xhtml> </template> <!-- Leftwards arrow, both single and double (←, ⇐). We can't include the Unicode name in the match list, because the template handles more than one style of arrow. The closest we can manage is "leftwards-arrow". --> <template name="left-arrow" match="left-arrow|leftarrow|larr|larrow|leftwards-arrow"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\</xsl:text> <xsl:choose> <xsl:when test="@weight='double'">L</xsl:when> <xsl:otherwise>l</xsl:otherwise> </xsl:choose> <xsl:text>eftarrow}</xsl:text> </common> <html> <xsl:choose> <xsl:when test="@weight='double'"> <xsl:text disable-output-escaping="yes"> &lArr; </xsl:text> </xsl:when> <xsl:otherwise> <xsl:text disable-output-escaping="yes"> &larr; </xsl:text> </xsl:otherwise> </xsl:choose> </html> <xhtml> <xsl:choose> <xsl:when test="@weight='double'"> <!-- U+21D0 LEFTWARDS DOUBLE ARROW --> <xsl:text> ⇐ </xsl:text> </xsl:when> <xsl:otherwise> <!-- U+2190 LEFTWARDS ARROW --> <xsl:text> ← </xsl:text> </xsl:otherwise> </xsl:choose> </xhtml> </template> </stylesheet>
Ignore Space
Show notes
View
modules/quotations.xml
<?xml version="1.0" encoding="utf-8"?> <!-- Quoted text of all sorts. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Inline quoted text. Handles nested quotes correctly. @single: Whether to enclose the text in single or double quotes. 'yes' => single quotes (''). otherwise => double quotes (""). [default] --> <template name="single-quote" match="quote[@single='yes']|q[@single='yes']"> <common formats="/latex/xelatex/"> <xsl:text>`</xsl:text> <xsl:apply-templates /> <xsl:text>'</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&lsquo;</xsl:text> <xsl:apply-templates /> <xsl:text disable-output-escaping="yes">&rsquo;</xsl:text> </html> <xhtml> <!-- U+2018 LEFT SINGLE QUOTATION MARK --> <xsl:text>‘</xsl:text> <xsl:apply-templates /> <!-- U+2019 RIGHT SINGLE QUOTATION MARK --> <xsl:text>’</xsl:text> </xhtml> </template> <template name="double-quote" match="quote|qq"> <common formats="/latex/xelatex/"> <xsl:text>``</xsl:text> <xsl:apply-templates /> <xsl:text>''</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&ldquo;</xsl:text> <xsl:apply-templates /> <xsl:text disable-output-escaping="yes">&rdquo;</xsl:text> </html> <xhtml> <!-- U+201C LEFT DOUBLE QUOTATION MARK --> <xsl:text>“</xsl:text> <xsl:apply-templates /> <!-- U+201D RIGHT DOUBLE QUOTATION MARK --> <xsl:text>”</xsl:text> </xhtml> </template> <!-- With nested quotes, we need to figure out what depth of nesting we're at, then call the appropriate template depending on the initial quoting style (single or double). --> <template name="nested-double-quote" match="quote//quote"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote" /> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote" /> </xsl:otherwise> </xsl:choose> </common> </template> <template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote" /> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote" /> </xsl:otherwise> </xsl:choose> </common> </template> <!-- A block quotation. If you want quote marks, insert them using <quote> above. @align: The alignment of the quotation paragraph. 'left' [default] 'center' | 'centre' 'right' --> <template name="quotation" match="quotation"> <common formats="/latex/xelatex/"> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>\begin{flush</xsl:text> <xsl:value-of select="@align" /> <xsl:text>}\itshape </xsl:text> <xsl:apply-templates /> <xsl:text>\end{flush</xsl:text> <xsl:value-of select="@align" /> <xsl:text>}</xsl:text> </xsl:when> <xsl:when test="(@align = 'center') or (@align = 'centre')"> <xsl:text>\begin{center}\itshape </xsl:text> <xsl:apply-templates /> <xsl:text>\end{center}</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>\begin{quote}\itshape </xsl:text> <xsl:apply-templates /> <xsl:text>\end{quote}</xsl:text> </xsl:otherwise> </xsl:choose> </common> <!-- Nominally we should use <blockquote>, but it doesn't have alignment. --> <common formats="/html/xhtml/"> <p> <xsl:if test="@align"> <xsl:attribute name="align"> <xsl:value-of select="@align" /> </xsl:attribute> </xsl:if> <i><xsl:apply-templates /></i> </p> </common> </template> </stylesheet>
<?xml version="1.0" encoding="utf-8"?> <!-- Quoted text of all sorts. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Inline quoted text. Handles nested quotes correctly. @single: Whether to enclose the text in single or double quotes. 'yes' => single quotes (''). otherwise => double quotes (""). [default] --> <template name="single-quote" match="quote[@single='yes']|q[@single='yes']"> <common formats="/latex/xelatex/">`<xsl:apply-templates />'</common> <html> <xsl:text disable-output-escaping="yes">&lsquo;</xsl:text> <xsl:apply-templates /> <xsl:text disable-output-escaping="yes">&rsquo;</xsl:text> </html> <xhtml> <!-- U+2018 LEFT SINGLE QUOTATION MARK --> <xsl:text>‘</xsl:text> <xsl:apply-templates /> <!-- U+2019 RIGHT SINGLE QUOTATION MARK --> <xsl:text>’</xsl:text> </xhtml> </template> <template name="double-quote" match="quote|qq"> <common formats="/latex/xelatex/">``<xsl:apply-templates />''</common> <html> <xsl:text disable-output-escaping="yes">&ldquo;</xsl:text> <xsl:apply-templates /> <xsl:text disable-output-escaping="yes">&rdquo;</xsl:text> </html> <xhtml> <!-- U+201C LEFT DOUBLE QUOTATION MARK --> <xsl:text>“</xsl:text> <xsl:apply-templates /> <!-- U+201D RIGHT DOUBLE QUOTATION MARK --> <xsl:text>”</xsl:text> </xhtml> </template> <!-- With nested quotes, we need to figure out what depth of nesting we're at, then call the appropriate template depending on the initial quoting style (single or double). --> <template name="nested-double-quote" match="quote//quote"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="double-quote" /> </xsl:when> <xsl:otherwise> <xsl:call-template name="single-quote" /> </xsl:otherwise> </xsl:choose> </common> </template> <template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2"> <common> <xsl:choose> <xsl:when test="(count(ancestor::quote) mod 2) = 0"> <xsl:call-template name="single-quote" /> </xsl:when> <xsl:otherwise> <xsl:call-template name="double-quote" /> </xsl:otherwise> </xsl:choose> </common> </template> <!-- A block quotation. If you want quote marks, insert them using <quote> above. @align: The alignment of the quotation paragraph. 'left' [default] 'center' | 'centre' 'right' --> <template name="quotation" match="quotation"> <common formats="/latex/xelatex/"> <xsl:choose> <xsl:when test="(@align = 'left') or (@align = 'right')"> <xsl:text>\begin{flush</xsl:text> <xsl:value-of select="@align" /> <xsl:text>}\itshape </xsl:text> <xsl:apply-templates /> <xsl:text>\end{flush</xsl:text> <xsl:value-of select="@align" /> <xsl:text>}</xsl:text> </xsl:when> <xsl:when test="(@align = 'center') or (@align = 'centre')"> <xsl:text>\begin{center}\itshape </xsl:text> <xsl:apply-templates /> <xsl:text>\end{center}</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>\begin{quote}\itshape </xsl:text> <xsl:apply-templates /> <xsl:text>\end{quote}</xsl:text> </xsl:otherwise> </xsl:choose> </common> <!-- Nominally we should use <blockquote>, but it doesn't have alignment. --> <common formats="/html/xhtml/"> <p> <xsl:if test="@align"> <xsl:attribute name="align"> <xsl:value-of select="@align" /> </xsl:attribute> </xsl:if> <i><xsl:apply-templates /></i> </p> </common> </template> </stylesheet>
Show line notes below