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