1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
2 |
|
---|
3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | xmlns="http://www.w3.org/1999/xhtml"
|
---|
5 | version="1.0">
|
---|
6 |
|
---|
7 | <!-- screen -->
|
---|
8 | <xsl:template match="screen">
|
---|
9 | <xsl:choose>
|
---|
10 | <xsl:when test="@role = 'root'">
|
---|
11 | <pre class="root">
|
---|
12 | <xsl:apply-templates/>
|
---|
13 | </pre>
|
---|
14 | </xsl:when>
|
---|
15 | <xsl:when test="child::* = userinput">
|
---|
16 | <pre class="userinput">
|
---|
17 | <xsl:apply-templates/>
|
---|
18 | </pre>
|
---|
19 | </xsl:when>
|
---|
20 | <xsl:otherwise>
|
---|
21 | <pre class="{name(.)}">
|
---|
22 | <xsl:apply-templates/>
|
---|
23 | </pre>
|
---|
24 | </xsl:otherwise>
|
---|
25 | </xsl:choose>
|
---|
26 | </xsl:template>
|
---|
27 |
|
---|
28 | <!-- userinput -->
|
---|
29 | <xsl:template match="userinput">
|
---|
30 | <xsl:choose>
|
---|
31 | <xsl:when test="ancestor::screen">
|
---|
32 | <kbd class="command">
|
---|
33 | <xsl:apply-templates/>
|
---|
34 | </kbd>
|
---|
35 | </xsl:when>
|
---|
36 | <xsl:otherwise>
|
---|
37 | <xsl:apply-imports/>
|
---|
38 | </xsl:otherwise>
|
---|
39 | </xsl:choose>
|
---|
40 | </xsl:template>
|
---|
41 |
|
---|
42 | <!-- Body attributes -->
|
---|
43 | <xsl:template name="body.attributes">
|
---|
44 | <xsl:attribute name="id">
|
---|
45 | <xsl:text>blfs</xsl:text>
|
---|
46 | </xsl:attribute>
|
---|
47 | <xsl:attribute name="class">
|
---|
48 | <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
|
---|
49 | </xsl:attribute>
|
---|
50 | </xsl:template>
|
---|
51 |
|
---|
52 | <!-- External URLs in class='url' -->
|
---|
53 | <xsl:template match="ulink" name="ulink">
|
---|
54 | <a>
|
---|
55 | <xsl:if test="@id">
|
---|
56 | <xsl:attribute name="id">
|
---|
57 | <xsl:value-of select="@id"/>
|
---|
58 | </xsl:attribute>
|
---|
59 | </xsl:if>
|
---|
60 | <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
|
---|
61 | <span class='url'>
|
---|
62 | <xsl:choose>
|
---|
63 | <xsl:when test="count(child::node())=0">
|
---|
64 | <xsl:value-of select="@url"/>
|
---|
65 | </xsl:when>
|
---|
66 | <xsl:otherwise>
|
---|
67 | <xsl:apply-templates/>
|
---|
68 | </xsl:otherwise>
|
---|
69 | </xsl:choose>
|
---|
70 | </span>
|
---|
71 | </a>
|
---|
72 | </xsl:template>
|
---|
73 |
|
---|
74 | <!-- Cunstomizing segementedlist -->
|
---|
75 | <xsl:template match="seg">
|
---|
76 | <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
|
---|
77 | <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
|
---|
78 | <xsl:variable name="segtitles" select="$seglist/segtitle"/>
|
---|
79 | <!-- Note: segtitle is only going to be the right thing in a well formed
|
---|
80 | SegmentedList. If there are too many Segs or too few SegTitles,
|
---|
81 | you'll get something odd...maybe an error -->
|
---|
82 | <div class="seg">
|
---|
83 | <strong>
|
---|
84 | <span class="segtitle">
|
---|
85 | <xsl:apply-templates select="$segtitles[$segnum=position()]"
|
---|
86 | mode="segtitle-in-seg"/>
|
---|
87 | <xsl:text>: </xsl:text>
|
---|
88 | </span>
|
---|
89 | </strong>
|
---|
90 | <span class="seg">
|
---|
91 | <xsl:apply-templates/>
|
---|
92 | </span>
|
---|
93 | </div>
|
---|
94 | </xsl:template>
|
---|
95 |
|
---|
96 | <!-- The <code> xhtml tag have look issues in some browsers, like Konqueror and.
|
---|
97 | isn't semantically correct (a filename isn't a code fragment) We will use <tt> for now. -->
|
---|
98 | <xsl:template name="inline.monoseq">
|
---|
99 | <xsl:param name="content">
|
---|
100 | <xsl:call-template name="anchor"/>
|
---|
101 | <xsl:call-template name="simple.xlink">
|
---|
102 | <xsl:with-param name="content">
|
---|
103 | <xsl:apply-templates/>
|
---|
104 | </xsl:with-param>
|
---|
105 | </xsl:call-template>
|
---|
106 | </xsl:param>
|
---|
107 | <tt class="{local-name(.)}">
|
---|
108 | <xsl:if test="@dir">
|
---|
109 | <xsl:attribute name="dir">
|
---|
110 | <xsl:value-of select="@dir"/>
|
---|
111 | </xsl:attribute>
|
---|
112 | </xsl:if>
|
---|
113 | <xsl:copy-of select="$content"/>
|
---|
114 | </tt>
|
---|
115 | </xsl:template>
|
---|
116 |
|
---|
117 | <xsl:template name="inline.boldmonoseq">
|
---|
118 | <xsl:param name="content">
|
---|
119 | <xsl:call-template name="anchor"/>
|
---|
120 | <xsl:call-template name="simple.xlink">
|
---|
121 | <xsl:with-param name="content">
|
---|
122 | <xsl:apply-templates/>
|
---|
123 | </xsl:with-param>
|
---|
124 | </xsl:call-template>
|
---|
125 | </xsl:param>
|
---|
126 | <!-- don't put <strong> inside figure, example, or table titles -->
|
---|
127 | <!-- or other titles that may already be represented with <strong>'s. -->
|
---|
128 | <xsl:choose>
|
---|
129 | <xsl:when test="local-name(..) = 'title' and (local-name(../..) = 'figure'
|
---|
130 | or local-name(../..) = 'example' or local-name(../..) = 'table' or local-name(../..) = 'formalpara')">
|
---|
131 | <tt class="{local-name(.)}">
|
---|
132 | <xsl:if test="@dir">
|
---|
133 | <xsl:attribute name="dir">
|
---|
134 | <xsl:value-of select="@dir"/>
|
---|
135 | </xsl:attribute>
|
---|
136 | </xsl:if>
|
---|
137 | <xsl:copy-of select="$content"/>
|
---|
138 | </tt>
|
---|
139 | </xsl:when>
|
---|
140 | <xsl:otherwise>
|
---|
141 | <strong class="{local-name(.)}">
|
---|
142 | <tt>
|
---|
143 | <xsl:if test="@dir">
|
---|
144 | <xsl:attribute name="dir">
|
---|
145 | <xsl:value-of select="@dir"/>
|
---|
146 | </xsl:attribute>
|
---|
147 | </xsl:if>
|
---|
148 | <xsl:copy-of select="$content"/>
|
---|
149 | </tt>
|
---|
150 | </strong>
|
---|
151 | </xsl:otherwise>
|
---|
152 | </xsl:choose>
|
---|
153 | </xsl:template>
|
---|
154 |
|
---|
155 | <xsl:template name="inline.italicmonoseq">
|
---|
156 | <xsl:param name="content">
|
---|
157 | <xsl:call-template name="anchor"/>
|
---|
158 | <xsl:call-template name="simple.xlink">
|
---|
159 | <xsl:with-param name="content">
|
---|
160 | <xsl:apply-templates/>
|
---|
161 | </xsl:with-param>
|
---|
162 | </xsl:call-template>
|
---|
163 | </xsl:param>
|
---|
164 | <em class="{local-name(.)}">
|
---|
165 | <tt>
|
---|
166 | <xsl:if test="@dir">
|
---|
167 | <xsl:attribute name="dir">
|
---|
168 | <xsl:value-of select="@dir"/>
|
---|
169 | </xsl:attribute>
|
---|
170 | </xsl:if>
|
---|
171 | <xsl:copy-of select="$content"/>
|
---|
172 | </tt>
|
---|
173 | </em>
|
---|
174 | </xsl:template>
|
---|
175 |
|
---|
176 | </xsl:stylesheet>
|
---|