xref: /AOO41X/main/readlicense_oo/docs/readme.xsl (revision 83137a03adbb58b5b3bdafefefa1e93de35e0011)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
24
25<!-- <xsl:output method="text" doctype-public="-//W3C//DTD HTML 3.2//EN" omit-xml-declaration="yes"/> -->
26
27  <!-- inputvariable declaration -->
28    <xsl:param name="os1"/>
29    <xsl:param name="gui1"/>
30    <xsl:param name="cp1"/>
31    <xsl:param name="com1"/>
32    <xsl:param name="lang1"/>
33    <xsl:param name="type"/>
34    <xsl:param name="file"/>
35    <xsl:strip-space elements="*"/>
36
37    <xsl:param name="platform">
38        <xsl:if test="$os1='LINUX'">
39            <xsl:value-of select="'LINUX'"/>
40        </xsl:if>
41        <xsl:if test="$os1='WNT'">
42            <xsl:value-of select="'WIN'"/>
43        </xsl:if>
44        <xsl:if test="$os1='SOLARIS'">
45            <xsl:if test="$cp1='SPARC'">
46                <xsl:value-of select="'SOLSPARC'"/>
47            </xsl:if>
48            <xsl:if test="$cp1='INTEL'">
49                <xsl:value-of select="'SOLX86'"/>
50            </xsl:if>
51        </xsl:if>
52        <xsl:if test="$os1='MACOSX'">
53            <xsl:value-of select="'MAC'"/>
54        </xsl:if>
55    </xsl:param>
56
57    <xsl:param name="lf">
58        <xsl:choose>
59            <xsl:when test="$platform='WIN'"><xsl:text>&#xD;&#xA;</xsl:text></xsl:when>
60            <xsl:otherwise><xsl:text>&#xA;</xsl:text></xsl:otherwise>
61        </xsl:choose>
62    </xsl:param>
63
64    <xsl:template match="/">
65        <xsl:choose>
66            <xsl:when test="$type='html'">
67
68                <xsl:document method="html" href="{$file}" doctype-public="-//W3C//DTD HTML 3.2//EN">
69                    <xsl:apply-templates mode="html"/>
70                </xsl:document>
71
72            </xsl:when>
73            <xsl:when test="$type='text'">
74
75                <xsl:document method="text" href="{$file}">
76                    <xsl:call-template name="textout" />
77                </xsl:document>
78
79            </xsl:when>
80        </xsl:choose>
81    </xsl:template>
82
83    <xsl:template match="*" mode="html">
84        <xsl:choose>
85            <xsl:when test="(contains(@class,$platform) or not(@class) or (name(.)='p'))">
86                <xsl:if test="(@xml:lang=$lang1 or not(@xml:lang))"> <!-- check for correct language -->
87                    <xsl:element name="{name(.)}">
88                        <xsl:if test="(name(.)='a')">
89                            <xsl:attribute name="href">
90                                <xsl:value-of select="@href"/>
91                            </xsl:attribute>
92                        </xsl:if>
93                        <xsl:if test="(name(.)='p') and (@class)">
94                            <xsl:attribute name="class">
95                                <xsl:value-of select="@class"/>
96                            </xsl:attribute>
97                        </xsl:if>
98                        <xsl:if test="name(.)='div'">
99                            <xsl:attribute name="id">
100                                <xsl:value-of select="@id"/>
101                            </xsl:attribute>
102                        </xsl:if>
103                        <xsl:apply-templates mode="html"/>
104                    </xsl:element>
105                </xsl:if>
106            </xsl:when>
107            <xsl:otherwise>
108
109            </xsl:otherwise>
110        </xsl:choose>
111    </xsl:template>
112
113    <xsl:template name="textout">
114        <xsl:apply-templates />
115    </xsl:template>
116
117    <xsl:template match="*">
118        <xsl:if test="(@xml:lang=$lang1 or not(@xml:lang))"> <!-- check for correct language -->
119        <xsl:choose>
120            <xsl:when test="name(.)='html'">
121                <xsl:apply-templates/>
122            </xsl:when>
123            <xsl:when test="name(.)='body'">
124                <xsl:apply-templates/>
125            </xsl:when>
126            <xsl:when test="name(.)='hr'">
127                <xsl:text>
128
129----------------------------------------------------------------------------------------------------------
130
131</xsl:text>
132            </xsl:when>
133            <xsl:when test="name(.)='div'">
134                <xsl:if test="(contains(@class,$platform) or not(@class))">
135                    <xsl:apply-templates/>
136                </xsl:if>
137            </xsl:when>
138            <xsl:when test="name(.)='a'">
139                <xsl:apply-templates/>
140            </xsl:when>
141            <xsl:when test="name(.)='tt'">
142                <xsl:apply-templates/>
143            </xsl:when>
144            <xsl:when test="name(.)='li'">
145                <xsl:value-of select="$lf"/>* <xsl:apply-templates/>
146            </xsl:when>
147            <xsl:when test="name(.)='ul'">
148                <xsl:value-of select="$lf"/>
149                <xsl:apply-templates/>
150            </xsl:when>
151            <xsl:when test="name(.)='ol'">
152                <xsl:value-of select="$lf"/>
153                <xsl:apply-templates/>
154            </xsl:when>
155            <xsl:when test="name(.)='p'">
156                <xsl:if test="(not(name(..)='li') and (count(a) = 0))">
157                    <xsl:value-of select="$lf"/>
158                    <xsl:value-of select="$lf"/>
159                </xsl:if>
160                <xsl:apply-templates/>
161            </xsl:when>
162            <xsl:when test="name(.)='h1'">
163                <xsl:value-of select="$lf"/>
164                <xsl:text>======================================================================</xsl:text>
165                <xsl:value-of select="$lf"/>
166                <xsl:apply-templates/>
167                <xsl:value-of select="$lf"/>
168                <xsl:text>======================================================================</xsl:text>
169                <xsl:value-of select="$lf"/>
170            </xsl:when>
171            <xsl:when test="name(.)='h2'">
172                <xsl:value-of select="$lf"/>
173                <xsl:value-of select="$lf"/>
174                <xsl:text>----------------------------------------------------------------------</xsl:text>
175                <xsl:value-of select="$lf"/>
176                <xsl:apply-templates/>
177                <xsl:value-of select="$lf"/>
178                <xsl:text>----------------------------------------------------------------------</xsl:text>
179            </xsl:when>
180            <xsl:when test="name(.)='h3'">
181                <xsl:value-of select="$lf"/>
182                <xsl:value-of select="$lf"/>
183                <xsl:apply-templates/>
184                <xsl:value-of select="$lf"/>
185                <xsl:text>----------------------------------------------------------------------</xsl:text>
186            </xsl:when>
187        </xsl:choose>
188    </xsl:if>
189    </xsl:template>
190
191</xsl:stylesheet>
192