| 1 |
<?xml version='1.0'?> |
| 2 |
|
| 3 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 4 |
xmlns:exsl="http://exslt.org/common" |
| 5 |
xmlns:perl="urn:perl" |
| 6 |
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" |
| 7 |
version="1.0" |
| 8 |
exclude-result-prefixes="l exsl perl"> |
| 9 |
|
| 10 |
<!-- titles after all elements --> |
| 11 |
<xsl:param name="formal.title.placement"> |
| 12 |
figure after |
| 13 |
example before |
| 14 |
equation before |
| 15 |
table before |
| 16 |
procedure before |
| 17 |
</xsl:param> |
| 18 |
|
| 19 |
<xsl:param name="prod.url" select="'https://sourceware.org/systemtap/'"/> |
| 20 |
<xsl:param name="doc.url" select="'https://sourceware.org/systemtap/'"/> |
| 21 |
|
| 22 |
<xsl:param name="generate.section.toc.level" select="0"/> |
| 23 |
<xsl:param name="qanda.defaultlabel">qanda</xsl:param> |
| 24 |
<xsl:param name="glossary.sort" select="1"/> |
| 25 |
<xsl:param name="formal.object.break.after">0</xsl:param> |
| 26 |
|
| 27 |
<xsl:template name="user.preroot"> |
| 28 |
<!-- Pre-root output, can be used to output comments and PIs. --> |
| 29 |
<!-- This must not output any element content! --> |
| 30 |
</xsl:template> |
| 31 |
<!-- |
| 32 |
Copied from fo/params.xsl |
| 33 |
--> |
| 34 |
<xsl:param name="l10n.gentext.default.language" select="'en'"/> |
| 35 |
<xsl:param name="book.type" select="'book'"/> |
| 36 |
<xsl:param name="web.type" select="''"/> |
| 37 |
<xsl:param name="show.comments">0</xsl:param> |
| 38 |
<xsl:param name="confidential" select="0"/> |
| 39 |
<xsl:param name="confidential.text">CONFIDENTIAL</xsl:param> |
| 40 |
|
| 41 |
<!-- This sets the filename based on the ID. --> |
| 42 |
<xsl:param name="use.id.as.filename" select="'1'"/> |
| 43 |
|
| 44 |
<xsl:param name="embedtoc" select="'0'"/> |
| 45 |
<xsl:param name="tocpath" select="''"/> |
| 46 |
<xsl:param name="pop_prod" select="''"/> |
| 47 |
<xsl:param name="pop_ver" select="''"/> |
| 48 |
<xsl:param name="pop_name" select="''"/> |
| 49 |
<xsl:param name="brand" select="''"/> |
| 50 |
<xsl:param name="langpath" select="''"/> |
| 51 |
|
| 52 |
<xsl:param name="desktop" select="0"/> |
| 53 |
<xsl:param name="draft.mode">maybe</xsl:param> |
| 54 |
|
| 55 |
<xsl:param name="funcsynopsis.style">ansi</xsl:param> |
| 56 |
<xsl:param name="refentry.pagebreak">0</xsl:param> |
| 57 |
|
| 58 |
<xsl:param name="svg.object">1</xsl:param> |
| 59 |
|
| 60 |
<xsl:template match="command"> |
| 61 |
<xsl:call-template name="inline.monoseq"/> |
| 62 |
</xsl:template> |
| 63 |
|
| 64 |
<xsl:template match="application"> |
| 65 |
<xsl:call-template name="inline.boldseq"/> |
| 66 |
</xsl:template> |
| 67 |
|
| 68 |
<xsl:template match="guibutton"> |
| 69 |
<xsl:call-template name="inline.boldseq"/> |
| 70 |
</xsl:template> |
| 71 |
|
| 72 |
<xsl:template match="guiicon"> |
| 73 |
<xsl:call-template name="inline.boldseq"/> |
| 74 |
</xsl:template> |
| 75 |
|
| 76 |
<xsl:template match="guilabel"> |
| 77 |
<xsl:call-template name="inline.boldseq"/> |
| 78 |
</xsl:template> |
| 79 |
|
| 80 |
<xsl:template match="guimenu"> |
| 81 |
<xsl:call-template name="inline.boldseq"/> |
| 82 |
</xsl:template> |
| 83 |
|
| 84 |
<xsl:template match="guimenuitem"> |
| 85 |
<xsl:call-template name="inline.boldseq"/> |
| 86 |
</xsl:template> |
| 87 |
|
| 88 |
<xsl:template match="guisubmenu"> |
| 89 |
<xsl:call-template name="inline.boldseq"/> |
| 90 |
</xsl:template> |
| 91 |
|
| 92 |
<xsl:template match="filename"> |
| 93 |
<xsl:call-template name="inline.monoseq"/> |
| 94 |
</xsl:template> |
| 95 |
|
| 96 |
<xsl:template name="language.to.xslthl"> |
| 97 |
<xsl:param name="context"/> |
| 98 |
|
| 99 |
<xsl:choose> |
| 100 |
<xsl:when test="$context/@language != ''"> |
| 101 |
<xsl:value-of select="$context/@language"/> |
| 102 |
</xsl:when> |
| 103 |
<xsl:when test="$highlight.default.language != ''"> |
| 104 |
<xsl:value-of select="$highlight.default.language"/> |
| 105 |
</xsl:when> |
| 106 |
</xsl:choose> |
| 107 |
</xsl:template> |
| 108 |
|
| 109 |
<xsl:template name="apply-highlighting"> |
| 110 |
<xsl:choose> |
| 111 |
<!-- Do we want syntax highlighting --> |
| 112 |
<xsl:when test="$highlight.source != 0 and function-available('perl:highlight')"> |
| 113 |
<xsl:variable name="language"> |
| 114 |
<xsl:call-template name="language.to.xslthl"> |
| 115 |
<xsl:with-param name="context" select="."/> |
| 116 |
</xsl:call-template> |
| 117 |
</xsl:variable> |
| 118 |
<xsl:choose> |
| 119 |
<xsl:when test="$language != ''"> |
| 120 |
<xsl:variable name="content"> |
| 121 |
<xsl:apply-templates/> |
| 122 |
</xsl:variable> |
| 123 |
<xsl:apply-templates select="perl:highlight($language, exsl:node-set($content))"/> |
| 124 |
</xsl:when> |
| 125 |
<xsl:otherwise> |
| 126 |
<xsl:apply-templates/> |
| 127 |
</xsl:otherwise> |
| 128 |
</xsl:choose> |
| 129 |
</xsl:when> |
| 130 |
<!-- No syntax highlighting --> |
| 131 |
<xsl:otherwise> |
| 132 |
<xsl:apply-templates/> |
| 133 |
</xsl:otherwise> |
| 134 |
</xsl:choose> |
| 135 |
</xsl:template> |
| 136 |
|
| 137 |
<xsl:template name="l10n.language"> |
| 138 |
<xsl:param name="target" select="."/> |
| 139 |
<xsl:param name="xref-context" select="false()"/> |
| 140 |
|
| 141 |
<xsl:variable name="mc-language"> |
| 142 |
<xsl:choose> |
| 143 |
<xsl:when test="$l10n.gentext.language != ''"> |
| 144 |
<xsl:value-of select="$l10n.gentext.language"/> |
| 145 |
</xsl:when> |
| 146 |
|
| 147 |
<xsl:when test="$xref-context or $l10n.gentext.use.xref.language != 0"> |
| 148 |
<!-- can't do this one step: attributes are unordered! --> |
| 149 |
<xsl:variable name="lang-scope" |
| 150 |
select="$target/ancestor-or-self::* |
| 151 |
[@lang or @xml:lang][1]"/> |
| 152 |
<xsl:variable name="lang-attr" |
| 153 |
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/> |
| 154 |
<xsl:choose> |
| 155 |
<xsl:when test="string($lang-attr) = ''"> |
| 156 |
<xsl:value-of select="$l10n.gentext.default.language"/> |
| 157 |
</xsl:when> |
| 158 |
<xsl:otherwise> |
| 159 |
<xsl:value-of select="$lang-attr"/> |
| 160 |
</xsl:otherwise> |
| 161 |
</xsl:choose> |
| 162 |
</xsl:when> |
| 163 |
|
| 164 |
<xsl:otherwise> |
| 165 |
<!-- can't do this one step: attributes are unordered! --> |
| 166 |
<xsl:variable name="lang-scope" |
| 167 |
select="$target/ancestor-or-self::* |
| 168 |
[@lang or @xml:lang][1]"/> |
| 169 |
<xsl:variable name="lang-attr" |
| 170 |
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/> |
| 171 |
|
| 172 |
<xsl:choose> |
| 173 |
<xsl:when test="string($lang-attr) = ''"> |
| 174 |
<xsl:value-of select="$l10n.gentext.default.language"/> |
| 175 |
</xsl:when> |
| 176 |
<xsl:otherwise> |
| 177 |
<xsl:value-of select="$lang-attr"/> |
| 178 |
</xsl:otherwise> |
| 179 |
</xsl:choose> |
| 180 |
</xsl:otherwise> |
| 181 |
</xsl:choose> |
| 182 |
</xsl:variable> |
| 183 |
|
| 184 |
<xsl:variable name="language" select="translate($mc-language, |
| 185 |
'ABCDEFGHIJKLMNOPQRSTUVWXYZ', |
| 186 |
'abcdefghijklmnopqrstuvwxyz')"/> |
| 187 |
|
| 188 |
<!-- sr-Latn-SR Need to remove contry code to get match --> |
| 189 |
<xsl:variable name="adjusted.language"> |
| 190 |
<xsl:choose> |
| 191 |
<xsl:when test="contains($language,'-')"> |
| 192 |
<xsl:variable name="start"><xsl:value-of select="substring-before($language,'-')"/></xsl:variable> |
| 193 |
<xsl:variable name="end"><xsl:value-of select="substring-after($language,'-')"/></xsl:variable> |
| 194 |
<xsl:choose> |
| 195 |
<xsl:when test="contains($end,'-')"> |
| 196 |
<xsl:value-of select="$start"/> |
| 197 |
<xsl:text>_</xsl:text> |
| 198 |
<xsl:value-of select="substring-before($end,'-')"/> |
| 199 |
</xsl:when> |
| 200 |
<xsl:otherwise> |
| 201 |
<xsl:value-of select="$start"/> |
| 202 |
<xsl:text>_</xsl:text> |
| 203 |
<xsl:value-of select="$end"/> |
| 204 |
</xsl:otherwise> |
| 205 |
</xsl:choose> |
| 206 |
</xsl:when> |
| 207 |
<xsl:otherwise> |
| 208 |
<xsl:value-of select="$language"/> |
| 209 |
</xsl:otherwise> |
| 210 |
</xsl:choose> |
| 211 |
</xsl:variable> |
| 212 |
|
| 213 |
<xsl:choose> |
| 214 |
<xsl:when test="$l10n.xml/l:i18n/l:l10n[@language=$adjusted.language]"> |
| 215 |
<xsl:value-of select="$adjusted.language"/> |
| 216 |
</xsl:when> |
| 217 |
<!-- try just the lang code without country --> |
| 218 |
<xsl:when test="$l10n.xml/l:i18n/l:l10n[@language=substring-before($adjusted.language,'_')]"> |
| 219 |
<xsl:value-of select="substring-before($adjusted.language,'_')"/> |
| 220 |
</xsl:when> |
| 221 |
<!-- or use the default --> |
| 222 |
<xsl:otherwise> |
| 223 |
<xsl:message> |
| 224 |
<xsl:text>No DocBook localization exists for "</xsl:text> |
| 225 |
<xsl:value-of select="$adjusted.language"/> |
| 226 |
<xsl:text>" or "</xsl:text> |
| 227 |
<xsl:value-of select="substring-before($adjusted.language,'_')"/> |
| 228 |
<xsl:text>". Using default "</xsl:text> |
| 229 |
<xsl:value-of select="$l10n.gentext.default.language"/> |
| 230 |
<xsl:text>".</xsl:text> |
| 231 |
</xsl:message> |
| 232 |
<xsl:value-of select="$l10n.gentext.default.language"/> |
| 233 |
</xsl:otherwise> |
| 234 |
</xsl:choose> |
| 235 |
</xsl:template> |
| 236 |
|
| 237 |
|
| 238 |
</xsl:stylesheet> |
| 239 |
|
| 240 |
|