3 Additional user-stylesheet for dblatex. It customizes
4 - the template matching the <alt> element such that no automatic math mode
6 - the appearance of <gui(menu|label|button|icon)> elements
8 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" version='
1.0'
>
10 <xsl:import href=
"orig-asciidoc-dblatex.xsl"/>
12 <!-- Direct copy of the content -->
14 <xsl:template match=
"alt" mode=
"latex">
15 <xsl:variable name=
"delim">
16 <xsl:if test=
"processing-instruction('texmath')">
17 <xsl:call-template name=
"pi-attribute">
18 <xsl:with-param name=
"pis"
19 select=
"processing-instruction('texmath')"/>
20 <xsl:with-param name=
"attribute" select=
"'delimiters'"/>
25 <xsl:variable name=
"tex">
26 <xsl:variable name=
"text" select=
"normalize-space(.)"/>
27 <xsl:variable name=
"len" select=
"string-length($text)"/>
29 <xsl:when test=
"$delim='user'">
30 <xsl:copy-of select=
"."/>
32 <xsl:when test=
"ancestor::equation[not(child::title)]">
33 <!-- Remove any math mode in an equation environment -->
35 <xsl:when test=
"starts-with($text,'$') and
36 substring($text,$len,$len)='$'">
37 <xsl:copy-of select=
"substring($text, 2, $len - 2)"/>
39 <xsl:when test=
"(starts-with($text,'\[') and
40 substring($text,$len - 1,$len)='\]') or
41 (starts-with($text,'\(') and
42 substring($text,$len - 1,$len)='\)')">
43 <xsl:copy-of select=
"substring($text, 3, $len - 4)"/>
46 <xsl:copy-of select=
"."/>
50 <!-- Test to be DB5 compatible, where <alt> can be in other elements -->
51 <xsl:when test=
"ancestor::equation or
52 ancestor::informalequation or
53 ancestor::inlineequation">
54 <!-- Keep the specified math mode... -->
56 <xsl:when test=
"(starts-with($text,'\[') and
57 substring($text,$len - 1,$len)='\]') or
58 (starts-with($text,'\(') and
59 substring($text,$len - 1,$len)='\)') or
60 (starts-with($text,'$') and
61 substring($text,$len,$len)='$')">
62 <xsl:copy-of select=
"$text"/>
64 <!-- ...Or wrap in default math mode -->
66 <!-- ...Or rather not...
67 <xsl:copy-of select="concat('$', $text, '$')"/>-->
68 <xsl:copy-of select=
"$text"/>
75 <!-- Encode it properly -->
76 <xsl:call-template name=
"scape-encode">
77 <xsl:with-param name=
"string" select=
"$tex"/>
81 <xsl:template match=
"guibutton|guiicon|guilabel|guimenu">
82 <xsl:call-template name=
"inline.italicseq"/>