xref: /trunk/main/xmlhelp/util/main_transform.xsl (revision d41ee026)
1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
2cdf0e10cSrcweir
3cdf0e10cSrcweir
4cdf0e10cSrcweir<!--***********************************************************************
5cdf0e10cSrcweir  This is the main transformation style sheet for transforming.
6cdf0e10cSrcweir  Only use with OOo 2.0
7cdf0e10cSrcweir  Owner: fpe@openoffice.org
8cdf0e10cSrcweir  =========================================================================
9cdf0e10cSrcweir  Changes Log
10cdf0e10cSrcweir    May 24 2004 Created
11cdf0e10cSrcweir    Aug 24 2004 Fixed for help2 CWS
12cdf0e10cSrcweir    Aug 27 2004 Added css link, fixed missing embed-mode for variable
13cdf0e10cSrcweir                Removed width/height for images
14cdf0e10cSrcweir    Sep 03 2004 Modularized xsl, added some embedded modes
15cdf0e10cSrcweir    Oct 08 2004 Fixed bug wrong mode "embedded" for links
16cdf0e10cSrcweir                Added embedded modes for embed and embedvar (for cascaded embeds)
17cdf0e10cSrcweir                Added <p> tags around falsely embedded pars and vars
18cdf0e10cSrcweir    Dec 08 2004 #i38483#, fixed wrong handling of web links
19cdf0e10cSrcweir                #i37377#, fixed missing usage of Database parameter for switching
20cdf0e10cSrcweir    Jan 04 2005 #i38905#, fixed buggy branding replacement template
21cdf0e10cSrcweir    Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter
22cdf0e10cSrcweir                evaluate new localize attribute in images
23cdf0e10cSrcweir    May 10 2005 #i48785#, fixed wrong setting of distrib variable
24cdf0e10cSrcweir    Aug 16 2005 workaround for #i53365#
25cdf0e10cSrcweir    Aug 19 2005 fixed missing list processing in embedded sections
26cdf0e10cSrcweir    Aug 19 2005 #i53535#, fixed wrong handling of Database parameter
27cdf0e10cSrcweir    Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console
28cdf0e10cSrcweir    Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors
29cdf0e10cSrcweir***********************************************************************//-->
30cdf0e10cSrcweir
31705deb1aSAndrew Rist<!--***********************************************************
32*d41ee026Smseidel *
33705deb1aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
34705deb1aSAndrew Rist * or more contributor license agreements.  See the NOTICE file
35705deb1aSAndrew Rist * distributed with this work for additional information
36705deb1aSAndrew Rist * regarding copyright ownership.  The ASF licenses this file
37705deb1aSAndrew Rist * to you under the Apache License, Version 2.0 (the
38705deb1aSAndrew Rist * "License"); you may not use this file except in compliance
39705deb1aSAndrew Rist * with the License.  You may obtain a copy of the License at
40*d41ee026Smseidel *
41705deb1aSAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
42*d41ee026Smseidel *
43705deb1aSAndrew Rist * Unless required by applicable law or agreed to in writing,
44705deb1aSAndrew Rist * software distributed under the License is distributed on an
45705deb1aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
46705deb1aSAndrew Rist * KIND, either express or implied.  See the License for the
47705deb1aSAndrew Rist * specific language governing permissions and limitations
48705deb1aSAndrew Rist * under the License.
49*d41ee026Smseidel *
50705deb1aSAndrew Rist ***********************************************************-->
51cdf0e10cSrcweir
52cdf0e10cSrcweir<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
53cdf0e10cSrcweir
54cdf0e10cSrcweir<xsl:output indent="yes" method="html"/>
55cdf0e10cSrcweir
56cdf0e10cSrcweir<!--
57cdf0e10cSrcweir############################
58cdf0e10cSrcweir# Variables and Parameters #
59cdf0e10cSrcweir############################
60cdf0e10cSrcweir//-->
61cdf0e10cSrcweir
62cdf0e10cSrcweir<!-- General Usage -->
63cdf0e10cSrcweir<xsl:variable name="am" select="'&amp;'"/>
64cdf0e10cSrcweir<xsl:variable name="sl" select="'/'"/>
65cdf0e10cSrcweir<xsl:variable name="qt" select="'&quot;'"/>
66cdf0e10cSrcweir
67cdf0e10cSrcweir<!-- generic Icon alt text -->
68cdf0e10cSrcweir<xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/>
69cdf0e10cSrcweir
70cdf0e10cSrcweir<!-- For calculating pixel sizes -->
71cdf0e10cSrcweir<xsl:variable name="dpi" select="'96'"/>
72cdf0e10cSrcweir<xsl:variable name="dpcm" select="'38'"/>
73cdf0e10cSrcweir
74cdf0e10cSrcweir<!-- Product brand variables used in the help files -->
75cdf0e10cSrcweir<xsl:variable name="brand1" select="'$[officename]'"/>
76cdf0e10cSrcweir<xsl:variable name="brand2" select="'$[officeversion]'"/>
77cdf0e10cSrcweir<xsl:variable name="brand3" select="'%PRODUCTNAME'"/>
78cdf0e10cSrcweir<xsl:variable name="brand4" select="'%PRODUCTVERSION'"/>
79*d41ee026Smseidel<xsl:variable name="brand5" select="'%WRITERCOMPATIBILITYVERSIONOOO11'"/>
80cdf0e10cSrcweir
81cdf0e10cSrcweir<!-- meta data variables from the help file -->
82cdf0e10cSrcweir<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
83cdf0e10cSrcweir<xsl:variable name="topic_id" select="/helpdocument/meta/topic/@id"/>
84cdf0e10cSrcweir<xsl:variable name="topic_status" select="/helpdocument/meta/topic/@status"/>
85cdf0e10cSrcweir<xsl:variable name="title" select="/helpdocument/meta/topic/title"/>
86cdf0e10cSrcweir<xsl:variable name="doclang" select="/helpdocument/meta/topic/title/@xml-lang"/>
87cdf0e10cSrcweir
88cdf0e10cSrcweir<!-- Module and the corresponding switching values-->
89cdf0e10cSrcweir<xsl:param name="Database" select="'swriter'"/>
90cdf0e10cSrcweir<xsl:variable name="module" select="$Database"/>
91cdf0e10cSrcweir<xsl:variable name="appl">
92cdf0e10cSrcweir	<xsl:choose>
93cdf0e10cSrcweir		<xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when>
94cdf0e10cSrcweir		<xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when>
95cdf0e10cSrcweir		<xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when>
96cdf0e10cSrcweir		<xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when>
97cdf0e10cSrcweir		<xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when>
98cdf0e10cSrcweir		<xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when>
99cdf0e10cSrcweir		<xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when>
100cdf0e10cSrcweir	</xsl:choose>
101cdf0e10cSrcweir</xsl:variable>
102cdf0e10cSrcweir
103*d41ee026Smseidel<!-- the other parameters given by the help caller -->
104cdf0e10cSrcweir<xsl:param name="System" select="'WIN'"/>
105cdf0e10cSrcweir<xsl:param name="productname" select="'Office'"/>
106cdf0e10cSrcweir<xsl:param name="productversion" select="''"/>
107cdf0e10cSrcweir<xsl:variable name="pversion">
108cdf0e10cSrcweir	<xsl:value-of select="translate($productversion,' ','')"/>
109cdf0e10cSrcweir</xsl:variable>
110cdf0e10cSrcweir<!-- this is were the images are -->
111cdf0e10cSrcweir<xsl:param name="imgrepos" select="''"/>
112cdf0e10cSrcweir<xsl:param name="Id" />
113cdf0e10cSrcweir<!-- (lame) distinction between OS and Commercial -->
114cdf0e10cSrcweir<xsl:param name="distrib">
115cdf0e10cSrcweir	<xsl:choose>
116cdf0e10cSrcweir		<xsl:when test="starts-with($productname,'OpenOffice')">
117cdf0e10cSrcweir			<xsl:value-of select="'OpenSource'"/>
118cdf0e10cSrcweir		</xsl:when>
119cdf0e10cSrcweir		<xsl:otherwise>
120cdf0e10cSrcweir			<xsl:value-of select="'COMMERCIAL'"/>
121cdf0e10cSrcweir		</xsl:otherwise>
122cdf0e10cSrcweir	</xsl:choose>
123cdf0e10cSrcweir</xsl:param>
124cdf0e10cSrcweir<xsl:param name="Language" select="'en-US'"/>
125cdf0e10cSrcweir<xsl:variable name="lang" select="$Language"/>
126cdf0e10cSrcweir
127cdf0e10cSrcweir<xsl:param name="ExtensionId" select="''"/>
128cdf0e10cSrcweir<xsl:param name="ExtensionPath" select="''"/>
129cdf0e10cSrcweir
130cdf0e10cSrcweir
131*d41ee026Smseidel<!-- parts of help and image urls -->
132cdf0e10cSrcweir<xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/>
133cdf0e10cSrcweir<xsl:variable name="img_url_prefix" select="concat('vnd.sun.star.zip://',$imgrepos,'/')"/>
134cdf0e10cSrcweir<xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/>
135*d41ee026Smseidel<xsl:variable name="urlpre" select="$help_url_prefix" />
136cdf0e10cSrcweir<xsl:variable name="linkprefix" select="$urlpre"/>
137cdf0e10cSrcweir<xsl:variable name="linkpostfix" select="$urlpost"/>
138cdf0e10cSrcweir
139cdf0e10cSrcweir<xsl:variable name="css" select="'default.css'"/>
140cdf0e10cSrcweir
141cdf0e10cSrcweir<!-- images for notes, tips and warnings -->
142cdf0e10cSrcweir<xsl:variable name="note_img" select="concat($img_url_prefix,'res/helpimg/note.png')"/>
143cdf0e10cSrcweir<xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/>
144cdf0e10cSrcweir<xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/>
145cdf0e10cSrcweir
146cdf0e10cSrcweir<!--
147cdf0e10cSrcweir#############
148cdf0e10cSrcweir# Templates #
149cdf0e10cSrcweir#############
150cdf0e10cSrcweir//-->
151cdf0e10cSrcweir
152cdf0e10cSrcweir<!-- Create the document skeleton -->
153cdf0e10cSrcweir<xsl:template match="/">
154cdf0e10cSrcweir	<xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/>
155cdf0e10cSrcweir	<html>
156cdf0e10cSrcweir		<head>
157cdf0e10cSrcweir			<title><xsl:value-of select="$title"/></title>
158cdf0e10cSrcweir			<link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link -->
159*d41ee026Smseidel		<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
160cdf0e10cSrcweir		</head>
161cdf0e10cSrcweir		<body lang="{$lang}">
162cdf0e10cSrcweir			<xsl:apply-templates select="/helpdocument/body"/>
163cdf0e10cSrcweir		</body>
164cdf0e10cSrcweir	</html>
165cdf0e10cSrcweir</xsl:template>
166cdf0e10cSrcweir
167cdf0e10cSrcweir<!-- AHELP -->
168cdf0e10cSrcweir<xsl:template match="ahelp">
169cdf0e10cSrcweir	<xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if>
170cdf0e10cSrcweir</xsl:template>
171cdf0e10cSrcweir
172cdf0e10cSrcweir<!-- ALT -->
173cdf0e10cSrcweir<xsl:template match="alt"/>
174cdf0e10cSrcweir
175cdf0e10cSrcweir<!-- BOOKMARK -->
176cdf0e10cSrcweir<xsl:template match="bookmark">
177cdf0e10cSrcweir	<a name="{@id}"></a>
178cdf0e10cSrcweir	<xsl:choose>
179cdf0e10cSrcweir		<xsl:when test="starts-with(@branch,'hid')" />
180cdf0e10cSrcweir		<xsl:otherwise><xsl:apply-templates /></xsl:otherwise>
181cdf0e10cSrcweir	</xsl:choose>
182cdf0e10cSrcweir</xsl:template>
183cdf0e10cSrcweir<xsl:template match="bookmark" mode="embedded" />
184cdf0e10cSrcweir
185cdf0e10cSrcweir<!-- BOOKMARK_VALUE -->
186cdf0e10cSrcweir<xsl:template match="bookmark_value" />
187cdf0e10cSrcweir
188cdf0e10cSrcweir<!-- BR -->
189cdf0e10cSrcweir<xsl:template match="br"><br /></xsl:template>
190cdf0e10cSrcweir
191cdf0e10cSrcweir<!-- CAPTION -->
192cdf0e10cSrcweir<xsl:template match="caption" />
193cdf0e10cSrcweir
194cdf0e10cSrcweir<!-- CASE -->
195cdf0e10cSrcweir<xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template>
196cdf0e10cSrcweir<xsl:template match="case" mode="embedded">
197cdf0e10cSrcweir	<xsl:call-template name="insertcase">
198cdf0e10cSrcweir		<xsl:with-param name="embedded" select="'yes'"/>
199cdf0e10cSrcweir	</xsl:call-template>
200cdf0e10cSrcweir</xsl:template>
201cdf0e10cSrcweir
202cdf0e10cSrcweir<!-- CASEINLINE -->
203cdf0e10cSrcweir<xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template>
204cdf0e10cSrcweir<xsl:template match="caseinline" mode="embedded">
205cdf0e10cSrcweir	<xsl:call-template name="insertcase">
206cdf0e10cSrcweir		<xsl:with-param name="embedded" select="'yes'"/>
207cdf0e10cSrcweir	</xsl:call-template>
208cdf0e10cSrcweir</xsl:template>
209cdf0e10cSrcweir
210cdf0e10cSrcweir<!-- COMMENT -->
211cdf0e10cSrcweir<xsl:template match="comment" />
212cdf0e10cSrcweir<xsl:template match="comment" mode="embedded"/>
213cdf0e10cSrcweir
214cdf0e10cSrcweir<!-- CREATED -->
215cdf0e10cSrcweir<xsl:template match="created" />
216cdf0e10cSrcweir
217cdf0e10cSrcweir<!-- DEFAULT -->
218cdf0e10cSrcweir<xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template>
219cdf0e10cSrcweir<xsl:template match="default" mode="embedded">
220cdf0e10cSrcweir	<xsl:call-template name="insertdefault">
221cdf0e10cSrcweir		<xsl:with-param name="embedded" select="'yes'"/>
222cdf0e10cSrcweir	</xsl:call-template>
223cdf0e10cSrcweir</xsl:template>
224cdf0e10cSrcweir
225cdf0e10cSrcweir<!-- DEFAULTINLINE -->
226cdf0e10cSrcweir<xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template>
227cdf0e10cSrcweir<xsl:template match="defaultinline" mode="embedded">
228cdf0e10cSrcweir	<xsl:call-template name="insertdefault">
229cdf0e10cSrcweir		<xsl:with-param name="embedded" select="'yes'"/>
230cdf0e10cSrcweir	</xsl:call-template>
231cdf0e10cSrcweir</xsl:template>
232cdf0e10cSrcweir
233cdf0e10cSrcweir<!-- EMBED -->
234cdf0e10cSrcweir<xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template>
235cdf0e10cSrcweir<xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template>
236cdf0e10cSrcweir
237cdf0e10cSrcweir<!-- EMBEDVAR -->
238cdf0e10cSrcweir<xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template>
239cdf0e10cSrcweir<xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template>
240cdf0e10cSrcweir
241cdf0e10cSrcweir<!-- EMPH -->
242cdf0e10cSrcweir<xsl:template match="emph">
243cdf0e10cSrcweir	<span class="emph"><xsl:apply-templates /></span>
244cdf0e10cSrcweir</xsl:template>
245cdf0e10cSrcweir<xsl:template match="emph" mode="embedded">
246cdf0e10cSrcweir	<span class="emph"><xsl:apply-templates /></span>
247cdf0e10cSrcweir</xsl:template>
248cdf0e10cSrcweir
249cdf0e10cSrcweir<!-- FILENAME -->
250cdf0e10cSrcweir<xsl:template match="filename" />
251cdf0e10cSrcweir
252cdf0e10cSrcweir<!-- HISTORY -->
253cdf0e10cSrcweir<xsl:template match="history" />
254cdf0e10cSrcweir
255cdf0e10cSrcweir<!-- IMAGE -->
256cdf0e10cSrcweir<xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template>
257cdf0e10cSrcweir<xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template>
258cdf0e10cSrcweir
259cdf0e10cSrcweir<!-- ITEM -->
260cdf0e10cSrcweir<xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
261cdf0e10cSrcweir<xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
262cdf0e10cSrcweir
263cdf0e10cSrcweir<!-- LASTEDITED -->
264cdf0e10cSrcweir<xsl:template match="lastedited" />
265cdf0e10cSrcweir
266cdf0e10cSrcweir<!-- LINK -->
267cdf0e10cSrcweir<xsl:template match="link">
268cdf0e10cSrcweir	<xsl:choose> <!-- don't insert the heading link to itself -->
269cdf0e10cSrcweir		<xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)">
270cdf0e10cSrcweir			<xsl:apply-templates />
271cdf0e10cSrcweir		</xsl:when>
272cdf0e10cSrcweir		<xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
273cdf0e10cSrcweir			<xsl:call-template name="insert_howtoget">
274cdf0e10cSrcweir				<xsl:with-param name="linkhref" select="@href"/>
275cdf0e10cSrcweir			</xsl:call-template>
276cdf0e10cSrcweir		</xsl:when>
277cdf0e10cSrcweir		<xsl:otherwise>
278*d41ee026Smseidel			<xsl:call-template name="createlink" />
279cdf0e10cSrcweir		</xsl:otherwise>
280cdf0e10cSrcweir	</xsl:choose>
281cdf0e10cSrcweir</xsl:template>
282cdf0e10cSrcweir<xsl:template match="link" mode="embedded">
283cdf0e10cSrcweir	<xsl:call-template name="createlink"/>
284cdf0e10cSrcweir</xsl:template>
285cdf0e10cSrcweir
286cdf0e10cSrcweir<!-- LIST -->
287cdf0e10cSrcweir<xsl:template match="list">
288cdf0e10cSrcweir	<xsl:choose>
289cdf0e10cSrcweir		<xsl:when test="@type='ordered'">
290cdf0e10cSrcweir			<ol>
291cdf0e10cSrcweir				<xsl:if test="@startwith">
292cdf0e10cSrcweir					<xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
293cdf0e10cSrcweir				</xsl:if>
294cdf0e10cSrcweir				<xsl:apply-templates />
295cdf0e10cSrcweir			</ol>
296cdf0e10cSrcweir		</xsl:when>
297cdf0e10cSrcweir		<xsl:otherwise>
298cdf0e10cSrcweir			<ul><xsl:apply-templates /></ul>
299cdf0e10cSrcweir		</xsl:otherwise>
300cdf0e10cSrcweir	</xsl:choose>
301cdf0e10cSrcweir</xsl:template>
302cdf0e10cSrcweir
303cdf0e10cSrcweir<xsl:template match="list" mode="embedded">
304cdf0e10cSrcweir	<xsl:choose>
305cdf0e10cSrcweir		<xsl:when test="@type='ordered'">
306cdf0e10cSrcweir			<ol>
307cdf0e10cSrcweir				<xsl:if test="@startwith">
308cdf0e10cSrcweir					<xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
309cdf0e10cSrcweir				</xsl:if>
310cdf0e10cSrcweir				<xsl:apply-templates mode="embedded"/>
311cdf0e10cSrcweir			</ol>
312cdf0e10cSrcweir		</xsl:when>
313cdf0e10cSrcweir		<xsl:otherwise>
314cdf0e10cSrcweir			<ul><xsl:apply-templates mode="embedded"/></ul>
315cdf0e10cSrcweir		</xsl:otherwise>
316cdf0e10cSrcweir	</xsl:choose>
317cdf0e10cSrcweir</xsl:template>
318cdf0e10cSrcweir
319cdf0e10cSrcweir<!-- LISTITEM -->
320cdf0e10cSrcweir<xsl:template match="listitem">
321cdf0e10cSrcweir	<li><xsl:apply-templates /></li>
322cdf0e10cSrcweir</xsl:template>
323cdf0e10cSrcweir
324cdf0e10cSrcweir<xsl:template match="listitem" mode="embedded">
325cdf0e10cSrcweir	<li><xsl:apply-templates mode="embedded"/></li>
326cdf0e10cSrcweir</xsl:template>
327cdf0e10cSrcweir
328cdf0e10cSrcweir<!-- META, SEE HEADER -->
329cdf0e10cSrcweir<xsl:template match="meta" />
330cdf0e10cSrcweir
331cdf0e10cSrcweir<!-- OBJECT (UNUSED) -->
332cdf0e10cSrcweir<xsl:template match="object" />
333cdf0e10cSrcweir
334cdf0e10cSrcweir<!-- PARAGRAPH -->
335cdf0e10cSrcweir<xsl:template match="paragraph">
336cdf0e10cSrcweir	<xsl:choose>
337*d41ee026Smseidel
338cdf0e10cSrcweir		<xsl:when test="@role='heading'">
339cdf0e10cSrcweir			<xsl:call-template name="insertheading">
340cdf0e10cSrcweir				<xsl:with-param name="level" select="@level"/>
341cdf0e10cSrcweir			</xsl:call-template>
342cdf0e10cSrcweir		</xsl:when>
343*d41ee026Smseidel
344cdf0e10cSrcweir		<xsl:when test="contains(' note warning tip ',@role)">
345cdf0e10cSrcweir			<xsl:call-template name="insertnote">
346cdf0e10cSrcweir				<xsl:with-param name="type" select="@role" />
347cdf0e10cSrcweir			</xsl:call-template>
348cdf0e10cSrcweir		</xsl:when>
349*d41ee026Smseidel
350cdf0e10cSrcweir		<xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
351cdf0e10cSrcweir			<xsl:apply-templates />
352*d41ee026Smseidel		</xsl:when>
353*d41ee026Smseidel
354cdf0e10cSrcweir		<xsl:otherwise>
355cdf0e10cSrcweir			<xsl:call-template name="insertpara" />
356cdf0e10cSrcweir		</xsl:otherwise>
357*d41ee026Smseidel
358cdf0e10cSrcweir	</xsl:choose>
359cdf0e10cSrcweir</xsl:template>
360cdf0e10cSrcweir
361cdf0e10cSrcweir<xsl:template match="paragraph" mode="embedded">
362cdf0e10cSrcweir		<xsl:choose>
363*d41ee026Smseidel
364cdf0e10cSrcweir		<xsl:when test="@role='heading'">	<!-- increase the level of headings that are embedded -->
365*d41ee026Smseidel		<!--
366*d41ee026Smseidel			The internal sablotron processor does not seem to support the number function.
367*d41ee026Smseidel			Therefore, we need a workaround for
368*d41ee026Smseidel			<xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable>
369cdf0e10cSrcweir		-->
370cdf0e10cSrcweir			<xsl:variable name="newlevel">
371cdf0e10cSrcweir				<xsl:choose>
372cdf0e10cSrcweir					<xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when>
373cdf0e10cSrcweir					<xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when>
374cdf0e10cSrcweir					<xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when>
375cdf0e10cSrcweir					<xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when>
376cdf0e10cSrcweir					<xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when>
377cdf0e10cSrcweir				</xsl:choose>
378cdf0e10cSrcweir			</xsl:variable>
379*d41ee026Smseidel
380cdf0e10cSrcweir			<xsl:call-template name="insertheading">
381cdf0e10cSrcweir				<xsl:with-param name="level" select="$newlevel"/>
382cdf0e10cSrcweir				<xsl:with-param name="embedded" select="'yes'"/>
383cdf0e10cSrcweir			</xsl:call-template>
384cdf0e10cSrcweir		</xsl:when>
385*d41ee026Smseidel
386cdf0e10cSrcweir		<xsl:when test="contains(' note warning tip ',@role)">
387cdf0e10cSrcweir			<xsl:call-template name="insertnote">
388cdf0e10cSrcweir				<xsl:with-param name="type" select="@role" />
389cdf0e10cSrcweir			</xsl:call-template>
390cdf0e10cSrcweir		</xsl:when>
391*d41ee026Smseidel
392cdf0e10cSrcweir		<xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
393cdf0e10cSrcweir			<xsl:apply-templates />
394*d41ee026Smseidel		</xsl:when>
395*d41ee026Smseidel
396cdf0e10cSrcweir		<xsl:otherwise>
397cdf0e10cSrcweir			<xsl:call-template name="insertpara" />
398cdf0e10cSrcweir		</xsl:otherwise>
399*d41ee026Smseidel
400cdf0e10cSrcweir	</xsl:choose>
401cdf0e10cSrcweir</xsl:template>
402cdf0e10cSrcweir
403cdf0e10cSrcweir
404cdf0e10cSrcweir<!-- SECTION -->
405cdf0e10cSrcweir<xsl:template match="section">
406cdf0e10cSrcweir	<a name="{@id}"></a>
407cdf0e10cSrcweir
408cdf0e10cSrcweir		<xsl:choose>
409*d41ee026Smseidel
410cdf0e10cSrcweir			<xsl:when test="@id='relatedtopics'">
411cdf0e10cSrcweir				<div class="relatedtopics">
412cdf0e10cSrcweir					<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
413cdf0e10cSrcweir					<xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
414cdf0e10cSrcweir					<xsl:variable name="doc" select="document($href)"/>
415cdf0e10cSrcweir					<p class="related">
416cdf0e10cSrcweir						<xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
417cdf0e10cSrcweir					</p>
418cdf0e10cSrcweir					<div class="relatedbody">
419cdf0e10cSrcweir						<xsl:apply-templates />
420cdf0e10cSrcweir					</div>
421cdf0e10cSrcweir				</div>
422cdf0e10cSrcweir			</xsl:when>
423*d41ee026Smseidel
424cdf0e10cSrcweir			<xsl:when test="@id='howtoget'">
425cdf0e10cSrcweir				<xsl:call-template name="insert_howtoget" />
426cdf0e10cSrcweir			</xsl:when>
427*d41ee026Smseidel
428cdf0e10cSrcweir			<xsl:otherwise>
429cdf0e10cSrcweir						<xsl:apply-templates/>
430cdf0e10cSrcweir			</xsl:otherwise>
431*d41ee026Smseidel
432cdf0e10cSrcweir		</xsl:choose>
433cdf0e10cSrcweir
434cdf0e10cSrcweir</xsl:template>
435cdf0e10cSrcweir
436cdf0e10cSrcweir
437cdf0e10cSrcweir<!-- SECTION -->
438cdf0e10cSrcweir<xsl:template match="section" mode="embedded">
439cdf0e10cSrcweir	<a name="{@id}"></a>
440cdf0e10cSrcweir	<xsl:apply-templates mode="embedded"/>
441cdf0e10cSrcweir</xsl:template>
442cdf0e10cSrcweir
443cdf0e10cSrcweir<!-- SORT -->
444cdf0e10cSrcweir<xsl:template match="sort" >
445cdf0e10cSrcweir	<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
446cdf0e10cSrcweir</xsl:template>
447cdf0e10cSrcweir<xsl:template match="sort" mode="embedded">
448cdf0e10cSrcweir	<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
449cdf0e10cSrcweir</xsl:template>
450cdf0e10cSrcweir
451cdf0e10cSrcweir<!-- SWITCH -->
452cdf0e10cSrcweir<xsl:template match="switch"><xsl:apply-templates /></xsl:template>
453cdf0e10cSrcweir<xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template>
454cdf0e10cSrcweir
455cdf0e10cSrcweir<!-- SWITCHINLINE -->
456cdf0e10cSrcweir<xsl:template match="switchinline"><xsl:apply-templates /></xsl:template>
457cdf0e10cSrcweir<xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template>
458cdf0e10cSrcweir
459cdf0e10cSrcweir<!-- TABLE -->
460cdf0e10cSrcweir<xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template>
461cdf0e10cSrcweir<xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template>
462cdf0e10cSrcweir
463cdf0e10cSrcweir<!-- TABLECELL -->
464cdf0e10cSrcweir<xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template>
465cdf0e10cSrcweir<xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template>
466cdf0e10cSrcweir<xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template>
467cdf0e10cSrcweir
468cdf0e10cSrcweir<!-- TABLEROW -->
469cdf0e10cSrcweir<xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template>
470cdf0e10cSrcweir<xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template>
471cdf0e10cSrcweir<xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template>
472cdf0e10cSrcweir
473cdf0e10cSrcweir<!-- TITLE -->
474cdf0e10cSrcweir<xsl:template match="title"/>
475cdf0e10cSrcweir
476cdf0e10cSrcweir<!-- TOPIC -->
477cdf0e10cSrcweir<xsl:template match="topic"/>
478cdf0e10cSrcweir
479cdf0e10cSrcweir<!-- VARIABLE -->
480cdf0e10cSrcweir<xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template>
481cdf0e10cSrcweir<xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template>
482cdf0e10cSrcweir
483cdf0e10cSrcweir<xsl:template match="text()">
484cdf0e10cSrcweir	<xsl:call-template name="brand">
485cdf0e10cSrcweir		<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
486cdf0e10cSrcweir	</xsl:call-template>
487cdf0e10cSrcweir</xsl:template>
488cdf0e10cSrcweir
489cdf0e10cSrcweir<xsl:template match="text()" mode="embedded">
490cdf0e10cSrcweir	<xsl:call-template name="brand">
491cdf0e10cSrcweir		<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
492cdf0e10cSrcweir	</xsl:call-template>
493cdf0e10cSrcweir</xsl:template>
494cdf0e10cSrcweir
495cdf0e10cSrcweir<!-- In case of missing help files -->
496cdf0e10cSrcweir<xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template>
497cdf0e10cSrcweir
498*d41ee026Smseidel<!--
499cdf0e10cSrcweir###################
500cdf0e10cSrcweir# NAMED TEMPLATES #
501cdf0e10cSrcweir###################
502cdf0e10cSrcweir//-->
503cdf0e10cSrcweir
504cdf0e10cSrcweir<!-- Branding -->
505cdf0e10cSrcweir<xsl:template name="brand" >
506cdf0e10cSrcweir	<xsl:param name="string"/>
507*d41ee026Smseidel
508*d41ee026Smseidel	<xsl:choose>
509*d41ee026Smseidel
510*d41ee026Smseidel		<xsl:when test="contains($string,$brand1)">
511*d41ee026Smseidel			<xsl:variable name="newstr">
512*d41ee026Smseidel				<xsl:value-of select="substring-before($string,$brand1)"/>
513*d41ee026Smseidel				<xsl:value-of select="$productname"/>
514*d41ee026Smseidel				<xsl:value-of select="substring-after($string,$brand1)"/>
515*d41ee026Smseidel			</xsl:variable>
516cdf0e10cSrcweir			<xsl:call-template name="brand">
517cdf0e10cSrcweir				<xsl:with-param name="string" select="$newstr"/>
518cdf0e10cSrcweir			</xsl:call-template>
519cdf0e10cSrcweir		</xsl:when>
520*d41ee026Smseidel
521cdf0e10cSrcweir		<xsl:when test="contains($string,$brand2)">
522*d41ee026Smseidel			<xsl:variable name="newstr">
523*d41ee026Smseidel				<xsl:value-of select="substring-before($string,$brand2)"/>
524*d41ee026Smseidel				<xsl:value-of select="$pversion"/>
525*d41ee026Smseidel				<xsl:value-of select="substring-after($string,$brand2)"/>
526*d41ee026Smseidel			</xsl:variable>
527cdf0e10cSrcweir			<xsl:call-template name="brand">
528cdf0e10cSrcweir				<xsl:with-param name="string" select="$newstr"/>
529cdf0e10cSrcweir			</xsl:call-template>
530cdf0e10cSrcweir		</xsl:when>
531*d41ee026Smseidel
532cdf0e10cSrcweir		<xsl:when test="contains($string,$brand3)">
533cdf0e10cSrcweir			<xsl:variable name="newstr">
534*d41ee026Smseidel				<xsl:value-of select="substring-before($string,$brand3)"/>
535*d41ee026Smseidel				<xsl:value-of select="$productname"/>
536*d41ee026Smseidel				<xsl:value-of select="substring-after($string,$brand3)"/>
537*d41ee026Smseidel			</xsl:variable>
538*d41ee026Smseidel			<xsl:call-template name="brand">
539*d41ee026Smseidel				<xsl:with-param name="string" select="$newstr"/>
540*d41ee026Smseidel			</xsl:call-template>
541*d41ee026Smseidel		</xsl:when>
542*d41ee026Smseidel
543*d41ee026Smseidel		<xsl:when test="contains($string,$brand4)">
544*d41ee026Smseidel				<xsl:variable name="newstr">
545*d41ee026Smseidel				<xsl:value-of select="substring-before($string,$brand4)"/>
546*d41ee026Smseidel				<xsl:value-of select="$pversion"/>
547*d41ee026Smseidel				<xsl:value-of select="substring-after($string,$brand4)"/>
548*d41ee026Smseidel			</xsl:variable>
549cdf0e10cSrcweir			<xsl:call-template name="brand">
550cdf0e10cSrcweir				<xsl:with-param name="string" select="$newstr"/>
551cdf0e10cSrcweir			</xsl:call-template>
552cdf0e10cSrcweir		</xsl:when>
553*d41ee026Smseidel
554*d41ee026Smseidel		<xsl:when test="contains($string,$brand5)">
555*d41ee026Smseidel				<xsl:variable name="newstr">
556*d41ee026Smseidel				<xsl:value-of select="substring-before($string,$brand5)"/>
557*d41ee026Smseidel				<xsl:value-of select="'OpenOffice.org 1.1'"/>
558*d41ee026Smseidel				<xsl:value-of select="substring-after($string,$brand5)"/>
559*d41ee026Smseidel				</xsl:variable>
560cdf0e10cSrcweir			<xsl:call-template name="brand">
561cdf0e10cSrcweir				<xsl:with-param name="string" select="$newstr"/>
562cdf0e10cSrcweir			</xsl:call-template>
563cdf0e10cSrcweir		</xsl:when>
564*d41ee026Smseidel
565*d41ee026Smseidel		<xsl:otherwise>
566cdf0e10cSrcweir			<xsl:value-of select="$string"/>
567cdf0e10cSrcweir		</xsl:otherwise>
568*d41ee026Smseidel	</xsl:choose>
569*d41ee026Smseidel
570cdf0e10cSrcweir</xsl:template>
571cdf0e10cSrcweir
572cdf0e10cSrcweir
573cdf0e10cSrcweir<!-- Insert Paragraph -->
574cdf0e10cSrcweir<xsl:template name="insertpara">
575cdf0e10cSrcweir	<xsl:variable name="role">
576cdf0e10cSrcweir		<xsl:choose>
577cdf0e10cSrcweir			<xsl:when test="ancestor::table">
578cdf0e10cSrcweir				<xsl:value-of select="concat(@role,'intable')"/>
579cdf0e10cSrcweir			</xsl:when>
580cdf0e10cSrcweir			<xsl:otherwise>
581cdf0e10cSrcweir				<xsl:value-of select="@role"/>
582cdf0e10cSrcweir			</xsl:otherwise>
583cdf0e10cSrcweir		</xsl:choose>
584cdf0e10cSrcweir	</xsl:variable>
585cdf0e10cSrcweir	<p class="{$role}"><xsl:apply-templates /></p>
586cdf0e10cSrcweir</xsl:template>
587cdf0e10cSrcweir
588cdf0e10cSrcweir<!-- Insert "How to get Link" -->
589cdf0e10cSrcweir<xsl:template name="insert_howtoget">
590cdf0e10cSrcweir	<xsl:param name="linkhref" />
591cdf0e10cSrcweir	<xsl:variable name="archive" select="'shared'"/>
592*d41ee026Smseidel	<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
593cdf0e10cSrcweir	<xsl:variable name="tmp_doc" select="document($tmp_href)"/>
594cdf0e10cSrcweir	<table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0">
595cdf0e10cSrcweir		<tr>
596cdf0e10cSrcweir			<td>
597cdf0e10cSrcweir				<p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p>
598cdf0e10cSrcweir				<div class="howtogetbody">
599cdf0e10cSrcweir				<xsl:choose>
600cdf0e10cSrcweir					<xsl:when test="$linkhref = ''"> <!-- new style -->
601cdf0e10cSrcweir						<xsl:apply-templates/>
602cdf0e10cSrcweir					</xsl:when>
603cdf0e10cSrcweir					<xsl:otherwise> <!-- old style -->
604cdf0e10cSrcweir						<xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable>
605cdf0e10cSrcweir						<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>
606cdf0e10cSrcweir						<xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable>
607cdf0e10cSrcweir						<xsl:variable name="docum" select="document($href)"/>
608*d41ee026Smseidel
609cdf0e10cSrcweir						<xsl:call-template name="insertembed">
610cdf0e10cSrcweir							<xsl:with-param name="doc" select="$docum" />
611cdf0e10cSrcweir							<xsl:with-param name="anchor" select="$anc" />
612cdf0e10cSrcweir						</xsl:call-template>
613cdf0e10cSrcweir
614cdf0e10cSrcweir					</xsl:otherwise>
615*d41ee026Smseidel				</xsl:choose>
616cdf0e10cSrcweir				</div>
617cdf0e10cSrcweir			</td>
618cdf0e10cSrcweir		</tr>
619cdf0e10cSrcweir	</table>
620cdf0e10cSrcweir	<br/>
621cdf0e10cSrcweir</xsl:template>
622cdf0e10cSrcweir
623cdf0e10cSrcweir<!-- Create a link -->
624cdf0e10cSrcweir<xsl:template name="createlink">
625cdf0e10cSrcweir<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
626cdf0e10cSrcweir<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
627cdf0e10cSrcweir	<xsl:choose>
628*d41ee026Smseidel		<xsl:when test="starts-with(@href,'http://') or starts-with(@href,'https://')"> <!-- web links -->
629cdf0e10cSrcweir			<a href="{@href}"><xsl:apply-templates /></a>
630cdf0e10cSrcweir		</xsl:when>
631cdf0e10cSrcweir		<xsl:when test="contains(@href,'#')">
632cdf0e10cSrcweir			<xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable>
633cdf0e10cSrcweir			<xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable>
634cdf0e10cSrcweir			<a href="{$href}"><xsl:apply-templates /></a>
635cdf0e10cSrcweir		</xsl:when>
636cdf0e10cSrcweir		<xsl:otherwise>
637cdf0e10cSrcweir			<xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable>
638cdf0e10cSrcweir			<a href="{$href}"><xsl:apply-templates /></a>
639cdf0e10cSrcweir		</xsl:otherwise>
640cdf0e10cSrcweir	</xsl:choose>
641cdf0e10cSrcweir</xsl:template>
642cdf0e10cSrcweir
643cdf0e10cSrcweir<!-- Insert Note, Warning, or Tip -->
644cdf0e10cSrcweir<xsl:template name="insertnote">
645cdf0e10cSrcweir	<xsl:param name="type" /> <!-- note, tip, or warning -->
646cdf0e10cSrcweir	<xsl:variable name="imgsrc">
647cdf0e10cSrcweir		<xsl:choose>
648cdf0e10cSrcweir			<xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when>
649cdf0e10cSrcweir			<xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when>
650cdf0e10cSrcweir			<xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when>
651cdf0e10cSrcweir		</xsl:choose>
652cdf0e10cSrcweir	</xsl:variable>
653cdf0e10cSrcweir	<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable>
654cdf0e10cSrcweir	<xsl:variable name="alt">
655cdf0e10cSrcweir		<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable>
656cdf0e10cSrcweir		<xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable>
657cdf0e10cSrcweir		<xsl:variable name="doc" select="document($href)"/>
658cdf0e10cSrcweir		<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
659cdf0e10cSrcweir	</xsl:variable>
660cdf0e10cSrcweir	<div class="{$type}">
661cdf0e10cSrcweir		<table border="0" class="{$type}" cellspacing="0" cellpadding="5">
662cdf0e10cSrcweir			<tr>
663cdf0e10cSrcweir				<td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td>
664cdf0e10cSrcweir				<td><xsl:apply-templates /></td>
665cdf0e10cSrcweir			</tr>
666cdf0e10cSrcweir		</table>
667cdf0e10cSrcweir	</div>
668cdf0e10cSrcweir	<br/>
669cdf0e10cSrcweir</xsl:template>
670cdf0e10cSrcweir
671cdf0e10cSrcweir<!-- Insert a heading -->
672cdf0e10cSrcweir<xsl:template name="insertheading">
673cdf0e10cSrcweir	<xsl:param name="level" />
674cdf0e10cSrcweir	<xsl:param name="embedded" />
675cdf0e10cSrcweir	<xsl:text disable-output-escaping="yes">&lt;h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
676cdf0e10cSrcweir		<xsl:choose>
677cdf0e10cSrcweir			<xsl:when test="$embedded = 'yes'">
678cdf0e10cSrcweir				<xsl:apply-templates mode="embedded"/>
679cdf0e10cSrcweir			</xsl:when>
680cdf0e10cSrcweir			<xsl:otherwise>
681cdf0e10cSrcweir				<xsl:apply-templates />
682cdf0e10cSrcweir			</xsl:otherwise>
683cdf0e10cSrcweir		</xsl:choose>
684cdf0e10cSrcweir	<xsl:text disable-output-escaping="yes">&lt;/h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
685cdf0e10cSrcweir</xsl:template>
686cdf0e10cSrcweir
687cdf0e10cSrcweir<!-- Evaluate a case or caseinline switch -->
688cdf0e10cSrcweir<xsl:template name="insertcase">
689cdf0e10cSrcweir	<xsl:param name="embedded" />
690cdf0e10cSrcweir	<xsl:choose>
691cdf0e10cSrcweir		<xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
692cdf0e10cSrcweir			<xsl:if test="@select = $System">
693cdf0e10cSrcweir				<xsl:choose>
694cdf0e10cSrcweir					<xsl:when test="$embedded = 'yes'">
695cdf0e10cSrcweir						<xsl:apply-templates mode="embedded"/>
696cdf0e10cSrcweir					</xsl:when>
697cdf0e10cSrcweir					<xsl:otherwise>
698cdf0e10cSrcweir						<xsl:apply-templates />
699cdf0e10cSrcweir					</xsl:otherwise>
700cdf0e10cSrcweir				</xsl:choose>
701cdf0e10cSrcweir			</xsl:if>
702cdf0e10cSrcweir		</xsl:when>
703cdf0e10cSrcweir		<xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
704cdf0e10cSrcweir			<xsl:if test="@select = $appl">
705cdf0e10cSrcweir				<xsl:choose>
706cdf0e10cSrcweir					<xsl:when test="$embedded = 'yes'">
707cdf0e10cSrcweir						<xsl:apply-templates mode="embedded"/>
708cdf0e10cSrcweir					</xsl:when>
709cdf0e10cSrcweir					<xsl:otherwise>
710cdf0e10cSrcweir						<xsl:apply-templates />
711cdf0e10cSrcweir					</xsl:otherwise>
712cdf0e10cSrcweir				</xsl:choose>
713cdf0e10cSrcweir			</xsl:if>
714cdf0e10cSrcweir		</xsl:when>
715cdf0e10cSrcweir		<xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
716cdf0e10cSrcweir			<xsl:if test="@select = $distrib">
717cdf0e10cSrcweir				<xsl:choose>
718cdf0e10cSrcweir					<xsl:when test="$embedded = 'yes'">
719cdf0e10cSrcweir						<xsl:apply-templates mode="embedded"/>
720cdf0e10cSrcweir					</xsl:when>
721cdf0e10cSrcweir					<xsl:otherwise>
722cdf0e10cSrcweir						<xsl:apply-templates />
723cdf0e10cSrcweir					</xsl:otherwise>
724cdf0e10cSrcweir				</xsl:choose>
725cdf0e10cSrcweir			</xsl:if>
726cdf0e10cSrcweir		</xsl:when>
727cdf0e10cSrcweir	</xsl:choose>
728cdf0e10cSrcweir</xsl:template>
729cdf0e10cSrcweir
730cdf0e10cSrcweir<!-- Evaluate a default or defaultinline switch -->
731cdf0e10cSrcweir<xsl:template name="insertdefault">
732cdf0e10cSrcweir	<xsl:param name="embedded" />
733*d41ee026Smseidel
734cdf0e10cSrcweir	<xsl:choose>
735cdf0e10cSrcweir		<xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
736cdf0e10cSrcweir			<xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])">
737cdf0e10cSrcweir				<xsl:choose>
738cdf0e10cSrcweir					<xsl:when test="$embedded = 'yes'">
739cdf0e10cSrcweir						<xsl:apply-templates mode="embedded"/>
740cdf0e10cSrcweir					</xsl:when>
741cdf0e10cSrcweir					<xsl:otherwise>
742cdf0e10cSrcweir						<xsl:apply-templates />
743cdf0e10cSrcweir					</xsl:otherwise>
744cdf0e10cSrcweir				</xsl:choose>
745cdf0e10cSrcweir			</xsl:if>
746cdf0e10cSrcweir		</xsl:when>
747cdf0e10cSrcweir		<xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
748cdf0e10cSrcweir			<xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])">
749cdf0e10cSrcweir				<xsl:choose>
750cdf0e10cSrcweir					<xsl:when test="$embedded = 'yes'">
751cdf0e10cSrcweir						<xsl:apply-templates mode="embedded"/>
752cdf0e10cSrcweir					</xsl:when>
753cdf0e10cSrcweir					<xsl:otherwise>
754cdf0e10cSrcweir						<xsl:apply-templates />
755cdf0e10cSrcweir					</xsl:otherwise>
756cdf0e10cSrcweir				</xsl:choose>
757cdf0e10cSrcweir			</xsl:if>
758cdf0e10cSrcweir		</xsl:when>
759cdf0e10cSrcweir		<xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
760cdf0e10cSrcweir			<xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])">
761cdf0e10cSrcweir				<xsl:choose>
762cdf0e10cSrcweir					<xsl:when test="$embedded = 'yes'">
763cdf0e10cSrcweir						<xsl:apply-templates mode="embedded"/>
764cdf0e10cSrcweir					</xsl:when>
765cdf0e10cSrcweir					<xsl:otherwise>
766cdf0e10cSrcweir						<xsl:apply-templates />
767cdf0e10cSrcweir					</xsl:otherwise>
768cdf0e10cSrcweir				</xsl:choose>
769cdf0e10cSrcweir			</xsl:if>
770cdf0e10cSrcweir		</xsl:when>
771cdf0e10cSrcweir	</xsl:choose>
772cdf0e10cSrcweir</xsl:template>
773cdf0e10cSrcweir
774cdf0e10cSrcweir<!-- evaluate embeds -->
775cdf0e10cSrcweir<xsl:template name="insertembed">
776cdf0e10cSrcweir	<xsl:param name="doc" />
777cdf0e10cSrcweir	<xsl:param name="anchor" />
778cdf0e10cSrcweir	<!-- different embed targets (also falsely used embed instead embedvar) -->
779cdf0e10cSrcweir	<xsl:choose>
780cdf0e10cSrcweir		<xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name -->
781cdf0e10cSrcweir			<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
782cdf0e10cSrcweir		</xsl:when>
783cdf0e10cSrcweir		<xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name -->
784cdf0e10cSrcweir			<p class="embedded">
785cdf0e10cSrcweir				<xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/>
786cdf0e10cSrcweir			</p>
787cdf0e10cSrcweir		</xsl:when>
788cdf0e10cSrcweir		<xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name -->
789cdf0e10cSrcweir			<p class="embedded">
790cdf0e10cSrcweir				<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
791cdf0e10cSrcweir			</p>
792cdf0e10cSrcweir		</xsl:when>
793cdf0e10cSrcweir		<xsl:otherwise> <!-- then give up -->
794*d41ee026Smseidel			<p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p>
795cdf0e10cSrcweir		</xsl:otherwise>
796cdf0e10cSrcweir	</xsl:choose>
797cdf0e10cSrcweir</xsl:template>
798cdf0e10cSrcweir
799cdf0e10cSrcweir<!-- Insert an image -->
800cdf0e10cSrcweir<xsl:template name="insertimage">
801*d41ee026Smseidel
802cdf0e10cSrcweir	<xsl:variable name="fpath">
803cdf0e10cSrcweir		<xsl:call-template name="getfpath">
804cdf0e10cSrcweir			<xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
805cdf0e10cSrcweir		</xsl:call-template>
806cdf0e10cSrcweir	</xsl:variable>
807*d41ee026Smseidel
808cdf0e10cSrcweir	<xsl:variable name="fname">
809cdf0e10cSrcweir		<xsl:call-template name="getfname">
810cdf0e10cSrcweir			<xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
811cdf0e10cSrcweir		</xsl:call-template>
812cdf0e10cSrcweir	</xsl:variable>
813cdf0e10cSrcweir
814*d41ee026Smseidel	<xsl:variable name="src">
815*d41ee026Smseidel		<xsl:choose>
816*d41ee026Smseidel			<xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)">
817*d41ee026Smseidel				<xsl:value-of select="concat($ExtensionPath,'/',@src)"/>
818*d41ee026Smseidel			</xsl:when>
819*d41ee026Smseidel			<xsl:otherwise>
820*d41ee026Smseidel				<xsl:choose>
821*d41ee026Smseidel					<xsl:when test="(@localize='true') and not($lang='en-US')">
822*d41ee026Smseidel						<xsl:value-of select="concat($img_url_prefix,$fpath,$lang,'/',$fname)"/>
823*d41ee026Smseidel					</xsl:when>
824*d41ee026Smseidel					<xsl:otherwise>
825*d41ee026Smseidel						<xsl:value-of select="concat($img_url_prefix,$fpath,$fname)"/>
826*d41ee026Smseidel					</xsl:otherwise>
827*d41ee026Smseidel				</xsl:choose>
828*d41ee026Smseidel			</xsl:otherwise>
829*d41ee026Smseidel		</xsl:choose>
830*d41ee026Smseidel	</xsl:variable>
831*d41ee026Smseidel
832cdf0e10cSrcweir	<!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>-->
833cdf0e10cSrcweir	<xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
834cdf0e10cSrcweir	<xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size -->
835cdf0e10cSrcweir	<xsl:variable name="height" select="''"/><!-- Image don't all have the correct size -->
836cdf0e10cSrcweir	<img src="{$src}" alt="{$alt}" title="{$alt}">
837cdf0e10cSrcweir		<xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if>
838cdf0e10cSrcweir		<xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if>
839*d41ee026Smseidel	</img>
840cdf0e10cSrcweir</xsl:template>
841cdf0e10cSrcweir
842cdf0e10cSrcweir<!-- Insert a Table -->
843cdf0e10cSrcweir<xsl:template name="inserttable">
844cdf0e10cSrcweir	<xsl:variable name="imgsrc">	<!-- see if we are in an image table -->
845cdf0e10cSrcweir		<xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
846cdf0e10cSrcweir	</xsl:variable>
847*d41ee026Smseidel
848cdf0e10cSrcweir	<xsl:choose>
849*d41ee026Smseidel
850cdf0e10cSrcweir		<xsl:when test="count(descendant::tablecell)=1">
851cdf0e10cSrcweir			<table border="0" class="onecell" cellpadding="0" cellspacing="0">
852cdf0e10cSrcweir				<xsl:apply-templates />
853cdf0e10cSrcweir		 </table>
854cdf0e10cSrcweir		</xsl:when>
855*d41ee026Smseidel
856cdf0e10cSrcweir		<xsl:when test="descendant::tablecell[1]/descendant::image">
857cdf0e10cSrcweir			<table border="0" class="icontable" cellpadding="5" cellspacing="0">
858cdf0e10cSrcweir				<xsl:apply-templates mode="icontable"/>
859cdf0e10cSrcweir		 </table>
860cdf0e10cSrcweir		</xsl:when>
861*d41ee026Smseidel
862cdf0e10cSrcweir		<xsl:when test="@class='wide'">
863cdf0e10cSrcweir			<table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
864cdf0e10cSrcweir				<xsl:apply-templates />
865cdf0e10cSrcweir		 </table>
866cdf0e10cSrcweir		</xsl:when>
867*d41ee026Smseidel
868cdf0e10cSrcweir		<xsl:when test="not(@class='')">
869cdf0e10cSrcweir			<table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
870cdf0e10cSrcweir				<xsl:apply-templates />
871cdf0e10cSrcweir		 </table>
872cdf0e10cSrcweir		</xsl:when>
873*d41ee026Smseidel
874cdf0e10cSrcweir		<xsl:otherwise>
875cdf0e10cSrcweir			<table border="1" class="border" cellpadding="0" cellspacing="0" >
876cdf0e10cSrcweir				<xsl:apply-templates />
877cdf0e10cSrcweir		 </table>
878cdf0e10cSrcweir		</xsl:otherwise>
879cdf0e10cSrcweir	</xsl:choose>
880*d41ee026Smseidel
881cdf0e10cSrcweir	<br/>
882cdf0e10cSrcweir</xsl:template>
883cdf0e10cSrcweir
884cdf0e10cSrcweir<xsl:template name="resolveembed">
885cdf0e10cSrcweir	<div class="embedded">
886cdf0e10cSrcweir		<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
887cdf0e10cSrcweir		<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
888cdf0e10cSrcweir		<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
889cdf0e10cSrcweir		<xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
890cdf0e10cSrcweir		<xsl:variable name="docum" select="document($href)"/>
891*d41ee026Smseidel
892cdf0e10cSrcweir		<xsl:call-template name="insertembed">
893cdf0e10cSrcweir			<xsl:with-param name="doc" select="$docum" />
894cdf0e10cSrcweir			<xsl:with-param name="anchor" select="$anc" />
895cdf0e10cSrcweir		</xsl:call-template>
896cdf0e10cSrcweir
897cdf0e10cSrcweir	</div>
898cdf0e10cSrcweir</xsl:template>
899cdf0e10cSrcweir
900cdf0e10cSrcweir<xsl:template name="resolveembedvar">
901cdf0e10cSrcweir	<xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
902cdf0e10cSrcweir		<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
903cdf0e10cSrcweir		<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
904cdf0e10cSrcweir		<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
905cdf0e10cSrcweir		<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
906cdf0e10cSrcweir		<xsl:variable name="doc" select="document($href)"/>
907cdf0e10cSrcweir		<xsl:choose>
908cdf0e10cSrcweir			<xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name -->
909cdf0e10cSrcweir				<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
910cdf0e10cSrcweir			</xsl:when>
911cdf0e10cSrcweir			<xsl:otherwise> <!-- or give up -->
912*d41ee026Smseidel				<span class="bug">[<xsl:value-of select="@href"/> not found].</span>
913cdf0e10cSrcweir			</xsl:otherwise>
914cdf0e10cSrcweir		</xsl:choose>
915cdf0e10cSrcweir	</xsl:if>
916cdf0e10cSrcweir</xsl:template>
917cdf0e10cSrcweir
918cdf0e10cSrcweir<!-- Apply -->
919cdf0e10cSrcweir<xsl:template name="apply">
920cdf0e10cSrcweir	<xsl:param name="embedded" />
921cdf0e10cSrcweir	<xsl:choose>
922cdf0e10cSrcweir		<xsl:when test="$embedded = 'yes'">
923cdf0e10cSrcweir			<xsl:apply-templates mode="embedded"/>
924cdf0e10cSrcweir		</xsl:when>
925cdf0e10cSrcweir		<xsl:otherwise>
926cdf0e10cSrcweir			<xsl:apply-templates />
927cdf0e10cSrcweir		</xsl:otherwise>
928cdf0e10cSrcweir	</xsl:choose>
929cdf0e10cSrcweir</xsl:template>
930cdf0e10cSrcweir
931cdf0e10cSrcweir<xsl:template name="getfpath">
932cdf0e10cSrcweir	<xsl:param name="s"/>
933cdf0e10cSrcweir	<xsl:param name="p"/>
934cdf0e10cSrcweir	<xsl:choose>
935cdf0e10cSrcweir		<xsl:when test="contains($s,'/')">
936cdf0e10cSrcweir			<xsl:call-template name="getfpath">
937cdf0e10cSrcweir				<xsl:with-param name="p"><xsl:value-of select="concat($p,substring-before($s,'/'),'/')"/></xsl:with-param>
938cdf0e10cSrcweir				<xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
939cdf0e10cSrcweir			</xsl:call-template>
940cdf0e10cSrcweir		</xsl:when>
941cdf0e10cSrcweir		<xsl:otherwise>
942cdf0e10cSrcweir			<xsl:value-of select="$p"/>
943cdf0e10cSrcweir		</xsl:otherwise>
944cdf0e10cSrcweir	</xsl:choose>
945cdf0e10cSrcweir</xsl:template>
946cdf0e10cSrcweir
947cdf0e10cSrcweir<xsl:template name="getfname">
948cdf0e10cSrcweir	<xsl:param name="s"/>
949cdf0e10cSrcweir	<xsl:choose>
950cdf0e10cSrcweir		<xsl:when test="contains($s,'/')">
951cdf0e10cSrcweir			<xsl:call-template name="getfname">
952cdf0e10cSrcweir				<xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
953cdf0e10cSrcweir			</xsl:call-template>
954cdf0e10cSrcweir		</xsl:when>
955cdf0e10cSrcweir		<xsl:otherwise>
956cdf0e10cSrcweir			<xsl:value-of select="$s"/>
957cdf0e10cSrcweir		</xsl:otherwise>
958cdf0e10cSrcweir	</xsl:choose>
959cdf0e10cSrcweir</xsl:template>
960cdf0e10cSrcweir
961cdf0e10cSrcweir<xsl:template name="createDBpostfix">
962cdf0e10cSrcweir	<xsl:param name="archive"/>
963cdf0e10cSrcweir	<xsl:variable name="newDB">
964cdf0e10cSrcweir		<xsl:choose>
965cdf0e10cSrcweir			<xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when>
966cdf0e10cSrcweir			<xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise>
967cdf0e10cSrcweir		</xsl:choose>
968cdf0e10cSrcweir	</xsl:variable>
969cdf0e10cSrcweir	<xsl:value-of select="concat($am,'DbPAR=',$newDB)"/>
970cdf0e10cSrcweir</xsl:template>
971cdf0e10cSrcweir
972cdf0e10cSrcweir</xsl:stylesheet>
973