summaryrefslogtreecommitdiff
path: root/stylesheets/info2html.xsl.in
blob: ec75878ef7ce1df9fd3fac8d0636f4867b8fc267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:yelp="http://www.gnome.org/yelp/ns"
                xmlns="http://www.w3.org/1999/xhtml"
                extension-element-prefixes="yelp"
                version="1.0">

<xsl:import href="@XSL_GETTEXT@"/>
<xsl:import href="@XSL_COLOR@"/>
<xsl:import href="@XSL_ICONS@"/>
<xsl:import href="@XSL_HTML@"/>
<xsl:include href="yelp-common.xsl"/>

<xsl:template name="linktrails">
  <xsl:param name="up" select="@up"/>
  <xsl:variable name="upnode" select="/Info//Section[@id = $up]"/>
  <xsl:if test="$upnode/@up">
    <xsl:call-template name="linktrails">
      <xsl:with-param name="up" select="$upnode/@up"/>
    </xsl:call-template>
  </xsl:if>
  <a href="xref:{$upnode/@id}">
    <xsl:value-of select="$upnode/@name"/>
  </a>
  <xsl:text>&#x00A0;ยป </xsl:text>
</xsl:template>

<xsl:template match="/">
  <xsl:for-each select="/Info/Section">
    <xsl:call-template name="html.output"/>
  </xsl:for-each>
</xsl:template>

<xsl:template mode="html.output.after.mode" match="Section">
  <xsl:for-each select="Section">
    <xsl:call-template name="html.output"/>
  </xsl:for-each>
</xsl:template>

<xsl:template mode="html.title.mode" match="Section">
  <xsl:value-of select="@name"/>
</xsl:template>

<xsl:template mode="html.css.mode" match="Section">
  <xsl:param name="direction"/>
  <xsl:param name="left"/>
  <xsl:param name="right"/>
  <xsl:text>
div.body { white-space: pre; font-family: monospace; }
<!-- navbar from mal2html, possibly move to html.xsl -->
div.navbar {
  margin: 0 0 1em 0;
  text-align: right;
  font-family: sans-serif;
}
a.navbar-prev::before {
  content: '</xsl:text><xsl:choose>
  <xsl:when test="$left = 'left'"><xsl:text>&#x25C0;&#x00A0;&#x00A0;</xsl:text></xsl:when>
  <xsl:otherwise><xsl:text>&#x25B6;&#x00A0;&#x00A0;</xsl:text></xsl:otherwise>
  </xsl:choose><xsl:text>';
  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
}
a.navbar-next::after {
  content: '</xsl:text><xsl:choose>
  <xsl:when test="$left = 'left'"><xsl:text>&#x00A0;&#x00A0;&#x25B6;</xsl:text></xsl:when>
  <xsl:otherwise><xsl:text>&#x00A0;&#x00A0;&#x25C0;</xsl:text></xsl:otherwise>
  </xsl:choose><xsl:text>';
  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
}
</xsl:text>
</xsl:template>

<xsl:template mode="html.header.mode" match="Section">
  <xsl:if test="@up">
    <div class="trails">
      <div class="trail">
        <xsl:call-template name="linktrails"/>
      </div>
    </div>
  </xsl:if>
</xsl:template>

<xsl:template mode="html.body.mode" match="Section">
  <div class="navbar">
    <xsl:variable name="preceding" select="(parent::Section[1] | preceding::Section[1])[last()]"/>
    <xsl:variable name="following" select="(Section[1] | following::Section[1])[1]"/>
    <xsl:if test="$preceding">
      <a class="navbar-prev" href="xref:{$preceding/@id}">
        <xsl:value-of select="$preceding/@name"/>
      </a>
    </xsl:if>
    <xsl:if test="$preceding and $following">
      <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
    </xsl:if>
    <xsl:if test="$following">
      <a class="navbar-next" href="xref:{$following/@id}">
        <xsl:value-of select="$following/@name"/>
      </a>
    </xsl:if>
  </div>
  <xsl:apply-templates select="node()[not(self::Section)]"/>
</xsl:template>


<!-- = Normal Matches = -->

<xsl:template match="para">
  <xsl:value-of select="node()"/>
  <xsl:text>
  </xsl:text>
</xsl:template>

<xsl:template match="para1">
  <xsl:value-of select="node()"/>
</xsl:template>

<xsl:template match="spacing">
  <xsl:value-of select="node()"/>
</xsl:template>

<xsl:template match="a">
  <xsl:element name="a">
    <xsl:attribute name="href">
      <xsl:value-of select="@href"/>
    </xsl:attribute>
    <xsl:value-of select="node()"/>
  </xsl:element>
</xsl:template>

<xsl:template match="img">
  <xsl:element name="a">
    <xsl:attribute name="href">
      <xsl:value-of select="@src"/>
    </xsl:attribute>
    <xsl:element name="img">
      <xsl:attribute name="src"> <xsl:value-of select="@src"/></xsl:attribute>
    </xsl:element>
  </xsl:element>
</xsl:template>

<xsl:template match="menuholder">
  <xsl:apply-templates select="node()[not(self::menuholder)]"/>
</xsl:template>

<xsl:template match="noteholder">
  <xsl:apply-templates select="node()[not(self::noteholder)]"/>
</xsl:template>

</xsl:stylesheet>