1<?xml version='1.0' encoding="UTF-8"?>
2
3<!--
4  FILTER FOR OPENOFFICE.ORG 2+
5  v2.0BETA7 - Sep 07 2009
6-->
7
8<xsl:stylesheet version="1.0"
9		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10		xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
11		xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
12		xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
13		xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
14		xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
15		xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
16		xmlns:xlink="http://www.w3.org/1999/xlink"
17		xmlns:dc="http://purl.org/dc/elements/1.1/"
18		xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
19		xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
20		xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
21		xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
22		xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
23		xmlns:math="http://www.w3.org/1998/Math/MathML"
24		xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
25		xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
26		xmlns:ooo="http://openoffice.org/2004/office"
27		xmlns:ooow="http://openoffice.org/2004/writer"
28		xmlns:oooc="http://openoffice.org/2004/calc"
29		xmlns:dom="http://www.w3.org/2001/xml-events"
30		xmlns:xforms="http://www.w3.org/2002/xforms"
31		xmlns:xsd="http://www.w3.org/2001/XMLSchema"
32		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"
33		exclude-result-prefixes="office meta table number dc fo xlink chart math script xsl draw svg dr3d form text style xsi xsd xforms dom oooc ooow ooo">
34
35<xsl:output method="xml" indent="no" omit-xml-declaration="no"  />
36<!--
37<xsl:output doctype-public="-//OpenOffice.org//Help Document//EN" />
38<xsl:output doctype-system="http://documentation.openoffice.org/xmlhelp.dtd" />
39//-->
40<xsl:strip-space elements="*" />
41<xsl:param name="imgroot" select="'default_images/'"/>
42
43<!--
44#############################################################################
45
46	StarOffice Help Format Output Filter Stylesheet - Jan 26, 2006
47	==================================================================
48	(c) 2004, Sun Microsystems, Inc. - FPE
49
50#############################################################################
51-->
52
53<!--
54######################################################
55META DATA
56######################################################
57-->
58<xsl:variable name="title" select="/office:document/office:meta/dc:title"/>
59<xsl:variable name="filename" select="/office:document/office:meta/dc:subject" />
60<xsl:variable name="path">
61	<xsl:call-template name="getpath">
62		<xsl:with-param name="file"><xsl:value-of select="$filename" /></xsl:with-param>
63	</xsl:call-template>
64</xsl:variable>
65<xsl:variable name="fileonly" select="substring-after($filename,$path)"/>
66<xsl:variable name="topic_id" select="/office:document/office:meta/meta:user-defined[@meta:name='ID']"/>
67<xsl:variable name="topic_indexer" select="/office:document/office:meta/meta:user-defined[@meta:name='Indexer']"/>
68<xsl:variable name="kw" select="/office:document/office:meta/meta:keywords/meta:keyword"/>
69
70<xsl:variable name="topic_status">
71	<xsl:choose>
72		<xsl:when test="contains('DRAFT FINAL PUBLISH STALLED DEPRECATED', $kw)">
73			<xsl:value-of select="$kw"/>
74		</xsl:when>
75		<xsl:otherwise>
76			<xsl:value-of select="''"/>
77		</xsl:otherwise>
78	</xsl:choose>
79</xsl:variable>
80
81<!-- REMOVED DUE TO PROBLEMS WITH CVS MERGE CONFLICTS
82<xsl:variable name="history_created" select="/office:document/office:meta/meta:user-defined[@meta:name='Created']"/>
83<xsl:variable name="history_created_date" select="/office:document/office:meta/meta:creation-date"/>
84<xsl:variable name="history_lastedited" select="/office:document/office:meta/meta:user-defined[@meta:name='Lastedited']"/>
85<xsl:variable name="history_lastedited_date" select="/office:document/office:meta/dc:date"/>
86//-->
87
88<!--
89######################################################
90DOCUMENT SKELETON
91######################################################
92-->
93<xsl:template match="/">
94
95	<helpdocument version="1.0">
96	<xsl:call-template name="lf"/>
97	<xsl:call-template name="licheader"/> <!-- inserts the license header -->
98	<xsl:call-template name="lf"/>
99	<meta>
100	<xsl:call-template name="lf"/>
101			<topic id="{$topic_id}">
102				<xsl:if test="not($topic_indexer = '')">
103					<xsl:attribute name="indexer"><xsl:value-of select="$topic_indexer"/></xsl:attribute>
104				</xsl:if>
105				<xsl:if test="not($topic_status = '')">
106					<xsl:attribute name="status"><xsl:value-of select="$topic_status"/></xsl:attribute>
107				</xsl:if>
108				<xsl:call-template name="lf"/>
109				<title xml-lang="en-US" id="tit"><xsl:value-of select="$title"/></title>
110				<xsl:call-template name="lf"/>
111				<filename><xsl:value-of select="$filename"/></filename>
112			<xsl:call-template name="lf"/>
113			</topic>
114			<!-- REMOVED DUE TO PROBLEMS WITH CVS MERGE CONFLICTS
115			<history>
116				<created date="{$history_created_date}"><xsl:value-of select="$history_created"/></created>
117				<lastedited date="{$history_lastedited_date}"><xsl:value-of select="$history_lastedited"/></lastedited>
118			</history>
119			//-->
120		<xsl:call-template name="lf"/>
121		</meta>
122		<xsl:call-template name="lf"/>
123		<body>
124			<xsl:apply-templates select="/office:document/office:body/office:text" />
125		<xsl:call-template name="lf"/>
126		</body>
127	<xsl:call-template name="lf"/>
128	</helpdocument>
129</xsl:template>
130
131
132<!--
133######################################################
134AHELP
135	 hid CDATA #REQUIRED
136   visibility (hidden | visible) #IMPLIED
137######################################################
138-->
139
140<xsl:template match="text:variable-set[@text:name='AHID_']">
141	<xsl:variable name="hid"><xsl:value-of select="substring-before(substring-after(.,'hid=&quot;'),'&quot;&gt;')"/></xsl:variable>
142	<xsl:text disable-output-escaping="yes">&lt;ahelp hid=&quot;</xsl:text>
143	<xsl:value-of select="$hid"/>
144	<xsl:text disable-output-escaping="yes">&quot; visibility=&quot;hidden&quot;&gt;</xsl:text>
145</xsl:template>
146
147<xsl:template match="text:variable-set[@text:name='AVIS_']">
148	<xsl:variable name="hid"><xsl:value-of select="substring-before(substring-after(.,'hid=&quot;'),'&quot;&gt;')"/></xsl:variable>
149	<xsl:text disable-output-escaping="yes">&lt;ahelp hid=&quot;</xsl:text>
150	<xsl:value-of select="$hid"/>
151	<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
152</xsl:template>
153
154<xsl:template match="text:variable-set[@text:name='_AHID']">
155	<xsl:text disable-output-escaping="yes">&lt;/ahelp&gt;</xsl:text>
156</xsl:template>
157
158<xsl:template match="text:variable-set[@text:name='_AVIS']">
159	<xsl:text disable-output-escaping="yes">&lt;/ahelp&gt;</xsl:text>
160</xsl:template>
161
162
163<!--
164######################################################
165ALT, SEE IMAGE
166  xml-lang CDATA #REQUIRED (is always en-US for the source)
167  id CDATA #REQUIRED
168  localize CDATA #IMPLIED
169######################################################
170-->
171
172<!--
173######################################################
174BODY, SEE HEADER
175  # localize CDATA #IMPLIED
176######################################################
177-->
178<xsl:template match="office:body">
179	<xsl:apply-templates />
180</xsl:template>
181
182<xsl:template match="office:text">
183	<xsl:apply-templates />
184</xsl:template>
185
186
187<!--
188######################################################
189BOOKMARK
190  branch CDATA #REQUIRED
191  xml-lang CDATA #REQUIRED (is always en-US for the source)
192  id CDATA #REQUIRED
193  localize CDATA #IMPLIED
194######################################################
195-->
196
197<xsl:template match="text:variable-set[@text:name='BOOKMARK_']">
198	<xsl:variable name="branch"><xsl:value-of select="substring-before(substring-after(.,'branch=&quot;'),'&quot;')"/></xsl:variable>
199	<xsl:variable name="id"><xsl:value-of select="substring-before(substring-after(.,'id=&quot;'),'&quot;')"/></xsl:variable>
200	<xsl:variable name="localize"><xsl:value-of select="substring-before(substring-after(.,'localize=&quot;'),'&quot;')"/></xsl:variable>
201	<xsl:text disable-output-escaping="yes">
202&lt;bookmark xml-lang="en-US" branch=&quot;</xsl:text><xsl:value-of select="$branch"/>
203	<xsl:text disable-output-escaping="yes">&quot; id=&quot;</xsl:text>
204	<xsl:value-of select="$id"/>
205	<xsl:if test="not($localize='')">
206	<xsl:text disable-output-escaping="yes">&quot; localize=&quot;</xsl:text>
207	<xsl:value-of select="$localize"/>
208	</xsl:if>
209	<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
210</xsl:template>
211
212<xsl:template match="text:variable-set[@text:name='BOOKMARK']">
213	<xsl:variable name="branch"><xsl:value-of select="substring-before(substring-after(.,'branch=&quot;'),'&quot;')"/></xsl:variable>
214	<xsl:variable name="id"><xsl:value-of select="substring-before(substring-after(.,'id=&quot;'),'&quot;')"/></xsl:variable>
215	<xsl:variable name="localize"><xsl:value-of select="substring-before(substring-after(.,'localize=&quot;'),'&quot;')"/></xsl:variable>
216	<xsl:text disable-output-escaping="yes">
217&lt;bookmark xml-lang="en-US" branch=&quot;</xsl:text><xsl:value-of select="$branch"/>
218	<xsl:text disable-output-escaping="yes">&quot; id=&quot;</xsl:text>
219	<xsl:value-of select="$id"/>
220	<xsl:if test="not($localize='')">
221	<xsl:text disable-output-escaping="yes">&quot; localize=&quot;</xsl:text>
222	<xsl:value-of select="$localize"/>
223	</xsl:if>
224	<xsl:text disable-output-escaping="yes">&quot;/&gt;</xsl:text>
225</xsl:template>
226
227
228<xsl:template match="text:variable-set[@text:name='_BOOKMARK']">
229	<xsl:text disable-output-escaping="yes">
230&lt;/bookmark&gt;</xsl:text>
231</xsl:template>
232
233<!--
234######################################################
235BOOKMARK_VALUE
236######################################################
237-->
238<xsl:template match="text:variable-set[@text:name='BOOKMARKVALUE']">
239	<xsl:call-template name="lf" />
240	<bookmark_value><xsl:apply-templates />	</bookmark_value>
241</xsl:template>
242
243<!--
244######################################################
245BR
246######################################################
247-->
248<xsl:template match="text:line-break">
249	<xsl:variable name="style">
250		<xsl:call-template name="getmasterstyle">
251			<xsl:with-param name="style">
252				<xsl:call-template name="getdisplayname">
253					<xsl:with-param name="style" select="ancestor::text:p/@text:style-name"/>
254				</xsl:call-template>
255			</xsl:with-param>
256		</xsl:call-template>
257	</xsl:variable>
258	<xsl:if test="not(starts-with($style,'hlp_aux_'))">
259		<br />
260	</xsl:if>
261</xsl:template>
262
263<!--
264######################################################
265CAPTION
266  o xml-lang CDATA #REQUIRED (is always en-US for the source)
267  + id CDATA #REQUIRED   (in parent elements)
268  + localize CDATA #IMPLIED (in parent elements)
269######################################################
270-->
271
272<!-- distinguish between table and image caption -->
273
274<xsl:template match="text:variable-set[@text:name='IMGCAPTION_']">
275	<xsl:variable name="id"><xsl:value-of select="substring-before(substring-after(.,'ID=&quot;'),'&quot;')"/></xsl:variable>
276	<xsl:variable name="localize"><xsl:value-of select="substring-before(substring-after(.,'LOCALIZE=&quot;'),'&quot;')"/></xsl:variable>
277	<xsl:text disable-output-escaping="yes">
278&lt;caption xml-lang="en-US" id=&quot;</xsl:text>
279	<xsl:value-of select="$id"/>
280	<xsl:if test="not($localize='')">
281	<xsl:text disable-output-escaping="yes">&quot; localize=&quot;</xsl:text>
282	<xsl:value-of select="$localize"/>
283	</xsl:if>
284	<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
285</xsl:template>
286
287<xsl:template match="text:variable-set[@text:name='_IMGCAPTION']">
288	<xsl:text disable-output-escaping="yes">&lt;/caption&gt;</xsl:text>
289</xsl:template>
290
291<!--
292######################################################
293CASE
294  select CDATA #REQUIRED
295######################################################
296-->
297
298<xsl:template match="text:variable-set[@text:name='CASE_']">
299	<xsl:variable name="select"><xsl:value-of select="substring-before(substring-after(.,'select=&quot;'),'&quot;')"/></xsl:variable>
300	<xsl:text disable-output-escaping="yes">
301&lt;case select=&quot;</xsl:text>
302	<xsl:value-of select="$select"/>
303	<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
304</xsl:template>
305
306<xsl:template match="text:variable-set[@text:name='_CASE']">
307<xsl:text disable-output-escaping="yes">
308&lt;/case&gt;</xsl:text>
309</xsl:template>
310
311
312<!--
313######################################################
314CASEINLINE
315  select CDATA #REQUIRED
316######################################################
317-->
318
319<xsl:template match="text:variable-set[@text:name='CASEINLINE_']">
320	<xsl:variable name="select"><xsl:value-of select="substring-before(substring-after(.,'select=&quot;'),'&quot;')"/></xsl:variable>
321	<xsl:text disable-output-escaping="yes">&lt;caseinline select=&quot;</xsl:text>
322	<xsl:value-of select="$select"/>
323	<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
324</xsl:template>
325
326<xsl:template match="text:variable-set[@text:name='_CASEINLINE']">
327<xsl:text disable-output-escaping="yes">
328&lt;/caseinline&gt;</xsl:text>
329</xsl:template>
330
331<!--
332######################################################
333COMMENT
334######################################################
335-->
336
337<xsl:template match="text:variable-set[@text:name='COMMENT_']">
338<xsl:text disable-output-escaping="yes">&lt;comment&gt;</xsl:text>
339</xsl:template>
340
341<xsl:template match="text:variable-set[@text:name='COMMENT']">
342<xsl:apply-templates />
343</xsl:template>
344
345<xsl:template match="text:variable-set[@text:name='_COMMENT']">
346<xsl:text disable-output-escaping="yes">&lt;/comment&gt;</xsl:text>
347</xsl:template>
348
349<!--
350######################################################
351CREATED,  SEE HEADER
352######################################################
353-->
354
355
356<!--
357######################################################
358DEFAULT
359######################################################
360-->
361
362<xsl:template match="text:variable-set[@text:name='DEFAULT_']">
363<xsl:text disable-output-escaping="yes">
364&lt;default&gt;</xsl:text>
365</xsl:template>
366
367<xsl:template match="text:variable-set[@text:name='_DEFAULT']">
368<xsl:text disable-output-escaping="yes">
369&lt;/default&gt;</xsl:text>
370</xsl:template>
371
372<!--
373######################################################
374DEFAULTINLINE
375######################################################
376-->
377
378<xsl:template match="text:variable-set[@text:name='DEFAULTINLINE_']">
379<xsl:text disable-output-escaping="yes">&lt;defaultinline&gt;</xsl:text>
380</xsl:template>
381
382<xsl:template match="text:variable-set[@text:name='_DEFAULTINLINE']">
383<xsl:text disable-output-escaping="yes">&lt;/defaultinline&gt;</xsl:text>
384</xsl:template>
385
386<!--
387######################################################
388EMBED
389	href CDATA #REQUIRED
390  role CDATA #IMPLIED
391  level CDATA #IMPLIED
392######################################################
393-->
394
395<xsl:template match="text:variable-set[@text:name='EMBED']">
396	<xsl:variable name="href"><xsl:value-of select="substring-before(substring-after(.,'href=&quot;'),'&quot;')"/></xsl:variable>
397	<xsl:variable name="role"><xsl:value-of select="substring-before(substring-after(.,'role=&quot;'),'&quot;')"/></xsl:variable>
398	<xsl:variable name="level"><xsl:value-of select="substring-before(substring-after(.,'level=&quot;'),'&quot;')"/></xsl:variable>
399
400	<embed href="{$href}">
401		<xsl:if test="not($role = '')"><xsl:attribute name="role"><xsl:value-of select="$role"/></xsl:attribute></xsl:if>
402		<xsl:if test="not($level = '')"><xsl:attribute name="level"><xsl:value-of select="$level"/></xsl:attribute></xsl:if>
403	</embed>
404</xsl:template>
405
406<!--
407######################################################
408EMBEDVAR
409 href CDATA #REQUIRED
410 markup (keep | ignore) #IMPLIED
411######################################################
412-->
413
414<xsl:template match="text:variable-set[@text:name='EMBEDVAR']">
415	<xsl:variable name="href"><xsl:value-of select="substring-before(substring-after(.,'var=&quot;'),'&quot;')"/></xsl:variable>
416	<xsl:variable name="markup"><xsl:value-of select="substring-before(substring-after(.,'markup=&quot;'),'&quot;')"/></xsl:variable>
417
418	<embedvar href="{$href}">
419		<xsl:if test="not($markup = '')"><xsl:attribute name="markup"><xsl:value-of select="$markup"/></xsl:attribute></xsl:if>
420	</embedvar>
421</xsl:template>
422
423<!--
424######################################################
425EMPH -> SEE TEXT:SPAN
426######################################################
427-->
428
429<!--
430######################################################
431FILENAME,  SEE HEADER
432######################################################
433-->
434
435<!--
436######################################################
437HELPDOCUMENT,  SEE HEADER
438  + version CDATA #REQUIRED
439######################################################
440-->
441
442<!--
443######################################################
444HISTORY,  SEE HEADER
445######################################################
446-->
447
448<!--
449######################################################
450IMAGE
451  src CDATA #REQUIRED
452  width CDATA #IMPLIED
453  height CDATA #IMPLIED
454  id CDATA #REQUIRED
455######################################################
456-->
457
458<xsl:template match="text:variable-set[@text:name='IMG_']">
459	<xsl:variable name="id">
460		<xsl:choose>
461			<xsl:when test="contains(following::draw:frame/@draw:name,' localize')">
462				<xsl:value-of select="substring-before(following::draw:frame/@draw:name,' ')"/>
463			</xsl:when>
464			<xsl:otherwise>
465				<xsl:value-of select="following::draw:frame/@draw:name"/>
466			</xsl:otherwise>
467		</xsl:choose>
468	</xsl:variable>
469
470	<xsl:variable name="width"><xsl:value-of select="following::draw:frame/@svg:width"/></xsl:variable>
471	<xsl:variable name="height"><xsl:value-of select="following::draw:frame/@svg:height"/></xsl:variable>
472
473
474	<xsl:variable name="localize">
475		<xsl:choose>
476			<xsl:when test="contains(following::draw:frame/@draw:name,' localize')">
477				<xsl:value-of select="substring-before(substring-after(following::draw:frame/@draw:name,'localize=&quot;'),'&quot;')"/>
478			</xsl:when>
479			<xsl:otherwise>
480				<xsl:value-of select="''"/>
481			</xsl:otherwise>
482		</xsl:choose>
483	</xsl:variable>
484
485	<xsl:variable name="src">
486		<xsl:choose>
487			<xsl:when test="contains(following::draw:frame/draw:image/@xlink:href,$imgroot)">
488				<xsl:value-of select="substring-after(following::draw:frame/draw:image/@xlink:href,$imgroot)"/>
489			</xsl:when>
490			<xsl:otherwise>
491				<xsl:value-of select="following::draw:frame/draw:image/@xlink:href"/>
492			</xsl:otherwise>
493		</xsl:choose>
494	</xsl:variable>
495
496
497	<xsl:text disable-output-escaping="yes">&lt;image id=&quot;</xsl:text><xsl:value-of select="$id"/><xsl:text disable-output-escaping="yes">&quot; src=&quot;</xsl:text><xsl:value-of select="$src"/>
498	<!--
499	<xsl:text disable-output-escaping="yes">&quot; width=&quot;</xsl:text>
500	<xsl:value-of select="$width"/>
501	<xsl:text disable-output-escaping="yes">&quot; height=&quot;</xsl:text>
502	<xsl:value-of select="$height"/>
503	//-->
504	<xsl:if test="$localize != ''">
505		<xsl:text disable-output-escaping="yes">&quot; localize=&quot;</xsl:text><xsl:value-of select="$localize"/>
506	</xsl:if>
507	<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
508
509	<xsl:variable name="altid"><xsl:value-of select="concat('alt_',substring-after($id,'img_'))"/></xsl:variable>
510		<xsl:choose>
511			<xsl:when test="following::draw:frame/svg:title">  <!-- fixed, changed svg:desc to svg:title -->
512
513				<alt xml-lang="en-US" id="{$altid}">
514					<xsl:choose>
515						<xsl:when test="starts-with(following::draw:frame/svg:title,'LOCALIZE=')">
516							<xsl:attribute name="localize">
517								<xsl:value-of select="substring-after(substring-before(following::draw:frame/svg:title,'#'),'LOCALIZE=')"/>
518							</xsl:attribute>
519							<xsl:value-of select="substring-after(following::draw:frame/svg:title,'#')"/>
520						</xsl:when>
521						<xsl:otherwise>
522							<xsl:value-of select="following::draw:frame/svg:title"/>
523						</xsl:otherwise>
524					</xsl:choose>
525				</alt>
526
527			</xsl:when>
528			<xsl:otherwise>
529				<alt xml-lang="en-US" id="{$altid}">
530					<xsl:value-of select="'{ENTER ALTERNATE DESCRIPTION HERE}'"/>
531				</alt>
532			</xsl:otherwise>
533		</xsl:choose>
534
535</xsl:template>
536
537<xsl:template match="text:variable-set[@text:name='_IMG']">
538	<xsl:text disable-output-escaping="yes">&lt;/image&gt;</xsl:text>
539</xsl:template>
540<!--
541######################################################
542ITEM -> SEE TEXT:SPAN
543  + type CDATA #REQUIRED
544######################################################
545-->
546
547<!--
548######################################################
549LASTEDITED,  SEE HEADER
550  + date CDATA #REQUIRED
551######################################################
552-->
553
554<!--
555######################################################
556LINK
557  + href CDATA #REQUIRED
558  + name CDATA #REQUIRED
559  + type CDATA #IMPLIED
560  + target CDATA #IMPLIED
561######################################################
562-->
563
564<xsl:template match="text:variable-set[@text:name='LINK_']">
565
566	<xsl:variable name="href">
567		<xsl:value-of select="substring-before(substring-after(.,'href=&quot;'),'&quot;')"/>
568	</xsl:variable>
569
570	<xsl:variable name="type">
571		<xsl:value-of select="substring-before(substring-after(.,'type=&quot;'),'&quot;')"/>
572	</xsl:variable>
573
574	<xsl:variable name="target">
575		<xsl:value-of select="substring-before(substring-after(.,'target=&quot;'),'&quot;')"/>
576	</xsl:variable>
577
578	<xsl:variable name="name">
579		<xsl:value-of select="substring-before(substring-after(.,'name=&quot;'),'&quot;')"/>
580	</xsl:variable>
581
582	<xsl:text disable-output-escaping="yes">&lt;link</xsl:text>
583	<xsl:value-of select="concat(' href=&quot;',$href,'&quot;')"/>
584	<xsl:if test="not($name = '')">
585		<xsl:value-of select="concat(' name=&quot;',$name,'&quot;')"/>
586	</xsl:if>
587	<xsl:if test="not($type = '')">
588			<xsl:value-of select="concat(' type=&quot;',$type,'&quot;')"/>
589	</xsl:if>
590	<xsl:if test="not($target = '')">
591			<xsl:value-of select="concat(' target=&quot;',$target,'&quot;')"/>
592	</xsl:if>
593	<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
594</xsl:template>
595
596<xsl:template match="text:variable-set[@text:name='_LINK']">
597	<xsl:text disable-output-escaping="yes">&lt;/link&gt;</xsl:text>
598</xsl:template>
599
600
601<!--
602######################################################
603LIST
604  + type CDATA #REQUIRED
605  + startwith CDATA #IMPLIED
606  # format (1 | i | I | a | A) #IMPLIED
607  # bullet (disc | circle | square) #IMPLIED
608  # localize CDATA #IMPLIED
609  # sorted (asc | desc) #IMPLIED
610######################################################
611-->
612<xsl:template match="text:list">
613<xsl:param name="stylename"><xsl:value-of select="@text:style-name"/></xsl:param>
614
615	<xsl:choose>
616	<!-- ORDERED LISTS -->
617	<xsl:when test="//text:list-style[@style:name=$stylename]/text:list-level-style-number[@text:level='1']"> <!-- fixed list bug -->
618	<xsl:text>
619</xsl:text>
620	<list type="ordered">
621
622		<xsl:variable name="liststyle">
623			<xsl:call-template name="getdisplayname">
624				<xsl:with-param name="style" select="@text:style-name"/>
625			</xsl:call-template>
626		</xsl:variable>
627
628		<xsl:variable name="startvalue">
629
630			<xsl:choose>
631
632				<xsl:when test="text:list-item[1]/@text:start-value">
633					<xsl:value-of select="text:list-item[1]/@text:start-value"/>
634				</xsl:when>
635
636				<xsl:when test="//text:list-style[@style:name=$liststyle]">
637					<xsl:value-of select="//text:list-style[@style:name=$liststyle]/text:list-level-style-number[@text:level='1']/@text:start-value"/>
638				</xsl:when>
639
640				<xsl:when test="@text:continue-numbering='true'">
641					<xsl:call-template name="getprevol">
642						<xsl:with-param name="node" select="."/>
643						<xsl:with-param name="nodepos" select="1"/>
644						<xsl:with-param name="ct" select="1"/>
645					</xsl:call-template>
646				</xsl:when>
647
648				<xsl:otherwise>
649					<xsl:value-of select="'1'"/>
650				</xsl:otherwise>
651			</xsl:choose>
652		</xsl:variable>
653
654	<xsl:if test="not($startvalue='1') and not($startvalue='')">
655			<xsl:attribute name="startwith">
656				<xsl:value-of select="$startvalue"/>
657			</xsl:attribute>
658		</xsl:if>
659
660		<xsl:apply-templates />
661	<xsl:text>
662</xsl:text>
663	</list>
664
665	</xsl:when>
666
667	<!-- UNORDERED LISTS -->
668	<xsl:when test="//text:list-style[@style:name=$stylename]/text:list-level-style-bullet[@text:level='1']"> <!-- fixed list bug -->
669
670	<xsl:call-template name="lf"/>
671	<list type="unordered">
672		<xsl:variable name="masterstyle">
673			<xsl:call-template name="getmasterstyle">
674				<xsl:with-param name="style"><xsl:value-of select="@style:name"/></xsl:with-param>
675			</xsl:call-template>
676		</xsl:variable>
677		<xsl:apply-templates />
678	</list>
679
680	</xsl:when>
681	<xsl:otherwise>
682	<list type="UNKNOWN TYPE">
683		<xsl:apply-templates />
684	</list>
685
686	</xsl:otherwise>
687	</xsl:choose>
688
689</xsl:template>
690
691
692<!--
693######################################################
694LISTITEM
695  # format (1 | i | I | a | A) #IMPLIED
696  # bullet (disc | circle | square) #IMPLIED
697  # localize CDATA #IMPLIED
698  # class CDATA #IMPLIED
699######################################################
700-->
701<xsl:template match="text:list-item">
702	<xsl:text>
703</xsl:text>
704	<listitem>
705		<xsl:apply-templates />
706	<xsl:text>
707</xsl:text>
708	</listitem>
709</xsl:template>
710
711<!--
712######################################################
713META, SEE HEADER
714######################################################
715-->
716
717<!--
718######################################################
719OBJECT
720  + type CDATA #REQUIRED
721  + id CDATA #REQUIRED
722  + data CDATA #REQUIRED
723  + height CDATA #IMPLIED
724  + width CDATA #IMPLIED
725######################################################
726-->
727
728<xsl:template match="text:variable-set[@text:name='OBJECT']">
729	<xsl:variable name="type">
730		<xsl:value-of select="substring-before(substring-after(.,'TYPE=&quot;'),'&quot;')"/>
731	</xsl:variable>
732	<xsl:variable name="id">
733		<xsl:value-of select="substring-before(substring-after(.,'ID=&quot;'),'&quot;')"/>
734	</xsl:variable>
735	<xsl:variable name="data">
736		<xsl:value-of select="substring-before(substring-after(.,'DATA=&quot;'),'&quot;')"/>
737	</xsl:variable>
738	<xsl:variable name="height">
739		<xsl:value-of select="substring-before(substring-after(.,'HEIGHT=&quot;'),'&quot;')"/>
740	</xsl:variable>
741	<xsl:variable name="width">
742		<xsl:value-of select="substring-before(substring-after(.,'WIDTH=&quot;'),'&quot;')"/>
743	</xsl:variable>
744
745	<object id="{$id}" type="{$type}" data="{$data}">
746		<xsl:if test="not($height = '')"><xsl:attribute name="height"><xsl:value-of select="$height" /></xsl:attribute></xsl:if>
747		<xsl:if test="not($width = '')"><xsl:attribute name="width"><xsl:value-of select="$width" /></xsl:attribute></xsl:if>
748	</object>
749
750</xsl:template>
751
752
753<!--
754######################################################
755PARAGRAPH
756  + role CDATA #REQUIRED
757  + level CDATA #IMPLIED
758  + id CDATA #REQUIRED
759  + l10n CDATA #REQUIRED
760  o xml-lang CDATA #REQUIRED (is always en-US for the source)
761  + oldref CDATA #IMPLIED
762  + localize CDATA #IMPLIED
763######################################################
764-->
765
766<xsl:template match="text:h | text:p">
767
768	<xsl:variable name="masterstyle">
769		<xsl:call-template name="getmasterstyle">
770			<xsl:with-param name="style">
771				<xsl:call-template name="getdisplayname">
772					<xsl:with-param name="style" select="@text:style-name"/>
773				</xsl:call-template>
774			</xsl:with-param>
775		</xsl:call-template>
776	</xsl:variable>
777
778
779	<xsl:variable name="role">
780		<xsl:choose>
781			<xsl:when test="name(.)='text:h'">
782				<xsl:value-of select="'heading'"/>
783			</xsl:when>
784			<xsl:otherwise>
785				<xsl:value-of select="substring-after($masterstyle,'hlp_')"/>
786			</xsl:otherwise>
787		</xsl:choose>
788	</xsl:variable>
789
790	<xsl:variable name="level">
791		<xsl:choose>
792			<xsl:when test="name(.)='text:h'">
793				<xsl:value-of select="@text:outline-level"/>
794			</xsl:when>
795			<xsl:otherwise>
796				<xsl:value-of select="''"/>
797			</xsl:otherwise>
798		</xsl:choose>
799	</xsl:variable>
800
801	<xsl:choose>
802	<xsl:when test="not(starts-with($masterstyle,'hlp_'))"/>
803	<xsl:when test="not(starts-with($masterstyle,'hlp_aux_') or ancestor::office:annotation or . = '')">
804
805
806		<xsl:variable name="id">
807			<xsl:choose>
808				<xsl:when test="(descendant::text:variable-set[@text:name='ID']/@text:display='none')">
809					 	<xsl:value-of select="descendant::text:variable-set[@text:name='ID']/@office:string-value"/>
810				</xsl:when>
811				<xsl:otherwise>
812					<xsl:value-of select="descendant::text:variable-set[@text:name='ID']"/>
813				</xsl:otherwise>
814			</xsl:choose>
815		</xsl:variable>
816
817
818		<xsl:variable name="localize">
819			<xsl:choose>
820				<xsl:when test="substring($id,string-length($id)-6)='_NOL10N'">
821					<xsl:value-of select="'FALSE'"/></xsl:when>
822				<xsl:otherwise><xsl:value-of select="'TRUE'"/></xsl:otherwise>
823			</xsl:choose>
824		</xsl:variable>
825
826		<xsl:variable name="real_id">
827			<xsl:choose>
828				<xsl:when test="$localize='TRUE'"><xsl:value-of select="$id"/></xsl:when>
829				<xsl:otherwise><xsl:value-of select="substring-before($id,'_NOL10N')"/></xsl:otherwise>
830			</xsl:choose>
831		</xsl:variable>
832
833
834		<!-- testing only, basic would need to be adjusted and also @xml:id is not visible in the UI
835		<xsl:variable name="id" select="@xml:id"/>
836		//-->
837
838		<!-- remove these, these are no longer needed. no l10n paragraphs should rather get no @xml:lang
839		<xsl:variable name="l10n">
840			<xsl:choose>
841				<xsl:when test="contains(descendant::text:variable-set[@text:name='ID'],'l10n')">
842					<xsl:value-of select="substring-before(substring-after(descendant::text:variable-set[@text:name='ID'],'l10n=&quot;'),'&quot;')"/>
843				</xsl:when>
844				<xsl:when test="(descendant::text:variable-set[@text:name='ID']='') or not(descendant::text:variable-set[@text:name='ID'])">
845					<xsl:value-of select="'NEW'"/>
846				</xsl:when>
847			</xsl:choose>
848		</xsl:variable>
849
850		<xsl:variable name="oldref">
851			<xsl:choose>
852				<xsl:when test="contains(descendant::text:variable-set[@text:name='ID'],'oldref')">
853					<xsl:value-of select="substring-before(substring-after(descendant::text:variable-set[@text:name='ID'],'oldref=&quot;'),'&quot;')"/>
854				</xsl:when>
855			</xsl:choose>
856		</xsl:variable>
857
858	//-->
859
860		<xsl:text>
861</xsl:text>
862		<paragraph id="{$real_id}" role="{$role}" xml-lang="en-US"><xsl:if test="$localize='FALSE'">
863				<xsl:attribute name="localize"><xsl:value-of select="'false'"/></xsl:attribute>
864			</xsl:if>
865			<xsl:if test="not($level = '')"><xsl:attribute name="level"><xsl:value-of select="$level" /></xsl:attribute></xsl:if><xsl:apply-templates /></paragraph>
866	</xsl:when>
867	<xsl:when test="$masterstyle='hlp_aux_tablecaption'"/>
868	<xsl:otherwise>
869		<xsl:apply-templates select="child::*"/>
870	</xsl:otherwise>
871	</xsl:choose>
872</xsl:template>
873
874
875<!--
876######################################################
877SECTION
878  + id CDATA #REQUIRED
879  + localize CDATA #IMPLIED
880######################################################
881-->
882<xsl:template match="text:section">
883	<xsl:variable name="id">
884		<xsl:choose>
885			<xsl:when test="contains(@text:name,'__NOLOCALIZE')">
886				<xsl:value-of select="substring-before(@text:name,'__NOLOCALIZE')"/>
887			</xsl:when>
888			<xsl:otherwise>
889				<xsl:value-of select="@text:name"/>
890			</xsl:otherwise>
891		</xsl:choose>
892	</xsl:variable>
893	<xsl:variable name="localize">
894		<xsl:if test="contains(@text:name,'__NOLOCALIZE')">
895			<xsl:value-of select="'false'"/>
896		</xsl:if>
897	</xsl:variable>
898	<xsl:text>
899</xsl:text>
900	<section id="{$id}">
901		<xsl:if test="not($localize='')">
902			<xsl:attribute name="localize">
903				<xsl:value-of select="$localize"/>
904			</xsl:attribute>
905		</xsl:if>
906		<xsl:apply-templates />
907		<xsl:text>
908</xsl:text>
909	</section>
910
911</xsl:template>
912
913
914<!--
915######################################################
916SORT
917  + order (asc | desc) #IMPLIED
918######################################################
919-->
920<xsl:template match="text:variable-set[@text:name='SORT_']">
921	<xsl:variable name="order">
922		<xsl:value-of select="substring-before(substring-after(.,'order=&quot;'),'&quot;')"/>
923	</xsl:variable>
924	<xsl:text disable-output-escaping="yes">
925&lt;sort</xsl:text>
926<xsl:if test="not($order = '')">
927<xsl:text disable-output-escaping="yes"> order=&quot;</xsl:text><xsl:value-of select="$order"/><xsl:text disable-output-escaping="yes">&quot;</xsl:text>
928</xsl:if>
929<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
930</xsl:template>
931
932<xsl:template match="text:variable-set[@text:name='_SORT']">
933	<xsl:text disable-output-escaping="yes">
934&lt;/sort&gt;</xsl:text>
935</xsl:template>
936
937<!--
938######################################################
939SWITCH
940  + select (sys | appl | distrib | target | lang | ver) #REQUIRED
941  + localize CDATA #IMPLIED
942######################################################
943-->
944
945<xsl:template match="text:variable-set[@text:name='SWITCH_']">
946	<xsl:variable name="select">
947		<xsl:value-of select="substring-before(substring-after(.,'select=&quot;'),'&quot;')"/>
948	</xsl:variable>
949	<xsl:variable name="localize">
950		<xsl:value-of select="substring-before(substring-after(.,'localize=&quot;'),'&quot;')"/>
951	</xsl:variable>
952	<xsl:text disable-output-escaping="yes">
953&lt;switch select=&quot;</xsl:text><xsl:value-of select="$select"/><xsl:text disable-output-escaping="yes">&quot;</xsl:text>
954	<xsl:if test="not($localize = '')">
955<xsl:text disable-output-escaping="yes"> localize=&quot;</xsl:text><xsl:value-of select="$localize"/><xsl:text disable-output-escaping="yes">&quot;</xsl:text>
956</xsl:if>
957<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
958</xsl:template>
959
960<xsl:template match="text:variable-set[@text:name='_SWITCH']">
961<xsl:text disable-output-escaping="yes">
962&lt;/switch&gt;</xsl:text>
963</xsl:template>
964
965<!--
966######################################################
967SWITCHINLINE
968  + select (sys | appl | distrib | target | ver | lang) #REQUIRED
969######################################################
970-->
971
972<xsl:template match="text:variable-set[@text:name='SWITCHINLINE_']">
973	<xsl:variable name="select">
974		<xsl:value-of select="substring-before(substring-after(.,'select=&quot;'),'&quot;')"/>
975	</xsl:variable>
976	<xsl:text disable-output-escaping="yes">&lt;switchinline select=&quot;</xsl:text><xsl:value-of select="$select"/><xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
977</xsl:template>
978
979<xsl:template match="text:variable-set[@text:name='_SWITCHINLINE']">
980<xsl:text disable-output-escaping="yes">&lt;/switchinline&gt;</xsl:text>
981</xsl:template>
982
983<!--
984######################################################
985TABLE
986  + name CDATA #IMPLIED
987  + width CDATA #IMPLIED
988  + height CDATA #IMPLIED
989  + unit CDATA #IMPLIED
990  + class CDATA #IMPLIED
991  + id CDATA #REQUIRED
992  + localize CDATA #IMPLIED
993######################################################
994-->
995<xsl:template match="table:table">
996	<xsl:variable name="id">
997		<xsl:value-of select="@table:name"/>
998	</xsl:variable>
999	<xsl:text>
1000</xsl:text>
1001
1002	<table id="{$id}">
1003
1004		<xsl:if test="following::text:p[1]//text:variable-set[@text:name='CAPTION_']">
1005			<xsl:variable name="capattr">
1006				<xsl:value-of select="following::text:p[2]//text:variable-set[@text:name='CAPTION_']"/>
1007			</xsl:variable>
1008			<xsl:variable name="capid">
1009				<xsl:value-of select="substring-before(substring-after($capattr,'ID=&quot;'),'&quot;')"/>
1010			</xsl:variable>
1011			<xsl:variable name="caplocalize">
1012				<xsl:value-of select="substring-before(substring-after($capattr,'LOCALIZE=&quot;'),'&quot;')"/>
1013			</xsl:variable>
1014
1015		</xsl:if>
1016
1017		<xsl:apply-templates />
1018	<xsl:text>
1019</xsl:text>
1020	</table>
1021
1022	<xsl:text>
1023</xsl:text>
1024</xsl:template>
1025
1026<!--
1027######################################################
1028TABLECELL
1029  + colspan CDATA #IMPLIED
1030  + rowspan CDATA #IMPLIED
1031  # width CDATA #IMPLIED
1032  # class CDATA #IMPLIED
1033  # unit CDATA #IMPLIED
1034  # localize CDATA #IMPLIED
1035######################################################
1036-->
1037<xsl:template match="table:table-cell">
1038	<xsl:variable name="colspan"><xsl:value-of select="@table:number-columns-spanned"/></xsl:variable>
1039	<xsl:variable name="rowspan"><xsl:value-of select="@table:number-rows-spanned"/></xsl:variable>
1040	<xsl:text>
1041</xsl:text>
1042	<tablecell>
1043		<xsl:if test="not($colspan='')"><xsl:attribute name="colspan"><xsl:value-of select="$colspan"/></xsl:attribute></xsl:if>
1044		<xsl:if test="not($rowspan='')"><xsl:attribute name="rowspan"><xsl:value-of select="$rowspan"/></xsl:attribute></xsl:if>
1045		<xsl:apply-templates />
1046		<xsl:text>
1047</xsl:text>
1048	</tablecell>
1049</xsl:template>
1050
1051<!--
1052######################################################
1053TABLEROW
1054  # height CDATA #IMPLIED
1055  # class CDATA #IMPLIED
1056  # unit CDATA #IMPLIED
1057  # localize CDATA #IMPLIED
1058######################################################
1059-->
1060<xsl:template match="table:table-row">
1061	<xsl:text>
1062</xsl:text>
1063	<tablerow>
1064		<xsl:apply-templates />
1065	<xsl:text>
1066</xsl:text>
1067	</tablerow>
1068</xsl:template>
1069
1070<!--
1071######################################################
1072TITLE,  SEE HEADER
1073  o xml-lang CDATA #REQUIRED (is always en-US for the source)
1074  o id CDATA #REQUIRED (is always tit for the title)
1075  # localize CDATA #IMPLIED
1076######################################################
1077-->
1078
1079<!--
1080######################################################
1081TOPIC,  SEE HEADER
1082  + id CDATA #REQUIRED
1083  + indexer (exclude | include) #IMPLIED
1084######################################################
1085-->
1086
1087<!--
1088######################################################
1089VARIABLE
1090  + id CDATA #REQUIRED
1091  + visibility (hidden | visible) #IMPLIED
1092######################################################
1093-->
1094<xsl:template match="text:variable-set[@text:name='VAR_']">
1095	<xsl:variable name="id">
1096		<xsl:value-of select="substring-before(substring-after(.,'ID=&quot;'),'&quot;')"/>
1097	</xsl:variable>
1098	<xsl:variable name="visibility">
1099		<xsl:value-of select="substring-before(substring-after(.,'VISIBILITY=&quot;'),'&quot;')"/>
1100	</xsl:variable>
1101
1102	<xsl:text disable-output-escaping="yes">&lt;variable id=&quot;</xsl:text><xsl:value-of select="$id"/>
1103<xsl:text disable-output-escaping="yes">&quot;</xsl:text>
1104<xsl:if test="not($visibility='')">
1105<xsl:text disable-output-escaping="yes"> visibility=&quot;</xsl:text>
1106<xsl:value-of select="$visibility"/>
1107<xsl:text disable-output-escaping="yes">&quot;</xsl:text>
1108</xsl:if>
1109<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
1110</xsl:template>
1111
1112<xsl:template match="text:variable-set[@text:name='_VAR']">
1113<xsl:text disable-output-escaping="yes">&lt;/variable&gt;</xsl:text></xsl:template>
1114
1115<!--
1116######################################################
1117text:span, covers EMPH and ITEM
1118######################################################
1119-->
1120
1121<xsl:template match="text:span">
1122
1123	<!-- no multiple spans allowed, only use the outmost span -->
1124	<xsl:choose>
1125		<xsl:when test="ancestor::text:span" >
1126			<xsl:apply-templates />
1127		</xsl:when>
1128		<xsl:otherwise>
1129
1130		<xsl:variable name="masterstyle">	<!-- this is to resolve automatic styles by the writer -->
1131			<xsl:call-template name="getmasterstyle">
1132				<xsl:with-param name="style">
1133					<xsl:call-template name="getdisplayname">
1134						<xsl:with-param name="style" select="@text:style-name"/>
1135					</xsl:call-template>
1136				</xsl:with-param>
1137			</xsl:call-template>
1138		</xsl:variable>
1139
1140		<xsl:choose>
1141			<xsl:when test="starts-with($masterstyle,'hlp_aux_')">
1142				<xsl:apply-templates />
1143			</xsl:when>
1144			<xsl:when test="not(starts-with($masterstyle,'hlp_'))"><emph><xsl:apply-templates/></emph></xsl:when>
1145			<xsl:when test="$masterstyle = 'hlp_emph'"><emph><xsl:apply-templates/></emph></xsl:when>
1146			<xsl:otherwise>
1147				<xsl:variable name="spanstyle"><xsl:value-of select="substring-after($masterstyle,'hlp_')"/></xsl:variable><item type="{$spanstyle}"><xsl:apply-templates /></item></xsl:otherwise>
1148		</xsl:choose>
1149
1150		</xsl:otherwise>
1151	</xsl:choose>
1152
1153
1154</xsl:template>
1155
1156
1157
1158<!-- the rest is removed -->
1159<xsl:template match="*" />
1160
1161<!--
1162######################################################
1163LICENSE HEADER
1164######################################################
1165-->
1166
1167<xsl:template name="licheader">
1168<xsl:text disable-output-escaping="yes">&lt;!--***********************************************************
1169 *
1170 * Licensed to the Apache Software Foundation (ASF) under one
1171 * or more contributor license agreements.  See the NOTICE file
1172 * distributed with this work for additional information
1173 * regarding copyright ownership.  The ASF licenses this file
1174 * to you under the Apache License, Version 2.0 (the
1175 * "License"); you may not use this file except in compliance
1176 * with the License.  You may obtain a copy of the License at
1177 *
1178 *   http://www.apache.org/licenses/LICENSE-2.0
1179 *
1180 * Unless required by applicable law or agreed to in writing,
1181 * software distributed under the License is distributed on an
1182 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1183 * KIND, either express or implied.  See the License for the
1184 * specific language governing permissions and limitations
1185 * under the License.
1186 *
1187 ***********************************************************--&gt;
1188 </xsl:text>
1189
1190	</xsl:template>
1191
1192
1193<xsl:template name="getmasterstyle">
1194	<xsl:param name="style"/>
1195	<xsl:choose>
1196		<xsl:when test="$style='hlp_default'">
1197			<xsl:value-of select="'hlp_paragraph'"/>
1198		</xsl:when>
1199		<xsl:when test="starts-with($style,'hlp_')">
1200			<xsl:value-of select="$style"/>
1201		</xsl:when>
1202		<xsl:otherwise>
1203			<xsl:variable name="masterstyle">
1204				<xsl:call-template name="getdisplayname">
1205					<xsl:with-param name="style">
1206						<xsl:value-of select="/office:document/office:automatic-styles/style:style[@style:name=$style]/@style:parent-style-name"/>
1207					</xsl:with-param>
1208				</xsl:call-template>
1209			</xsl:variable>
1210			<xsl:choose>
1211				<xsl:when test="$masterstyle=''">
1212				<xsl:choose>
1213					<xsl:when test="$style='hlp_default'">
1214						<xsl:value-of select="'hlp_paragraph'"/>
1215					</xsl:when>
1216					<xsl:when test="/office:document/office:styles/style:style[@style:name=$style]">
1217						<xsl:value-of select="$style"/>
1218					</xsl:when>
1219					<xsl:otherwise>
1220						<xsl:value-of select="''"/>
1221					</xsl:otherwise>
1222				</xsl:choose>
1223			</xsl:when>
1224			<xsl:otherwise>
1225				<xsl:choose>
1226					<xsl:when test="starts-with($masterstyle,'hlp_default')">
1227						<xsl:value-of select="'hlp_paragraph'"/>
1228					</xsl:when>
1229					<xsl:when test="starts-with($masterstyle,'hlp_')">
1230						<xsl:value-of select="$masterstyle"/>
1231					</xsl:when>
1232					<xsl:otherwise>
1233						<xsl:value-of select="'UNKNOWN'"/>		<!-- fallback -->
1234					</xsl:otherwise>
1235				</xsl:choose>
1236			</xsl:otherwise>
1237		</xsl:choose>
1238		</xsl:otherwise>
1239	</xsl:choose>
1240</xsl:template>
1241
1242<xsl:template name="string-replace">
1243	<xsl:param name="string"/>
1244	<xsl:param name="from"/>
1245	<xsl:param name="to"/>
1246	<xsl:choose>
1247		<xsl:when test="contains($string,$from)">
1248			<xsl:value-of select="substring-before($string,$from)"/>
1249			<xsl:value-of select="$to"/>
1250			<xsl:call-template name="string-replace">
1251				<xsl:with-param name="string" select="substring-after($string,$from)"/>
1252				<xsl:with-param name="from" select="$from"/>
1253				<xsl:with-param name="to" select="$to"/>
1254			</xsl:call-template>
1255		</xsl:when>
1256		<xsl:otherwise>
1257			<xsl:value-of select="$string"/>
1258		</xsl:otherwise>
1259	</xsl:choose>
1260</xsl:template>
1261
1262<xsl:template name="getpath">
1263	<xsl:param name="file" />
1264	<xsl:param name="path" />
1265	<xsl:choose>
1266		<xsl:when test="contains($file,'/')">
1267			<xsl:call-template name="getpath">
1268				<xsl:with-param name="file">
1269					<xsl:value-of select="substring-after($file,'/')"/>
1270				</xsl:with-param>
1271				<xsl:with-param name="path">
1272					<xsl:value-of select="concat($path,substring-before($file,'/'),'/')"/>
1273				</xsl:with-param>
1274			</xsl:call-template>
1275		</xsl:when>
1276		<xsl:otherwise>
1277			<xsl:value-of select="$path"/>
1278		</xsl:otherwise>
1279	</xsl:choose>
1280</xsl:template>
1281
1282<xsl:template name="getprevol">
1283		<xsl:param name="node"/>
1284		<xsl:param name="nodepos"/>
1285		<xsl:param name="ct"/>
1286		<xsl:choose>
1287			<xsl:when test="$node/preceding-sibling::text:list[$nodepos]/@text:continue-numbering">
1288				<xsl:call-template name="getprevol">
1289					<xsl:with-param name="node" select="$node"/>
1290					<xsl:with-param name="nodepos" select="$nodepos+1"/>
1291					<xsl:with-param name="ct" select="$ct + count($node/preceding-sibling::text:list[$nodepos]/text:list-item) + count($node/preceding-sibling::text:list[$nodepos]/text:list-header)"/>
1292				</xsl:call-template>
1293			</xsl:when>
1294			<xsl:otherwise>
1295				<xsl:value-of select="$ct + count($node/preceding-sibling::text:list[$nodepos]/text:list-item) + count($node/preceding-sibling::text:list[$nodepos]/text:list-header)"/>
1296			</xsl:otherwise>
1297		</xsl:choose>
1298	</xsl:template>
1299
1300<xsl:template name="getdisplayname">
1301	<xsl:param name="style"/>
1302	<xsl:choose>
1303		<xsl:when test="/office:document/office:styles/style:style[@style:name=$style]/@style:display-name">
1304			<xsl:value-of select="/office:document/office:styles/style:style[@style:name=$style]/@style:display-name"/>
1305		</xsl:when>
1306		<xsl:otherwise>
1307			<xsl:value-of select="$style"/>
1308		</xsl:otherwise>
1309	</xsl:choose>
1310
1311</xsl:template>
1312
1313<xsl:template name="lf">
1314<xsl:text disable-output-escaping="yes">
1315</xsl:text>
1316</xsl:template>
1317
1318</xsl:stylesheet>
1319