source: BOOK/stylesheets/xhtml/lfs-mixed.xsl @ 3f8be484

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 3f8be484 was 3f8be484, checked in by Jim Gifford <clfs@…>, 18 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

  • Property mode set to 100644
File size: 5.4 KB
RevLine 
[3f8be484]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
58  <!-- variablelist -->
59  <xsl:template match="variablelist">
60    <xsl:choose>
61      <xsl:when test="@role">
62        <div class="{@role}">
63          <xsl:apply-imports/>
64        </div>
65      </xsl:when>
66      <xsl:otherwise>
67        <xsl:apply-imports/>
68      </xsl:otherwise>
69    </xsl:choose>
70  </xsl:template>
71
72
73    <!-- Body attributes -->
74  <xsl:template name="body.attributes">
75    <xsl:attribute name="id">
76      <xsl:text>lfs</xsl:text>
77    </xsl:attribute>
78    <xsl:attribute name="class">
79      <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
80    </xsl:attribute>
81  </xsl:template>
82
83    <!-- External URLs in italic font -->
84  <xsl:template match="ulink" name="ulink">
85    <a>
86      <xsl:if test="@id">
87        <xsl:attribute name="id">
88          <xsl:value-of select="@id"/>
89        </xsl:attribute>
90      </xsl:if>
91      <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
92       <i>
93        <xsl:choose>
94          <xsl:when test="count(child::node())=0">
95            <xsl:value-of select="@url"/>
96          </xsl:when>
97          <xsl:otherwise>
98            <xsl:apply-templates/>
99          </xsl:otherwise>
100        </xsl:choose>
101      </i>
102    </a>
103  </xsl:template>
104
105    <!-- The <code> xhtml tag have look issues in some browsers, like Konqueror and.
106      isn't semantically correct (a filename isn't a code fragment) We will use <tt> for now. -->
107  <xsl:template name="inline.monoseq">
108    <xsl:param name="content">
109      <xsl:call-template name="anchor"/>
110      <xsl:call-template name="simple.xlink">
111        <xsl:with-param name="content">
112          <xsl:apply-templates/>
113        </xsl:with-param>
114      </xsl:call-template>
115    </xsl:param>
116    <tt class="{local-name(.)}">
117      <xsl:if test="@dir">
118        <xsl:attribute name="dir">
119          <xsl:value-of select="@dir"/>
120        </xsl:attribute>
121      </xsl:if>
122      <xsl:copy-of select="$content"/>
123    </tt>
124  </xsl:template>
125
126  <xsl:template name="inline.boldmonoseq">
127    <xsl:param name="content">
128      <xsl:call-template name="anchor"/>
129      <xsl:call-template name="simple.xlink">
130        <xsl:with-param name="content">
131          <xsl:apply-templates/>
132        </xsl:with-param>
133      </xsl:call-template>
134    </xsl:param>
135    <!-- don't put <strong> inside figure, example, or table titles -->
136    <!-- or other titles that may already be represented with <strong>'s. -->
137    <xsl:choose>
138      <xsl:when test="local-name(..) = 'title' and (local-name(../..) = 'figure'
139              or local-name(../..) = 'example' or local-name(../..) = 'table' or local-name(../..) = 'formalpara')">
140        <tt class="{local-name(.)}">
141          <xsl:if test="@dir">
142            <xsl:attribute name="dir">
143              <xsl:value-of select="@dir"/>
144            </xsl:attribute>
145          </xsl:if>
146          <xsl:copy-of select="$content"/>
147        </tt>
148      </xsl:when>
149      <xsl:otherwise>
150        <strong class="{local-name(.)}">
151          <tt>
152            <xsl:if test="@dir">
153              <xsl:attribute name="dir">
154                <xsl:value-of select="@dir"/>
155              </xsl:attribute>
156            </xsl:if>
157            <xsl:copy-of select="$content"/>
158          </tt>
159        </strong>
160      </xsl:otherwise>
161    </xsl:choose>
162  </xsl:template>
163
164  <xsl:template name="inline.italicmonoseq">
165    <xsl:param name="content">
166      <xsl:call-template name="anchor"/>
167      <xsl:call-template name="simple.xlink">
168        <xsl:with-param name="content">
169          <xsl:apply-templates/>
170        </xsl:with-param>
171      </xsl:call-template>
172    </xsl:param>
173    <em class="{local-name(.)}">
174      <tt>
175        <xsl:if test="@dir">
176          <xsl:attribute name="dir">
177            <xsl:value-of select="@dir"/>
178          </xsl:attribute>
179        </xsl:if>
180        <xsl:copy-of select="$content"/>
181      </tt>
182    </em>
183  </xsl:template>
184
185</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.