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