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
- Updated some documentation.
master
1 parent
56d5f24
commit
366756fdf998b639ce00ed2b763060163876accb
nstanger
authored
on 23 Feb 2012
Patch
Showing
1 changed file
modules/relational-algebra.xml
Ignore Space
Show notes
View
modules/relational-algebra.xml
<?xml version="1.0" encoding="utf-8"?> <!-- Relational algebra operators. These are distinct from the basic Greek characters, because they can have associated subscripts (i.e., they have arguments). These also use relalg.sty in (Xe)LaTeX for general consistency. Note that relational operators that are identical to their normal usage (e.g., intersect, union, minus) are defined in mathematical-symbols.xsl. Duplicating them here (with different names) seems unnecessary. Perhaps a namespace? Relational symbols in LaTeX require the relalg package. 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"> <!-- Project operator (π). --> <template name="project-operator" match="project|project-operator|relational-project"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelProject</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&pi;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C0 GREEK SMALL LETTER PI --> <span class="unicode"><xsl:text>π</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="project-operator-strip" match="project|project-operator|relational-project" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&pi;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C0 GREEK SMALL LETTER PI --> <span class="unicode"><xsl:text>π</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Extend operator (ε). --> <template name="extend-operator" match="extend|extend-operator|relational-extend"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelExtend</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&epsilon;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03B5 GREEK SMALL LETTER EPSILON --> <span class="unicode"><xsl:text>ε</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="extend-operator-strip" match="extend|extend-operator|relational-extend" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&epsilon;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03B5 GREEK SMALL LETTER EPSILON --> <span class="unicode"><xsl:text>ε</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Rename operator (ρ). --> <template name="rename-operator" match="rename|rename-operator|relational-rename"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelRename</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&rho;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C1 GREEK SMALL LETTER RHO --> <span class="unicode"><xsl:text>ρ</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="rename-operator-strip" match="rename|rename-operator|relational-rename" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&rho;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C1 GREEK SMALL LETTER RHO --> <span class="unicode"><xsl:text>ρ</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Restrict operator (σ). --> <template name="restrict-operator" match="restrict|restrict-operator|relational-restrict"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelRestrict</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&sigma;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C2 GREEK SMALL LETTER SIGMA --> <span class="unicode"><xsl:text>σ</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="restrict-operator-strip" match="restrict|restrict-operator|relational-restrict" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&sigma;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C2 GREEK SMALL LETTER SIGMA --> <span class="unicode"><xsl:text>σ</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Join operator (⋈). --> <template name="join-operator" match="join-operator|join|natural-join|inner-join|bowtie|relational-join"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelNaturalJoin</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <!-- No easy way at present to get the join symbol in HTML, so just use an image. Scale it to 10x10 pixels (fine as long as font size is set relatively normally). We need to ensure that the path is absolute, because we don't necessarily know where the document will end up in the tree. Need spaces for HTML as they seem to get munched otherwise. --> <html> <xsl:text> </xsl:text> <img> <xsl:attribute name="src"> <xsl:text>/</xsl:text> <xsl:value-of select="$subject-code" /> <xsl:value-of select="$paper-number" /> <xsl:text>/Handbook/join-operator-web.png</xsl:text> </xsl:attribute> <xsl:attribute name="alt"> <xsl:text>join operator</xsl:text> </xsl:attribute> <xsl:attribute name="width"> <xsl:text>10</xsl:text> </xsl:attribute> <xsl:attribute name="height"> <xsl:text>10</xsl:text> </xsl:attribute> <xsl:attribute name="style"> <xsl:text>padding-left:0.3em;padding-right:0.3em</xsl:text> </xsl:attribute> </img> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </html> <!-- Note that we use the Unicode BOWTIE character (U+22C8) rather than JOIN (U+2A1D) because the latter appears to have less font support than the former, and they aren't different enough to have any significant impact. --> <xhtml> <xsl:text> </xsl:text> <!-- U+22C8 BOWTIE --> <span class="unicode"><xsl:text>⋈</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </xhtml> </template> <template name="join-operator-strip" match="join-operator|join|natural-join|inner-join|bowtie|relational-join" mode="strip"> <html> <xsl:text>|X|</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <xsl:text> </xsl:text> <!-- U+22C8 BOWTIE --> <span class="unicode"><xsl:text>⋈</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text> </xsl:text> </xhtml> </template> <!-- Generate a left, right or full outer join operator (⟕, ⟖, ⟗). @type: the type of outer join operator [optional] 'left' 'right' 'full' [default] --> <template name="outer-join-operator" match="outer-join-operator|outer-join|relational-outer-join"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\Rel</xsl:text> <xsl:choose> <xsl:when test="@type"> <xsl:value-of select="@type" /> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>Full</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>OuterJoin</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <!-- No easy way at present to get the join symbol in HTML, so just use an image. Scale it to 10x10 pixels (fine as long as font size is set relatively normally). We need to ensure that the path is absolute, because we don't necessarily know where the document will end up in the tree. Need spaces for HTML as they seem to get munched otherwise. --> <common formats="/html/xhtml/"> <xsl:text> </xsl:text> <img> <xsl:attribute name="src"> <xsl:text>/</xsl:text> <xsl:value-of select="$subject-code" /> <xsl:value-of select="$paper-number" /> <xsl:text>/Handbook/</xsl:text> <xsl:choose> <xsl:when test="@type"> <xsl:value-of select="@type" /> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>full</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>-outer-join-operator-web.png</xsl:text> </xsl:attribute> <xsl:attribute name="alt"> <xsl:choose> <xsl:when test="@type"> <xsl:value-of select="@type" /> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>full</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text> outer join operator</xsl:text> </xsl:attribute> <xsl:attribute name="width"> <xsl:choose> <xsl:when test="(@type = 'left') or (@type = 'right')"> <xsl:text>15</xsl:text> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>20</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="height"> <xsl:text>10</xsl:text> </xsl:attribute> <xsl:attribute name="style"> <xsl:text>padding-left:0.3em;padding-right:0.3em</xsl:text> </xsl:attribute> </img> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </common> <!-- Note that these characters are available in Unicode (U+27D5 LEFT OUTER JOIN, U+27D6 RIGHT OUTER JOIN and U+27D7 FULL OUTER JOIN), but I don't think font support is very widespread yet (Dec 2010). --> <!-- <xhtml> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="@type = 'left'"> <span class="unicode"><xsl:text>⟕</xsl:text></span> </xsl:when> <xsl:when test="@type = 'right'"> <span class="unicode"><xsl:text>⟖</xsl:text></span> </xsl:when> <xsl:otherwise> <span class="unicode"><xsl:text>⟗</xsl:text></span> </xsl:otherwise> </xsl:choose> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </xhtml> --> </template> <template name="outer-join-operator-strip" match="outer-join-operator|outer-join|relational-outer-join" mode="strip"> <common formats="/html/xhtml/"> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="@type = 'left'"> <xsl:text>]X|</xsl:text> </xsl:when> <xsl:when test="@type = 'right'"> <xsl:text>|X[</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>]X[</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text> </xsl:text> </common> </template> </stylesheet>
<?xml version="1.0" encoding="utf-8"?> <!-- Relational algebra operators. These are distinct from the basic Greek characters, because they can have associated subscripts (i.e., they have arguments). These also use relalg.sty in (Xe)LaTeX for general consistency. Note that relational operators that are identical to their normal usage (e.g., intersect, union, minus) are defined in mathematical-symbols.xsl. Duplicating them here (with different names) seems unnecessary. Perhaps a namespace? 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"> <!-- Project operator (π). --> <template name="project-operator" match="project|project-operator|relational-project"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelProject</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&pi;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C0 GREEK SMALL LETTER PI --> <span class="unicode"><xsl:text>π</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="project-operator-strip" match="project|project-operator|relational-project" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&pi;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C0 GREEK SMALL LETTER PI --> <span class="unicode"><xsl:text>π</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Extend operator (ε). --> <template name="extend-operator" match="extend|extend-operator|relational-extend"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelExtend</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&epsilon;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03B5 GREEK SMALL LETTER EPSILON --> <span class="unicode"><xsl:text>ε</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="extend-operator-strip" match="extend|extend-operator|relational-extend" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&epsilon;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03B5 GREEK SMALL LETTER EPSILON --> <span class="unicode"><xsl:text>ε</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Rename operator (ρ). --> <template name="rename-operator" match="rename|rename-operator|relational-rename"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelRename</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&rho;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C1 GREEK SMALL LETTER RHO --> <span class="unicode"><xsl:text>ρ</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="rename-operator-strip" match="rename|rename-operator|relational-rename" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&rho;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C1 GREEK SMALL LETTER RHO --> <span class="unicode"><xsl:text>ρ</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Restrict operator (σ). --> <template name="restrict-operator" match="restrict|restrict-operator|relational-restrict"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelRestrict</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes">&sigma;</xsl:text> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C2 GREEK SMALL LETTER SIGMA --> <span class="unicode"><xsl:text>σ</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <template name="restrict-operator-strip" match="restrict|restrict-operator|relational-restrict" mode="strip"> <html> <xsl:text disable-output-escaping="yes">&sigma;</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <!-- U+03C2 GREEK SMALL LETTER SIGMA --> <span class="unicode"><xsl:text>σ</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </xhtml> </template> <!-- Join operator (⋈). --> <template name="join-operator" match="join-operator|join|natural-join|inner-join|bowtie|relational-join"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\RelNaturalJoin</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <!-- No easy way at present to get the join symbol in HTML, so just use an image. Scale it to 10x10 pixels (fine as long as font size is set relatively normally). We need to ensure that the path is absolute, because we don't necessarily know where the document will end up in the tree. Need spaces for HTML as they seem to get munched otherwise. --> <html> <xsl:text> </xsl:text> <img> <xsl:attribute name="src"> <xsl:text>/</xsl:text> <xsl:value-of select="$subject-code" /> <xsl:value-of select="$paper-number" /> <xsl:text>/Handbook/join-operator-web.png</xsl:text> </xsl:attribute> <xsl:attribute name="alt"> <xsl:text>join operator</xsl:text> </xsl:attribute> <xsl:attribute name="width"> <xsl:text>10</xsl:text> </xsl:attribute> <xsl:attribute name="height"> <xsl:text>10</xsl:text> </xsl:attribute> <xsl:attribute name="style"> <xsl:text>padding-left:0.3em;padding-right:0.3em</xsl:text> </xsl:attribute> </img> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </html> <!-- Note that we use the Unicode BOWTIE character (U+22C8) rather than JOIN (U+2A1D) because the latter appears to have less font support than the former, and isn't different enough to have any significant effect. --> <xhtml> <xsl:text> </xsl:text> <!-- U+22C8 BOWTIE --> <span class="unicode"><xsl:text>⋈</xsl:text></span> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </xhtml> </template> <template name="join-operator-strip" match="join-operator|join|natural-join|inner-join|bowtie|relational-join" mode="strip"> <html> <xsl:text>|X|</xsl:text> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text disable-output-escaping="yes">&thinsp;</xsl:text> </html> <xhtml> <xsl:text> </xsl:text> <!-- U+22C8 BOWTIE --> <span class="unicode"><xsl:text>⋈</xsl:text></span> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text> </xsl:text> </xhtml> </template> <!-- Generate a left, right or full outer join operator (⟕, ⟖, ⟗). @type: the type of outer join operator [optional] 'left' 'right' 'full' [default] --> <template name="outer-join-operator" match="outer-join-operator|outer-join|relational-outer-join"> <common formats="/latex/xelatex/"> <xsl:text>\ensuremath{\Rel</xsl:text> <xsl:choose> <xsl:when test="@type"> <xsl:value-of select="@type" /> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>Full</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>OuterJoin</xsl:text> <xsl:if test="* | text()"> <xsl:text>_{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> </xsl:if> <xsl:text>}</xsl:text> </common> <!-- No easy way at present to get the join symbol in HTML, so just use an image. Scale it to 10x10 pixels (fine as long as font size is set relatively normally). We need to ensure that the path is absolute, because we don't necessarily know where the document will end up in the tree. Need spaces for HTML as they seem to get munched otherwise. --> <common formats="/html/xhtml/"> <xsl:text> </xsl:text> <img> <xsl:attribute name="src"> <xsl:text>/</xsl:text> <xsl:value-of select="$subject-code" /> <xsl:value-of select="$paper-number" /> <xsl:text>/Handbook/</xsl:text> <xsl:choose> <xsl:when test="@type"> <xsl:value-of select="@type" /> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>full</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text>-outer-join-operator-web.png</xsl:text> </xsl:attribute> <xsl:attribute name="alt"> <xsl:choose> <xsl:when test="@type"> <xsl:value-of select="@type" /> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>full</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:text> outer join operator</xsl:text> </xsl:attribute> <xsl:attribute name="width"> <xsl:choose> <xsl:when test="(@type = 'left') or (@type = 'right')"> <xsl:text>15</xsl:text> </xsl:when> <!-- default to a full outer join --> <xsl:otherwise> <xsl:text>20</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="height"> <xsl:text>10</xsl:text> </xsl:attribute> <xsl:attribute name="style"> <xsl:text>padding-left:0.3em;padding-right:0.3em</xsl:text> </xsl:attribute> </img> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </common> <!-- Note that these characters are available in Unicode (U+27D5 LEFT OUTER JOIN, U+27D6 RIGHT OUTER JOIN and U+27D7 FULL OUTER JOIN), but I don't think font support is very widespread yet (Dec 2010). --> <!-- <xhtml> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="@type = 'left'"> <span class="unicode"><xsl:text>⟕</xsl:text></span> </xsl:when> <xsl:when test="@type = 'right'"> <span class="unicode"><xsl:text>⟖</xsl:text></span> </xsl:when> <xsl:otherwise> <span class="unicode"><xsl:text>⟗</xsl:text></span> </xsl:otherwise> </xsl:choose> <xsl:if test="* | text()"> <sub><xsl:apply-templates /></sub> </xsl:if> <xsl:text> </xsl:text> </xhtml> --> </template> <template name="outer-join-operator-strip" match="outer-join-operator|outer-join|relational-outer-join" mode="strip"> <common formats="/html/xhtml/"> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="@type = 'left'"> <xsl:text>]X|</xsl:text> </xsl:when> <xsl:when test="@type = 'right'"> <xsl:text>|X[</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>]X[</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:if test="* | text()"> <xsl:text>[</xsl:text> <xsl:apply-templates /> <xsl:text>]</xsl:text> </xsl:if> <xsl:text> </xsl:text> </common> </template> </stylesheet>
Show line notes below