]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/typemap.xsl
Help doc writer to spot places where:
[apache] / docs / manual / style / xsl / typemap.xsl
1 <?xml version="1.0"?>
2
3 <!--
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
10
11      http://www.apache.org/licenses/LICENSE-2.0
12
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.
18 -->
19
20 <!DOCTYPE xsl:stylesheet [
21     <!ENTITY lf SYSTEM "util/lf.xml">
22 ]>
23
24 <xsl:stylesheet version="1.0"
25               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26                   xmlns="">
27
28 <xsl:output 
29   method="text"
30   encoding="utf-8"
31   indent="no"
32 />
33
34 <!-- create nodeset for referencing later                                 -->
35 <xsl:variable name="design" select="document('util/designations.xml')
36                                     /items/item" />
37
38 <!-- Constants used for case translation -->
39 <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
40 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
41
42 <!-- ==================================================================== -->
43 <!-- <metafile>                                                           -->
44 <!-- build typemap                                                        -->
45 <!-- ==================================================================== -->
46 <xsl:template match="/metafile">
47 <xsl:text># GENERATED FROM XML -- DO NOT EDIT</xsl:text>&lf;
48 &lf;
49 <xsl:apply-templates select="variants/variant" />
50 </xsl:template>
51 <!-- /metafile -->
52
53 <!-- ==================================================================== -->
54 <!-- <variant>                                                            -->
55 <!-- ==================================================================== -->
56 <xsl:template match="variant">
57 <xsl:variable name="lang" select="translate(., $uppercase, $lowercase)" />
58 <xsl:if test="not($design[translate(@lang, $uppercase, $lowercase) = $lang])">
59     <xsl:message terminate="yes">
60 FATAL: missing designation data for language <xsl:value-of select="." />.
61 The XSLT-Stylesheet won't work without modification.
62     </xsl:message>
63 </xsl:if>
64
65 <xsl:text>URI: </xsl:text>
66 <xsl:value-of select="/metafile/basename" />
67 <xsl:value-of select="$design[translate(@lang, $uppercase, $lowercase)
68                               = $lang]" />&lf;
69
70 <xsl:text>Content-Language: </xsl:text>
71 <xsl:value-of select="$design[translate(@lang, $uppercase, $lowercase)
72                               = $lang]/@lang" />&lf;
73
74 <xsl:text>Content-type: text/html; charset=</xsl:text>
75 <xsl:value-of select="$design[translate(@lang, $uppercase, $lowercase)
76                               = $lang]/@charset" />&lf;
77
78 <xsl:if test="position() != last()">&lf;</xsl:if>
79 </xsl:template>
80 <!-- /variant -->
81
82 </xsl:stylesheet>