Newer
Older
XML / modules / menus.xml
<?xml version="1.0" encoding="utf-8"?>

<!--
	In-text "menus", e.g., for displaying things like Windows Start Menu items.
	
	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">

	<!--
		No template for the top-level "menu" element at present, as there's no additional processing required. The default template will catch it just fine.
	-->
	
	
	<!-- Menu item separator (either ▹ or →). -->
	
	<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"> &amp;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 menu items. -->
	
	<template name="menu-item" match="menu/item">
		<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>
	
</stylesheet>