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
• Fixed missing apply-templates in top-level menu template for (X)HTML.
master
1 parent
c2f4a5b
commit
7e37714abcaed671ca04fe027791a62c6c6df397
Nigel Stanger
authored
on 26 Mar 2018
Patch
Showing
1 changed file
modules/path-like-elements.xml
Ignore Space
Show notes
View
modules/path-like-elements.xml
<?xml version="1.0" encoding="utf-8"?> <!-- In-text "paths", for displaying things like menu paths, file system paths, or keyboard sequences. These all have the same basic form, i.e., a list of items separated by some delimiter. NOTE: The (Xe)LaTeX version requires the menukeys 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"> <!-- Only (Xe)LaTeX requires additional processing. (X)HTML will be handled just find by the default template. --> <template name="path" match="menu|directory|keys"> <common formats="/latex/xelatex/"> <!-- Make the menu text just a *little* smaller (menukeys loads the relsize package). --> <xsl:if test="contains('/menu/keys/', local-name(.))"> <xsl:text>{\relsize{-0.5}</xsl:text> </xsl:if> <xsl:text>\</xsl:text> <xsl:value-of select="local-name(.)" /> <xsl:text>{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> <xsl:if test="contains('/menu/keys/', local-name(.))"> <xsl:text>}</xsl:text> </xsl:if> </common> <common formats="/html/xhtml/"> <xsl:apply-templates /> </common> </template> <!-- Menu item separator (either ▹ or →). LEGACY/DEPRECATED --> <template name="menu-separator" match="menu-separator|menusep|menu/separator"> <common formats="/latex/xelatex/"><xsl:text> \ensuremath{\triangleright} </xsl:text></common> <!-- Need spaces for HTML as they seem to get munched otherwise. --> <!-- Note: no equivalent of \triangleright in HTML, use right arrow instead. --> <html><xsl:text disable-output-escaping="yes"> &rarr; </xsl:text></html> <!-- U+25B9 WHITE RIGHT-POINTING SMALL TRIANGLE --> <xhtml><span class="unicode"><xsl:text> ▹ </xsl:text></span></xhtml> </template> <template name="menu-separator-strip" match="menu-separator|menusep|menu/separator" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="menu-separator" /> </common> </template> <!-- Individual path items. --> <template name="path-item" match="menu/item|directory/item|keys/item"> <common> <xsl:variable name="mode" select="local-name(..)" /> </common> <common formats="/latex/xelatex/"> <xsl:apply-templates /> <xsl:if test="position() ne last()"> <xsl:value-of select="infosci:path-separator(local-name(..))" /> </xsl:if> </common> <common formats="/html/xhtml/"> <strong> <xsl:apply-templates /> <xsl:if test="position() ne last()"> <xsl:value-of select="infosci:path-separator(local-name(..))" /> </xsl:if> </strong> </common> </template> <!-- Various keyboard keys (as per menukeys package). --> <template name="shift-key" match="shift-key"> <common formats="/latex/xelatex/"> <xsl:text>\shift</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Shift</strong> </common> </template> <template name="capslock-key" match="capslock-key"> <common formats="/latex/xelatex/"> <xsl:text>\capslock</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Caps Lock</strong> </common> </template> <template name="tab-key" match="tab-key"> <common formats="/latex/xelatex/"> <xsl:text>\tab</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Tab</strong> </common> </template> <template name="escape-key" match="escape-key"> <common formats="/latex/xelatex/"> <xsl:text>\esc</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Esc</strong> </common> </template> <template name="control-key" match="control-key"> <common formats="/latex/xelatex/"> <xsl:text>\ctrl</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Ctrl</strong> </common> </template> <template name="alt-key" match="alt-key"> <common formats="/latex/xelatex/"> <xsl:text>\Alt</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Alt</strong> </common> </template> <template name="alt-graphics-key" match="alt-graphics-key"> <common formats="/latex/xelatex/"> <xsl:text>\AltGt</xsl:text> </common> <common formats="/html/xhtml/"> <strong>AltGr</strong> </common> </template> <template name="command-key" match="command-key"> <common formats="/latex/xelatex/"> <xsl:text>\cmdmac</xsl:text> </common> <html> <strong>cmd</strong> </html> <xhtml> <strong>⌘</strong> </xhtml> </template> <template name="space-key" match="space-key"> <common formats="/latex/xelatex/"> <xsl:text>\SPACE</xsl:text> </common> <common formats="/html/xhtml/"> <xsl:text>Space</xsl:text> </common> </template> <template name="return-key" match="return-key"> <common formats="/latex/xelatex/"> <xsl:text>\return</xsl:text> </common> <html> <strong>Enter</strong> </html> <xhtml> <strong>⏎</strong> </xhtml> </template> <template name="enter-key" match="enter-key"> <common formats="/latex/xelatex/"> <xsl:text>\enter</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Enter</strong> </common> </template> <template name="windows-key" match="windows-key"> <common formats="/latex/xelatex/"> <xsl:text>\winmenu</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Windows menu</strong> </common> </template> <template name="backspace-key" match="backspace-key"> <common formats="/latex/xelatex/"> <xsl:text>\winmenu</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &larr; </xsl:text> </html> <xhtml> <strong>←</strong> </xhtml> </template> <template name="delete-key" match="delete-key"> <common formats="/latex/xelatex/"> <xsl:text>\del</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Del.</strong> </common> </template> <template name="up-arrow-key" match="up-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeyup</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &uarr; </xsl:text> </html> <xhtml> <strong>↑</strong> </xhtml> </template> <template name="down-arrow-key" match="down-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeydown</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &darr; </xsl:text> </html> <xhtml> <strong>↓</strong> </xhtml> </template> <template name="left-arrow-key" match="left-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeyleft</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &larr; </xsl:text> </html> <xhtml> <strong>←</strong> </xhtml> </template> <template name="right-arrow-key" match="right-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeyright</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &rarr; </xsl:text> </html> <xhtml> <strong>→</strong> </xhtml> </template> <!-- Generates a separator character for a path-like element. $mode: The name of the element type (as per the menukeys package). 'menu' 'directory' 'keys' Returns: The appropriate separator as a string. --> <function name="infosci:path-separator" as="xs:string"> <common> <xsl:param name="mode" /> </common> <common formats="/latex/xelatex/"> <!-- We've specified the same separator for all three menukeys path macros, so (Xe)LaTeX is easy :). --> <xsl:value-of select="' > '" /> </common> <common formats="/html/xhtml/"> <xsl:choose> <xsl:when test="$mode eq 'menu'"> <xsl:call-template name="menu-separator" /> </xsl:when> <xsl:when test="$mode eq 'directory'"> <xsl:value-of select="'/'" /> </xsl:when> <xsl:when test="$mode eq 'keys'"> <xsl:value-of select="'+'" /> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes">ERROR: The mode parameter of function infosci:path-separator must be one of the values 'menu', 'path', or 'keys'.</xsl:message> </xsl:otherwise> </xsl:choose> </common> </function> </stylesheet>
<?xml version="1.0" encoding="utf-8"?> <!-- In-text "paths", for displaying things like menu paths, file system paths, or keyboard sequences. These all have the same basic form, i.e., a list of items separated by some delimiter. NOTE: The (Xe)LaTeX version requires the menukeys 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"> <!-- Only (Xe)LaTeX requires additional processing. (X)HTML will be handled just find by the default template. --> <template name="path" match="menu|directory|keys"> <common formats="/latex/xelatex/"> <!-- Make the menu text just a *little* smaller (menukeys loads the relsize package). --> <xsl:if test="contains('/menu/keys/', local-name(.))"> <xsl:text>{\relsize{-0.5}</xsl:text> </xsl:if> <xsl:text>\</xsl:text> <xsl:value-of select="local-name(.)" /> <xsl:text>{</xsl:text> <xsl:apply-templates /> <xsl:text>}</xsl:text> <xsl:if test="contains('/menu/keys/', local-name(.))"> <xsl:text>}</xsl:text> </xsl:if> </common> <common formats="/html/xhtml/"> </common> </template> <!-- Menu item separator (either ▹ or →). LEGACY/DEPRECATED --> <template name="menu-separator" match="menu-separator|menusep|menu/separator"> <common formats="/latex/xelatex/"><xsl:text> \ensuremath{\triangleright} </xsl:text></common> <!-- Need spaces for HTML as they seem to get munched otherwise. --> <!-- Note: no equivalent of \triangleright in HTML, use right arrow instead. --> <html><xsl:text disable-output-escaping="yes"> &rarr; </xsl:text></html> <!-- U+25B9 WHITE RIGHT-POINTING SMALL TRIANGLE --> <xhtml><span class="unicode"><xsl:text> ▹ </xsl:text></span></xhtml> </template> <template name="menu-separator-strip" match="menu-separator|menusep|menu/separator" mode="strip"> <common formats="/html/xhtml/"> <xsl:call-template name="menu-separator" /> </common> </template> <!-- Individual path items. --> <template name="path-item" match="menu/item|directory/item|keys/item"> <common> <xsl:variable name="mode" select="local-name(..)" /> </common> <common formats="/latex/xelatex/"> <xsl:apply-templates /> <xsl:if test="position() ne last()"> <xsl:value-of select="infosci:path-separator(local-name(..))" /> </xsl:if> </common> <common formats="/html/xhtml/"> <strong> <xsl:apply-templates /> <xsl:if test="position() ne last()"> <xsl:value-of select="infosci:path-separator(local-name(..))" /> </xsl:if> </strong> </common> </template> <!-- Various keyboard keys (as per menukeys package). --> <template name="shift-key" match="shift-key"> <common formats="/latex/xelatex/"> <xsl:text>\shift</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Shift</strong> </common> </template> <template name="capslock-key" match="capslock-key"> <common formats="/latex/xelatex/"> <xsl:text>\capslock</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Caps Lock</strong> </common> </template> <template name="tab-key" match="tab-key"> <common formats="/latex/xelatex/"> <xsl:text>\tab</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Tab</strong> </common> </template> <template name="escape-key" match="escape-key"> <common formats="/latex/xelatex/"> <xsl:text>\esc</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Esc</strong> </common> </template> <template name="control-key" match="control-key"> <common formats="/latex/xelatex/"> <xsl:text>\ctrl</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Ctrl</strong> </common> </template> <template name="alt-key" match="alt-key"> <common formats="/latex/xelatex/"> <xsl:text>\Alt</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Alt</strong> </common> </template> <template name="alt-graphics-key" match="alt-graphics-key"> <common formats="/latex/xelatex/"> <xsl:text>\AltGt</xsl:text> </common> <common formats="/html/xhtml/"> <strong>AltGr</strong> </common> </template> <template name="command-key" match="command-key"> <common formats="/latex/xelatex/"> <xsl:text>\cmdmac</xsl:text> </common> <html> <strong>cmd</strong> </html> <xhtml> <strong>⌘</strong> </xhtml> </template> <template name="space-key" match="space-key"> <common formats="/latex/xelatex/"> <xsl:text>\SPACE</xsl:text> </common> <common formats="/html/xhtml/"> <xsl:text>Space</xsl:text> </common> </template> <template name="return-key" match="return-key"> <common formats="/latex/xelatex/"> <xsl:text>\return</xsl:text> </common> <html> <strong>Enter</strong> </html> <xhtml> <strong>⏎</strong> </xhtml> </template> <template name="enter-key" match="enter-key"> <common formats="/latex/xelatex/"> <xsl:text>\enter</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Enter</strong> </common> </template> <template name="windows-key" match="windows-key"> <common formats="/latex/xelatex/"> <xsl:text>\winmenu</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Windows menu</strong> </common> </template> <template name="backspace-key" match="backspace-key"> <common formats="/latex/xelatex/"> <xsl:text>\winmenu</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &larr; </xsl:text> </html> <xhtml> <strong>←</strong> </xhtml> </template> <template name="delete-key" match="delete-key"> <common formats="/latex/xelatex/"> <xsl:text>\del</xsl:text> </common> <common formats="/html/xhtml/"> <strong>Del.</strong> </common> </template> <template name="up-arrow-key" match="up-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeyup</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &uarr; </xsl:text> </html> <xhtml> <strong>↑</strong> </xhtml> </template> <template name="down-arrow-key" match="down-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeydown</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &darr; </xsl:text> </html> <xhtml> <strong>↓</strong> </xhtml> </template> <template name="left-arrow-key" match="left-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeyleft</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &larr; </xsl:text> </html> <xhtml> <strong>←</strong> </xhtml> </template> <template name="right-arrow-key" match="right-arrow-key"> <common formats="/latex/xelatex/"> <xsl:text>\arrowkeyright</xsl:text> </common> <html> <xsl:text disable-output-escaping="yes"> &rarr; </xsl:text> </html> <xhtml> <strong>→</strong> </xhtml> </template> <!-- Generates a separator character for a path-like element. $mode: The name of the element type (as per the menukeys package). 'menu' 'directory' 'keys' Returns: The appropriate separator as a string. --> <function name="infosci:path-separator" as="xs:string"> <common> <xsl:param name="mode" /> </common> <common formats="/latex/xelatex/"> <!-- We've specified the same separator for all three menukeys path macros, so (Xe)LaTeX is easy :). --> <xsl:value-of select="' > '" /> </common> <common formats="/html/xhtml/"> <xsl:choose> <xsl:when test="$mode eq 'menu'"> <xsl:call-template name="menu-separator" /> </xsl:when> <xsl:when test="$mode eq 'directory'"> <xsl:value-of select="'/'" /> </xsl:when> <xsl:when test="$mode eq 'keys'"> <xsl:value-of select="'+'" /> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes">ERROR: The mode parameter of function infosci:path-separator must be one of the values 'menu', 'path', or 'keys'.</xsl:message> </xsl:otherwise> </xsl:choose> </common> </function> </stylesheet>
Show line notes below