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

ablfs-more legacy trunk
Last change on this file since b0965fa was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

  • Property mode set to 100644
File size: 5.5 KB
Line 
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
54<!--===================================================================-->
55<!-- keyboard layout for the gdm page (as of BLFS 9.0) -->
56 <xsl:param name="xkblayout" select="'us'"/>
57
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>
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>
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 -->
105 <xsl:when test="ancestor::sect1[@id='gtk3' or @id='gtk4']">
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>
126 <xsl:otherwise>
127 <xsl:text>**EDITME</xsl:text>
128 <xsl:apply-templates/>
129 <xsl:text>EDITME**</xsl:text>
130 </xsl:otherwise>
131 </xsl:choose>
132 </xsl:template>
133
134 <xsl:template match="replaceable" mode="root">
135 <xsl:apply-templates select="."/>
136 </xsl:template>
137
138</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.