source: BLFS/xsl/process-replaceable.xsl@ cd87e52

ablfs-more trunk
Last change on this file since cd87e52 was 1c22535, checked in by Pierre Labastie <pierre.labastie@…>, 14 months ago

Process two more <replaceable> tags

  • one for libreoffice (use the xreflabel to set LO_PREFIX)
  • one for abiword (installation of normal.awt-ll_CC files)
  • Property mode set to 100644
File size: 6.6 KB
RevLine 
[96d7e44]1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version="1.0">
5
6<!--===================================================================-->
7 <!-- Localization in the form ll_CC.charmap@modifier (to be used in
8 bash shell startup scripts). ll, CC, and charmap must be present:
9 no way to use "C" or "POSIX". -->
10 <xsl:param name="language" select="'en_US.UTF-8'"/>
11
12 <!-- Break it in pieces -->
13 <xsl:variable name="lang-ll">
14 <xsl:copy-of select="substring-before($language,'_')"/>
15 </xsl:variable>
16 <xsl:variable name="lang-CC">
17 <xsl:copy-of
18 select="substring-before(substring-after($language,'_'),'.')"/>
19 </xsl:variable>
20 <xsl:variable name="lang-charmap">
21 <xsl:choose>
22 <xsl:when test="contains($language,'@')">
23 <xsl:copy-of
24 select="substring-before(substring-after($language,'.'),'@')"/>
25 </xsl:when>
26 <xsl:otherwise>
27 <xsl:copy-of select="substring-after($language,'.')"/>
28 </xsl:otherwise>
29 </xsl:choose>
30 </xsl:variable>
31 <xsl:variable name="lang-modifier">
32 <xsl:choose>
33 <xsl:when test="contains($language,'@')">
34 <xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
35 </xsl:when>
36 <xsl:otherwise>
37 <xsl:copy-of select="''"/>
38 </xsl:otherwise>
39 </xsl:choose>
40 </xsl:variable>
41<!-- end of language variables -->
42
43<!--===================================================================-->
44<!-- to be used at places where we need the domain- or host- name -->
45 <xsl:param name="fqdn" select="'belgarath.example.org'"/>
46
47<!-- make various useful variables -->
48 <xsl:variable name="hostname" select="substring-before($fqdn,'.')"/>
49 <xsl:variable name="domainname" select="substring-after($fqdn,'.')"/>
50 <xsl:variable name="DOMAINNAME" select="translate($domainname,
51 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
52<!-- end of host/domain name variables -->
53
[30732c6a]54<!--===================================================================-->
55<!-- keyboard layout for the gdm page (as of BLFS 9.0) -->
56 <xsl:param name="xkblayout" select="'us'"/>
57
[96d7e44]58<!--===================================================================-->
59<!-- the main template: to be adjusted depending on the book -->
60 <xsl:template match="replaceable">
61 <xsl:choose>
62<!-- When adding a user to a group, the book uses "username" in a replaceable
63 tag. Replace by the user name only if not running as root -->
64 <xsl:when test="contains(string(),'username') and $sudo='y'">
65 <xsl:text>$USER</xsl:text>
66 </xsl:when>
67<!-- The next three entries are for gpm. I guess those settings are OK
68 for a laptop or desktop. -->
69 <xsl:when test="contains(string(),'yourprotocol')">
70 <xsl:text>imps2</xsl:text>
71 </xsl:when>
72 <xsl:when test="contains(string(),'yourdevice')">
73 <xsl:text>/dev/input/mice</xsl:text>
74 </xsl:when>
75 <xsl:when test="contains(string(),'additional options')"/>
76<!-- the book has four fields for language. The language param is
77 broken into four pieces above. We use the results here. -->
78 <xsl:when test="contains(string(),'&lt;ll&gt;')">
79 <xsl:copy-of select="$lang-ll"/>
80 </xsl:when>
81 <xsl:when test="contains(string(),'&lt;CC&gt;')">
82 <xsl:copy-of select="$lang-CC"/>
83 </xsl:when>
84 <xsl:when test="contains(string(),'&lt;charmap&gt;')">
85 <xsl:copy-of select="$lang-charmap"/>
86 </xsl:when>
87 <xsl:when test="contains(string(),'@modifier')">
88 <xsl:copy-of select="$lang-modifier"/>
89 </xsl:when>
[30732c6a]90<!-- keyboard layout for X/waylang (only GDM as of BLFS-9.0) -->
91 <xsl:when test="contains(string(),'layout')">
92 <xsl:copy-of select="$xkblayout"/>
93 </xsl:when>
[96d7e44]94<!-- At several places, the number of jobs is given as "N" in a replaceable
95 tag. We either detect "N" alone or &lt;N&gt; Replace N with 4. -->
96 <xsl:when test="contains(string(),'&lt;N&gt;') or string()='N'">
97 <xsl:text>4</xsl:text>
98 </xsl:when>
99<!-- Mercurial config file uses user_name. Replace only if non root.
100 Add a bogus mail field. That works for the proposed tests anyway. -->
101 <xsl:when test="contains(string(),'user_name') and $sudo='y'">
102 <xsl:text>$USER ${USER}@mail.bogus</xsl:text>
103 </xsl:when>
104<!-- Use the config for Gtk+3 as is -->
[38dd3c3]105 <xsl:when test="ancestor::sect1[@id='gtk3' or @id='gtk4']">
[96d7e44]106 <xsl:copy-of select="string()"/>
107 </xsl:when>
108<!-- Give 1Gb to fop. Hopefully, nobody has less RAM nowadays. -->
109 <xsl:when test="contains(string(),'RAM_Installed')">
110 <xsl:text>1024</xsl:text>
111 </xsl:when>
112<!-- for MIT-Kerberos config file -->
113 <xsl:when test="string()='&lt;EXAMPLE.ORG&gt;'">
114 <xsl:copy-of select="$DOMAINNAME"/>
115 </xsl:when>
116 <xsl:when test="string()='&lt;example.org&gt;'">
117 <xsl:copy-of select="$domainname"/>
118 </xsl:when>
119 <xsl:when test="string()='&lt;belgarath.example.org&gt;'">
120 <xsl:copy-of select="$fqdn"/>
121 </xsl:when>
122<!-- in this case, even root can be used -->
123 <xsl:when test="string()='&lt;loginname&gt;'">
124 <xsl:text>$USER</xsl:text>
125 </xsl:when>
[45f82b13]126<!-- for xorg environment. Note that libreoffice too uses &lt;PREFIX&gt; -->
127 <xsl:when test="string()='&lt;PREFIX&gt;' and
128 ancestor::sect1[@id='xorg-env']">
129 <xsl:text>/usr</xsl:text>
130 </xsl:when>
[1c22535]131<!-- for libreoffice. Note that xorg environment too uses &lt;PREFIX&gt; -->
132 <xsl:when test="string()='&lt;PREFIX&gt;' and
133 ancestor::sect1[@id='libreoffice']">
134 <xsl:text>/opt/</xsl:text>
135 <xsl:value-of select="ancestor::sect1/@xreflabel"/>
136 </xsl:when>
137<!-- for abiword -->
138 <xsl:when test="string()='&lt;lang&gt;'">
139 <xsl:choose>
140 <xsl:when test="starts-with($language,'en_US')">
141 <!-- normal.awt for en_US is already there, copy
142 the one for en_GB (could be any other) -->
143 <xsl:text>en_GB</xsl:text>
144 </xsl:when>
145 <xsl:otherwise>
146 <!-- in general, there are normal.awt-ll_CC files-->
147 <xsl:copy-of select="$lang-ll"/>
148 <xsl:text>_</xsl:text>
149 <xsl:copy-of select="$lang-CC"/>
150 </xsl:otherwise>
151 </xsl:choose>
152 </xsl:when>
[96d7e44]153 <xsl:otherwise>
154 <xsl:text>**EDITME</xsl:text>
155 <xsl:apply-templates/>
156 <xsl:text>EDITME**</xsl:text>
157 </xsl:otherwise>
158 </xsl:choose>
159 </xsl:template>
160
161 <xsl:template match="replaceable" mode="root">
162 <xsl:apply-templates select="."/>
163 </xsl:template>
164
165</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.