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