xref: /AOO41X/main/readlicense_oo/docs/readme.xsl (revision 03c97e340010506c11d4ffaab7f577e5f7050fe6)
1<?xml version="1.0" encoding="UTF-8"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4
5<!-- <xsl:output method="text" doctype-public="-//W3C//DTD HTML 3.2//EN" omit-xml-declaration="yes"/> -->
6
7  <!-- inputvariable declaration -->
8    <xsl:param name="os1"/>
9    <xsl:param name="gui1"/>
10    <xsl:param name="cp1"/>
11    <xsl:param name="com1"/>
12    <xsl:param name="lang1"/>
13    <xsl:param name="type"/>
14    <xsl:param name="file"/>
15    <xsl:strip-space elements="*"/>
16
17    <xsl:param name="platform">
18        <xsl:if test="$os1='LINUX'">
19            <xsl:value-of select="'LINUX'"/>
20        </xsl:if>
21        <xsl:if test="$os1='WNT'">
22            <xsl:value-of select="'WIN'"/>
23        </xsl:if>
24        <xsl:if test="$os1='SOLARIS'">
25            <xsl:if test="$cp1='SPARC'">
26                <xsl:value-of select="'SOLSPARC'"/>
27            </xsl:if>
28            <xsl:if test="$cp1='INTEL'">
29                <xsl:value-of select="'SOLX86'"/>
30            </xsl:if>
31        </xsl:if>
32        <xsl:if test="$os1='MACOSX'">
33            <xsl:value-of select="'MAC'"/>
34        </xsl:if>
35    </xsl:param>
36
37    <xsl:param name="lf">
38        <xsl:choose>
39            <xsl:when test="$platform='WIN'"><xsl:text>&#xD;&#xA;</xsl:text></xsl:when>
40            <xsl:otherwise><xsl:text>&#xA;</xsl:text></xsl:otherwise>
41        </xsl:choose>
42    </xsl:param>
43
44    <xsl:template match="/">
45        <xsl:choose>
46            <xsl:when test="$type='html'">
47
48                <xsl:document method="html" href="{$file}" doctype-public="-//W3C//DTD HTML 3.2//EN">
49                    <xsl:apply-templates mode="html"/>
50                </xsl:document>
51
52            </xsl:when>
53            <xsl:when test="$type='text'">
54
55                <xsl:document method="text" href="{$file}">
56                    <xsl:call-template name="textout" />
57                </xsl:document>
58
59            </xsl:when>
60        </xsl:choose>
61    </xsl:template>
62
63    <xsl:template match="*" mode="html">
64        <xsl:choose>
65            <xsl:when test="(contains(@class,$platform) or not(@class) or (name(.)='p'))">
66                <xsl:if test="(@xml:lang=$lang1 or not(@xml:lang))"> <!-- check for correct language -->
67                    <xsl:element name="{name(.)}">
68                        <xsl:if test="(name(.)='a')">
69                            <xsl:attribute name="href">
70                                <xsl:value-of select="@href"/>
71                            </xsl:attribute>
72                        </xsl:if>
73                        <xsl:if test="(name(.)='p') and (@class)">
74                            <xsl:attribute name="class">
75                                <xsl:value-of select="@class"/>
76                            </xsl:attribute>
77                        </xsl:if>
78                        <xsl:if test="name(.)='div'">
79                            <xsl:attribute name="id">
80                                <xsl:value-of select="@id"/>
81                            </xsl:attribute>
82                        </xsl:if>
83                        <xsl:apply-templates mode="html"/>
84                    </xsl:element>
85                </xsl:if>
86            </xsl:when>
87            <xsl:otherwise>
88
89            </xsl:otherwise>
90        </xsl:choose>
91    </xsl:template>
92
93    <xsl:template name="textout">
94        <xsl:apply-templates />
95    </xsl:template>
96
97    <xsl:template match="*">
98        <xsl:if test="(@xml:lang=$lang1 or not(@xml:lang))"> <!-- check for correct language -->
99        <xsl:choose>
100            <xsl:when test="name(.)='html'">
101                <xsl:apply-templates/>
102            </xsl:when>
103            <xsl:when test="name(.)='body'">
104                <xsl:apply-templates/>
105            </xsl:when>
106            <xsl:when test="name(.)='hr'">
107                <xsl:text>
108
109----------------------------------------------------------------------------------------------------------
110
111</xsl:text>
112            </xsl:when>
113            <xsl:when test="name(.)='div'">
114                <xsl:if test="(contains(@class,$platform) or not(@class))">
115                    <xsl:apply-templates/>
116                </xsl:if>
117            </xsl:when>
118            <xsl:when test="name(.)='a'">
119                <xsl:apply-templates/>
120            </xsl:when>
121            <xsl:when test="name(.)='tt'">
122                <xsl:apply-templates/>
123            </xsl:when>
124            <xsl:when test="name(.)='li'">
125                <xsl:value-of select="$lf"/>* <xsl:apply-templates/>
126            </xsl:when>
127            <xsl:when test="name(.)='ul'">
128                <xsl:value-of select="$lf"/>
129                <xsl:apply-templates/>
130            </xsl:when>
131            <xsl:when test="name(.)='ol'">
132                <xsl:value-of select="$lf"/>
133                <xsl:apply-templates/>
134            </xsl:when>
135            <xsl:when test="name(.)='p'">
136                <xsl:if test="(not(name(..)='li') and (count(a) = 0))">
137                    <xsl:value-of select="$lf"/>
138                    <xsl:value-of select="$lf"/>
139                </xsl:if>
140                <xsl:apply-templates/>
141            </xsl:when>
142            <xsl:when test="name(.)='h1'">
143                <xsl:value-of select="$lf"/>
144                <xsl:text>======================================================================</xsl:text>
145                <xsl:value-of select="$lf"/>
146                <xsl:apply-templates/>
147                <xsl:value-of select="$lf"/>
148                <xsl:text>======================================================================</xsl:text>
149                <xsl:value-of select="$lf"/>
150            </xsl:when>
151            <xsl:when test="name(.)='h2'">
152                <xsl:value-of select="$lf"/>
153                <xsl:value-of select="$lf"/>
154                <xsl:text>----------------------------------------------------------------------</xsl:text>
155                <xsl:value-of select="$lf"/>
156                <xsl:apply-templates/>
157                <xsl:value-of select="$lf"/>
158                <xsl:text>----------------------------------------------------------------------</xsl:text>
159            </xsl:when>
160            <xsl:when test="name(.)='h3'">
161                <xsl:value-of select="$lf"/>
162                <xsl:value-of select="$lf"/>
163                <xsl:apply-templates/>
164                <xsl:value-of select="$lf"/>
165                <xsl:text>----------------------------------------------------------------------</xsl:text>
166            </xsl:when>
167        </xsl:choose>
168    </xsl:if>
169    </xsl:template>
170
171</xsl:stylesheet>
172