4
Licensed to the Apache Software Foundation (ASF) under one or more
5
contributor license agreements. See the NOTICE file distributed with
6
this work for additional information regarding copyright ownership.
7
The ASF licenses this file to You under the Apache License, Version 2.0
8
(the "License"); you may not use this file except in compliance with
9
the License. You may obtain a copy of the License at
11
http://www.apache.org/licenses/LICENSE-2.0
13
Unless required by applicable law or agreed to in writing, software
14
distributed under the License is distributed on an "AS IS" BASIS,
15
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
See the License for the specific language governing permissions and
17
limitations under the License.
20
<!DOCTYPE xsl:stylesheet [
21
<!ENTITY lf SYSTEM "util/lf.xml">
22
<!ENTITY xsl "http://www.w3.org/1999/XSL/Transform">
25
<xsl:stylesheet version="1.0"
26
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
35
<xsl:param name="type" />
36
<xsl:param name="langs" />
38
<!-- ==================================================================== -->
41
<!-- ==================================================================== -->
42
<xsl:template match="/">
44
<xsl:when test="$type = 'list'">
47
<xsl:call-template name="language-list">
48
<xsl:with-param name="langs" select="normalize-space($langs)" />
54
<xsl:apply-templates select="*" />
60
<!-- ==================================================================== -->
61
<!-- language-list -->
62
<!-- generate language list -->
63
<!-- ==================================================================== -->
64
<xsl:template name="language-list">
65
<xsl:param name="langs" />
67
<xsl:if test="string-length($langs)">
69
<xsl:value-of select="substring-before(concat($langs, ' '),' ')" />
73
<xsl:call-template name="language-list">
74
<xsl:with-param name="langs" select="normalize-space(substring-after(
75
concat($langs, ' '), ' '))" />
81
<!-- ==================================================================== -->
82
<!-- <language-list> -->
83
<!-- generate stuff from language list -->
84
<!-- ==================================================================== -->
85
<xsl:template match="/language-list">
87
<xsl:when test="$type = 'design'">
90
<xsl:for-each select="lang">
91
<xsl:variable name="file" select="document(concat('../lang/', .,
93
<item lang="{$file/@id}" charset="{$file/charset}" >
94
<xsl:value-of select="$file/target-ext" />
101
<xsl:when test="$type = 'targets'">
102
<xsl:apply-templates select="/language-list" mode="targets" />
104
<xsl:when test="$type = 'desc'">
105
<xsl:apply-templates select="/language-list" mode="desc" />
107
<xsl:when test="$type = 'modlists'">
108
<xsl:apply-templates select="/language-list" mode="modlists" />
114
<!-- ==================================================================== -->
115
<!-- <language-list> -->
116
<!-- generate target list from language list -->
117
<!-- ==================================================================== -->
118
<xsl:template match="/language-list" mode="targets">
120
<xsl:call-template name="copyright" />
122
<xsl:call-template name="head">
123
<xsl:with-param name="text" select="'this file contains language specific
124
targets and will be included'" />
127
<xsl:call-template name="head">
128
<xsl:with-param name="text" select="'into build.xml. IT IS AUTOGENERATED.
131
<xsl:call-template name="sep" />
133
<project name="lang-targets">
136
<!-- build *-all targets -->
137
<!-- =================== -->
139
description="- builds all HTML files and nroff man pages">
140
<xsl:attribute name="depends">
141
<xsl:for-each select="lang[document(concat('../lang/', .,
142
'.xml'))/language/messages]">
143
<xsl:value-of select="." />
144
<xsl:if test="position() != last()">, </xsl:if>
150
<target name="zip-all"
151
description="- builds all zip download packages">
152
<xsl:attribute name="depends">
153
<xsl:for-each select="lang[document(concat('../lang/', .,
154
'.xml'))/language/messages]">
155
<xsl:text>zip-</xsl:text>
156
<xsl:value-of select="." />
157
<xsl:if test="position() != last()">, </xsl:if>
163
<target name="war-all"
164
description="- builds all war download packages">
165
<xsl:attribute name="depends">
166
<xsl:for-each select="lang[document(concat('../lang/', .,
167
'.xml'))/language/messages]">
168
<xsl:text>war-</xsl:text>
169
<xsl:value-of select="." />
170
<xsl:if test="position() != last()">, </xsl:if>
176
<!-- single language targets -->
177
<!-- ======================= -->
178
<xsl:for-each select="lang">
179
<xsl:sort select="." />
180
<xsl:variable name="file" select="document(concat('../lang/', .,
181
'.xml'))/language" />
183
<xsl:if test="$file/messages">
185
<xsl:call-template name="head">
186
<xsl:with-param name="text" select="$file/name" />
188
<xsl:call-template name="sep" />
190
<property name="inputext.{.}" value="{$file/source-ext}" />&lf;
191
<property name="outputext.{.}" value="{$file/target-ext}" />&lf;&lf;
193
<target name="{.}" description="- builds {$file/name} HTML files">
195
<xsl:text> </xsl:text>
196
<html.generic lang="{.}" />&lf;
198
<xsl:if test=". = 'en'">
199
<xsl:text> </xsl:text><runtarget target="man-en" />&lf;
204
<target name="-off-{.}" depends="metafiles"
205
unless="-off.{.}.done">&lf;
206
<xsl:text> </xsl:text>
207
<dependencies.offline lang="{.}" style="zip" dir="_off" />&lf;
208
<xsl:text> </xsl:text>
209
<offline.generic lang="{.}" style="zip" dir="_off" />&lf;
210
<xsl:text> </xsl:text>
211
<property name="-off.{.}.done" value="yes" />&lf;
215
<target name="zip-{.}" depends="-off-{.}"
216
description="- builds the {$file/name} zipped download package">&lf;
217
<xsl:text> </xsl:text>
218
<zip.generic lang="{.}" />&lf;
222
<target name="war-{.}" depends="-off-{.}"
223
description="- builds the {$file/name} Konqueror Web Archive">&lf;
224
<xsl:text> </xsl:text>
225
<war.generic lang="{.}" />&lf;
229
<xsl:if test="$file/chm">
230
<target name="chm-{.}"
231
description="- builds the {$file/name} CHM file">&lf;
232
<xsl:text> </xsl:text>
233
<chm.generic lang="{.}" />&lf;
238
<xsl:if test="$file/man">
239
<target name="man-{.}"
240
description="- builds the {$file/name} nroff files">&lf;
241
<xsl:text> </xsl:text>
242
<nroff.generic lang="{.}" />&lf;
247
<xsl:if test=". = 'en'">
248
<target name="latex-en"
249
description="- builds the English latex file">&lf;
250
<xsl:text> </xsl:text>
251
<latex.generic lang="en" />&lf;
259
<!-- XML validation -->
260
<!-- ============== -->
261
<xsl:call-template name="head">
262
<xsl:with-param name="text" select="'XML validation.'" />
264
<xsl:call-template name="head">
265
<xsl:with-param name="text" select="'If you get an error during
266
transformation, this task may be useful'" />
268
<xsl:call-template name="head">
269
<xsl:with-param name="text" select="'because it mostly gives you a
270
hint, where you forgot the </p> ;-)'" />
272
<xsl:call-template name="sep" />
274
<target name="validate-xml" description="- validates all XML source files">
276
<xsl:text> </xsl:text>
277
<xmlvalidate lenient="false" failonerror="false" warn="true">
279
<xsl:text> </xsl:text>
280
<xmlcatalog refid="w3c-catalog" />&lf;
281
<xsl:text> </xsl:text>
282
<fileset dir="../">&lf;
283
<xsl:for-each select="lang">
284
<xsl:sort select="." />
286
<xsl:variable name="file" select="document(concat(
287
'../lang/', ., '.xml'))
289
<xsl:if test="$file/messages">
290
<xsl:text> </xsl:text>
291
<include name="**/*{$file/source-ext}" />&lf;
295
<xsl:text> </xsl:text>
296
<patternset refid="excludes" />&lf;
297
<xsl:text> </xsl:text>
298
<patternset refid="scratch" />&lf;
299
<xsl:text> </xsl:text>
302
<xsl:text> </xsl:text>
311
<!-- ==================================================================== -->
312
<!-- <language-list> -->
313
<!-- generate list of modulelists -->
314
<!-- ==================================================================== -->
315
<xsl:template match="/language-list" mode="modlists">
318
<xsl:for-each select="lang">
319
<xsl:sort select="." />
321
<xsl:variable name="file" select="document(concat(
322
'../lang/', ., '.xml'))
325
<xsl:text>../../../mod/allmodules</xsl:text>
326
<xsl:value-of select="$file/source-ext" />
333
<!-- ==================================================================== -->
334
<!-- <language-list> -->
335
<!-- generate project description -->
336
<!-- ==================================================================== -->
337
<xsl:template match="/language-list" mode="desc">
339
<xsl:call-template name="copyright" />
341
<description><xsl:text>
342
This build file contains all operations that are necessary for building
343
the Apache httpd documentation. It is called by invoking build.bat (Win32)
344
or build.sh (/bin/sh systems) with a target argument (full list below).
345
For example, if you want to build the Japanese HTML files, type:
349
Some targets have additional requirements:
351
* 'metafiles' and 'modulelists' need perl in PATH. (It's checked automatically
352
and skipped if perl is not available)
354
* 'chm-foo' targets need:
355
- the HTML Help compiler in PATH (or modify this build file). The
356
compiler (hhc.exe) is part of the HTML Help Workshop which is freely
357
available and can be downloaded from
358
http://msdn.microsoft.com/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp
359
- The appropriate locale (e.g. Japanese) before invoking hhc.exe. Otherwise
360
the compiler is not able to build the fulltext search index correctly and
361
the TOC may be garbled, too. In particular:
364
<xsl:for-each select="lang">
365
<xsl:sort select="." />
367
<xsl:variable name="file" select="document(concat('../lang/', .,
368
'.xml'))/language" />
370
<xsl:if test="$file/messages and $file/chm">
371
<xsl:text> + chm-</xsl:text>
372
<xsl:value-of select="." />
373
<xsl:text>: </xsl:text>
374
<xsl:value-of select="normalize-space($file/chm/settings)" />
383
<!-- ==================================================================== -->
385
<!-- generate language specific xslt -->
386
<!-- ==================================================================== -->
387
<xsl:template match="/language">
389
<xsl:call-template name="copyright" />
391
<xsl:element name="xsl:stylesheet" namespace="&xsl;">
392
<xsl:attribute name="version">1.0</xsl:attribute>
396
<xsl:element name="xsl:output">
397
<xsl:attribute name="method">
399
<xsl:when test="$type = 'manual' or
402
<xsl:text>xml</xsl:text>
404
<xsl:when test="$type = 'hhc' or
407
<xsl:text>text</xsl:text>
410
<xsl:message terminate="yes">
411
<xsl:text>Unknown style type '</xsl:text>
412
<xsl:value-of select="$type" />
413
<xsl:text>'!</xsl:text>
418
<xsl:attribute name="encoding">
420
<xsl:when test="$type = 'chm' or
423
<xsl:value-of select="chm/charset" />
425
<xsl:when test="$type = 'man'">
426
<xsl:value-of select="man/charset" />
429
<xsl:value-of select="charset" />
433
<xsl:attribute name="indent">no</xsl:attribute>
434
<xsl:if test="$type = 'manual' or
437
<xsl:attribute name="doctype-public">
438
<xsl:text>-//W3C//DTD XHTML 1.0 Strict//EN</xsl:text>
441
<xsl:if test="$type = 'manual'">
442
<xsl:attribute name="doctype-system">
443
<xsl:text>http://www.w3.org/TR/xhtml1/DTD/</xsl:text>
444
<xsl:text>xhtml1-strict.dtd</xsl:text>
447
<xsl:if test="$type = 'chm' or
449
<xsl:attribute name="omit-xml-declaration">yes</xsl:attribute>
455
<xsl:text> Read the localized messages from the specified </xsl:text>
456
<xsl:text>language file </xsl:text>
460
<xsl:element name="xsl:variable">
461
<xsl:attribute name="name">message</xsl:attribute>
462
<xsl:attribute name="select">
463
<xsl:text>document('</xsl:text>
464
<xsl:if test="$type != 'manual'">../</xsl:if>
465
<xsl:text>lang/</xsl:text>
466
<xsl:value-of select="@id" />
467
<xsl:text>.xml')/language/messages/message</xsl:text>
472
<xsl:if test="$type != 'man'">
473
<xsl:element name="xsl:variable">
474
<xsl:attribute name="name">doclang</xsl:attribute>
475
<xsl:value-of select="@id" />
478
<xsl:element name="xsl:variable">
479
<xsl:attribute name="name">allmodules</xsl:attribute>
480
<xsl:attribute name="select">
481
<xsl:text>document('</xsl:text>
482
<xsl:if test="$type != 'manual'">../</xsl:if>
483
<xsl:text>xsl/util/allmodules.xml')</xsl:text>
484
<xsl:text>/items/item[@lang=$doclang]</xsl:text>
491
<xsl:if test="$type != 'man'">
493
<xsl:text> some meta information have to be passed to </xsl:text>
494
<xsl:text>the transformation </xsl:text>
499
<xsl:if test="$type = 'manual' or
503
<xsl:element name="xsl:variable">
504
<xsl:attribute name="name">output-encoding</xsl:attribute>
506
<xsl:when test="$type = 'chm' or
508
<xsl:value-of select="normalize-space(chm/charset)" />
511
<xsl:value-of select="normalize-space(charset)" />
518
<xsl:if test="$type = 'manual' or
521
<xsl:element name="xsl:variable">
522
<xsl:attribute name="name">is-chm</xsl:attribute>
523
<xsl:attribute name="select">
525
<xsl:when test="$type = 'chm'">
526
<xsl:text>true()</xsl:text>
529
<xsl:text>false()</xsl:text>
536
<xsl:element name="xsl:variable">
537
<xsl:attribute name="name">is-zip</xsl:attribute>
538
<xsl:attribute name="select">
540
<xsl:when test="$type = 'zip'">
541
<xsl:text>true()</xsl:text>
544
<xsl:text>false()</xsl:text>
552
<xsl:if test="$type = 'hhc'">
553
<xsl:element name="xsl:variable">
554
<xsl:attribute name="name">toc-font</xsl:attribute>
555
<xsl:value-of select="normalize-space(chm/toc-font)" />
559
<xsl:element name="xsl:variable">
560
<xsl:attribute name="name">xml-ext</xsl:attribute>
561
<xsl:value-of select="normalize-space(source-ext)" />
566
<xsl:if test="$type = 'hhp'">
567
<xsl:element name="xsl:variable">
568
<xsl:attribute name="name">hhp-lang</xsl:attribute>
569
<xsl:value-of select="normalize-space(chm/lang)" />
574
<xsl:comment> Now get the real guts of the stylesheet </xsl:comment>
577
<xsl:element name="xsl:include">
578
<xsl:attribute name="href">
580
<xsl:when test="$type = 'chm' or
582
<xsl:text>../xsl/common.xsl</xsl:text>
584
<xsl:when test="$type = 'hhc'">
585
<xsl:text>../xsl/hhc.xsl</xsl:text>
587
<xsl:when test="$type = 'hhp'">
588
<xsl:text>../xsl/hhp.xsl</xsl:text>
590
<xsl:when test="$type = 'man'">
591
<xsl:text>../xsl/nroff.xsl</xsl:text>
594
<xsl:text>xsl/common.xsl</xsl:text>
606
<xsl:template name="copyright">
608
<xsl:comment><xsl:text>
609
Licensed to the Apache Software Foundation (ASF) under one or more
610
contributor license agreements. See the NOTICE file distributed with
611
this work for additional information regarding copyright ownership.
612
The ASF licenses this file to You under the Apache License, Version 2.0
613
(the "License"); you may not use this file except in compliance with
614
the License. You may obtain a copy of the License at
616
http://www.apache.org/licenses/LICENSE-2.0
618
Unless required by applicable law or agreed to in writing, software
619
distributed under the License is distributed on an "AS IS" BASIS,
620
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
621
See the License for the specific language governing permissions and
622
limitations under the License.
623
</xsl:text></xsl:comment>
628
<xsl:template name="sepstring">
629
<xsl:text>============================================</xsl:text>
630
<xsl:text>========================</xsl:text>
634
<xsl:template name="sep">
636
<xsl:text> </xsl:text>
637
<xsl:call-template name="sepstring" />
638
<xsl:text> </xsl:text>
643
<xsl:template name="head">
644
<xsl:param name="text" />
646
<xsl:variable name="s"><xsl:call-template name="sepstring" /></xsl:variable>
647
<xsl:variable name="empty" select="translate($s, '=', ' ')" />
650
<xsl:text> </xsl:text>
651
<xsl:value-of select="substring(concat(normalize-space($text), $empty), 1,
652
string-length($empty))" />
653
<xsl:text> </xsl:text>