source: trunk/manual/odt2ipf.xsl@ 241

Last change on this file since 241 was 206, checked in by Ben Rietbroek, 8 years ago

Added the XSLT transformation-sheets [v1.1.1-testing]

o odt2ipf.xsl

This is the main transformation-sheet.
It transforms the ODT 'content.xml' to IPF-format which can be
compiled to INF-format using the Open Watcom IPFC-compiler.

o format.xsl

The ODT 'content.xml' file consists of one long line.
This transformation-sheet is used to create a readable version of
'content.xml' so it can be examined. Note that the original 1-line
version is used for the transformation.

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File size: 70.2 KB
RevLine 
[206]1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3###############################################################################
4# odt2ipf.xsl :: Transform an AOO ODT-document to an OS/2 INF-document #
5# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
6# This transformation-sheet takes the 'content.xml' file from an AOO Document #
7# and generates an '.ipf' document that can be compiled to an '.inf' document #
8# which can then be viewed with OS/2 (New)View. #
9###############################################################################
10-->
11
12<!--
13// The basic steps are the following:
14// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15// o Explode the ODT to a directory with UNZIP
16// o Transform 'content.xml' to '.ipf' with XSLTPROC
17// o Compile the '.ipf' to '.inf' with WIPFC
18-->
19
20<!--
21// About the ODT Document
22// ~~~~~~~~~~~~~~~~~~~~~~
23// The ODT-document is the source for both the PDF and the INF versions of the
24// AiR-BOOT Manual. It contains custom styles with the prefix 'ipf-' which are
25// used to style the document content. The custom 'ipf-*' styles are matched
26// by the XSL-templates defined in this transformation-sheet which then
27// generate IPF-markup. These custom 'ipf-*' styles exists for both paragraph
28// and character styles.
29//
30// It is mandatory to use the 'ipf-*' styles to have the markup be correctly
31// propagated to the IPF-document. So, using the 'bold-button' to make some
32// text bold will *not* propagate to the IPF-document. This is because
33// OpenOffice Writer uses _automatic_ styles derived from _builtin_ styles,
34// and these automatic names are generated on-the-fly.
35//
36// Using the custom 'ipf-*' styles will put the correct name in the tag, so
37// that the XSL-templates can match on them.
38//
39// For images, the IPF ':artwork' tag is used with the 'runin' modifier. While
40// this allows for more control of the spacing, it is sometimes necessary to
41// have a blank line in the ODT-document that does not get propagated to the
42// IPF-document. This can be done applying the 'Default' paragraph style in the
43// ODF-document, which is not an 'ipf-*' style and thus generates nothing.
44//
45// update.201710171232
46// Partially resolved the issue with automatic styles by tracking the parent
47// style and calling the corresponding match-template by name.
48-->
49
50<!--
51// About the XSLT Transformation
52// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53// The transformation is kept relatively simple with the sole purpose of
54// creating an INF-document with acceptable presentation and a layout that
55// mimics the layout of the PDF version. It is not the purpose of this
56// transformation to address the full capabilities of IPF-markup or the meta
57// content of an ODT-document.
58-->
59
60<!--
61// About Indentation
62// ~~~~~~~~~~~~~~~~~
63// This transformation-sheet does not use elaborate indentation.
64// The reason is that the output document is a flat-text document (.ipf) and
65// using indentation can propagate undesired white-space to the output document
66// depending on what processing is used.
67-->
68
69<!--
70// Conventions
71// ~~~~~~~~~~~
72// Match Templates have header-comments using '=='.
73// Named Templates have header-comments using '%%'.
74// The Main Match Template uses '@@' for its header-comment.
75-->
76
77<!--
78// IPF Colors
79// ~~~~~~~~~~
80// o default
81// o black
82// o blue
83// o red
84// o pink
85// o green
86// o cyan
87// o yellow
88// o neutral
89// o brown
90// o darkgray
91// o darkblue
92// o darkred
93// o darkpink
94// o darkgreen
95// o darkcyan
96// o palegray
97-->
98
99<!--
100:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
101:: Below is the actual start of the transformation-sheet. ::
102:: The namespaces are required to recognize the various OpenOffice tags. ::
103:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
104-->
105<xsl:transform
106version="1.0"
107id="53ec6dc0-05e3-4932-911a-d99c295fcf31"
108xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
109xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
110xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
111xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
112xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
113xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
114xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
115xmlns:xlink="http://www.w3.org/1999/xlink"
116xmlns:dc="http://purl.org/dc/elements/1.1/"
117xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
118xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
119xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
120xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
121xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
122xmlns:math="http://www.w3.org/1998/Math/MathML"
123xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
124xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
125xmlns:ooo="http://openoffice.org/2004/office"
126xmlns:ooow="http://openoffice.org/2004/writer"
127xmlns:oooc="http://openoffice.org/2004/calc"
128xmlns:dom="http://www.w3.org/2001/xml-events"
129xmlns:xforms="http://www.w3.org/2002/xforms"
130xmlns:xsd="http://www.w3.org/2001/XMLSchema"
131xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
132xmlns:rpt="http://openoffice.org/2005/report"
133xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
134xmlns:xhtml="http://www.w3.org/1999/xhtml"
135xmlns:grddl="http://www.w3.org/2003/g/data-view#"
136xmlns:tableooo="http://openoffice.org/2009/table"
137xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
138xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
139xmlns:css3t="http://www.w3.org/TR/css3-text/"
140>
141
142<!--
143// These are the parameters for this transformation-sheet and their default
144// values. These values can be overridden by passing parameters to XSLTPROC.
145// Example: xsltproc ~~stringparam doctitle "My Document Title"
146// (note: the ~~ above of course need to be two dashes)
147-->
148
149<xsl:param name="basename">airboot</xsl:param>
150<xsl:param name="doctitle">AiR-BOOT User Manual</xsl:param>
151<xsl:param name="toclevels">12</xsl:param>
152<xsl:param name="imgdirprefix">AiR-BOOT-Manual.odtx</xsl:param>
153
154<!--
155// Define some variables.
156-->
157<xsl:variable name="default-text-font">WarpSans</xsl:variable>
158<xsl:variable name="default-code-font">WarpSans</xsl:variable>
159<xsl:variable name="default-commands-font">WarpSans</xsl:variable>
160
161<!--
162// Define Output Parameters.
163-->
164<xsl:output
165method="text"
166version="1.0"
167encoding="utf-8"
168omit-xml-declaration="no"
169standalone="yes"
170indent="no"
171media-type="text/xml"
172/>
173
174
175<!--
176// This strips white-space between XML elements when processing the input
177// document. For ODT we don't want that because the XML content is a mixture
178// of nested elements most of which can have content. An example would be
179// 'span' tags inside 'p' tags where the 'span' tags are separated by spaces.
180// These spaces are actual content of the 'p' tag. Enabling the stripping of
181// spaces would remove these spaces and thus alter the textual content of the
182// 'p' tag. Stripping white-space has its use in other scenarios, removing
183// leading spaces when generating code for instance.
184// For ODT to IPF transformation we disable it by commenting out the directive.
185-->
186<!--
187<xsl:strip-space elements="*" />
188-->
189
190
191<!--
192===============================================================================
193== Handle unmatched tags
194== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195== When no template is found that matches an encountered tag, processing ends
196== up here. Nothing is emitted which has the effect that the tag is ignored.
197== The 'apply-templates' enables further processing, so that handled tags that
198== are children of unhandled tags do get processed. Because we use modes for
199== different processing paths, each path needs to have its own 'match-all'
200== template.
201===============================================================================
202-->
203
204<!-- Process default unhandled tags -->
205<xsl:template match="*">
206<!--
207<xsl:value-of select="name()" />
208-->
209<xsl:apply-templates />
210</xsl:template>
211
212<!-- Process unhandled tags for the 'center' processing path -->
213<xsl:template match="*" mode="center">
214<!--
215<xsl:value-of select="name()" />
216-->
217<xsl:apply-templates mode="center" />
218</xsl:template>
219
220<!-- Process unhandled tags for unordered lists -->
221<xsl:template match="*" mode="ul">
222<!--
223<xsl:value-of select="name()" />
224-->
225<xsl:apply-templates mode="ul" />
226</xsl:template>
227
228<!-- Process unhandled tags for ordered lists -->
229<xsl:template match="*" mode="ol">
230<!--
231<xsl:value-of select="name()" />
232-->
233<xsl:apply-templates mode="ol" />
234</xsl:template>
235
236
237
238<!--
239===============================================================================
240== Match Line Breaks
241== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242== This IPF-tag needs to be on a line of its own.
243== Because no 'xsl:text' embedding is used, the newlines after the template
244== opening and after the '.br' are emitted to the output. An line break is not
245== the same as an empty paragraph, which would emit a ':p.' tag resulting in
246== a blank line.
247===============================================================================
248-->
249<xsl:template match="text:line-break">
250.br
251<xsl:apply-templates/>
252</xsl:template>
253
254
255
256
257
258<!--
259===============================================================================
260== Match Heading
261== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262== This style is used for the first page of the manual.
263== Note that contrary to its name, it is not an OOo true heading-style because
264== it has no outline level, it is just a paragraph style. It is used to display
265== the text on the document title page aligned to the center. Center aligning
266== in IPF is not easy because '.ce' only operates on lines and cannot handle
267== tags and ':lines.' is broken because it emits trailing blank lines and
268== interprets newlines verbatim. A special ODT style in combination with
269== special 'mode="center"' templates is used to work around this.
270===============================================================================
271-->
272<xsl:template match="text:p[@text:style-name='Heading']">
273<xsl:text>:hp2.:color fc=darkgray.:font facename="Workplace Sans" size=40x40.</xsl:text>
274<xsl:apply-templates mode="center" />
275<xsl:text>:color fc=default.:font facename=default.:ehp2.</xsl:text>
276</xsl:template>
277
278
279
280<!--
281===============================================================================
282== Match Outline Level 1
283== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284== This template matches an ODT heading-style and uses the 'outline-level'
285== attribute to generate the corresponding IPF ':h?.' tag. This means it
286== accepts *any* ODT style which has an 'outline level' is defined.
287== For the ODT-document this style is used for TOC creation and for IPF this
288== style defines its place in the tree structure. Note that levels above 1
289== depend on the value of the ':docprof' marker, which is by default 'toc=12.'
290===============================================================================
291-->
292<xsl:template match="text:h[@text:outline-level='1']">
293<xsl:text>&#10;</xsl:text>
294<xsl:text>&#10;</xsl:text>
295<xsl:text>&#10;</xsl:text>
296<xsl:text>&#10;</xsl:text>
297<xsl:text>&#10;</xsl:text>
298.*__________________________________________________________________________[<xsl:value-of select="@text:outline-level"/>] |<xsl:value-of select="."/>|
299.*
300:h<xsl:value-of select="@text:outline-level"/>.<xsl:value-of select="."/>
301.*_____________________________________________________________________________
302:p.
303<!--
304:hp2.:color fc=darkblue.:font facename='<xsl:value-of select="$default-text-font"/>' size=17x17.<xsl:value-of select="."/>:font facename=default.:color fc=default.:ehp2.
305-->
306:color fc=darkblue.:font facename='WarpSans'.<xsl:value-of select="."/>:font facename=default.:color fc=default.
307</xsl:template>
308
309<!--
310===============================================================================
311== Match Outline Level 2 :: See level 1 for comments
312===============================================================================
313-->
314<xsl:template match="text:h[@text:outline-level='2']">
315<xsl:text>&#10;</xsl:text>
316<xsl:text>&#10;</xsl:text>
317<xsl:text>&#10;</xsl:text>
318.*==========================================================================[<xsl:value-of select="@text:outline-level"/>] |<xsl:value-of select="."/>|
319:h<xsl:value-of select="@text:outline-level"/>.<xsl:value-of select="."/>
320.*=============================================================================
321:p.
322<!--
323:hp2.:color fc=darkblue.:font facename='<xsl:value-of select="$default-text-font"/>' size=15x15.<xsl:value-of select="."/>:font facename=default.:color fc=default.:ehp2.
324-->
325:color fc=darkblue.:font facename='Helv' size=15x15.<xsl:value-of select="."/>:font facename=default.:color fc=default.
326</xsl:template>
327
328<!--
329===============================================================================
330== Match Outline Level 3 :: See level 1 for comments
331===============================================================================
332-->
333<xsl:template match="text:h[@text:outline-level='3']">
334<xsl:text>&#10;</xsl:text>
335<xsl:text>&#10;</xsl:text>
336<xsl:text>&#10;</xsl:text>
337.*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[<xsl:value-of select="@text:outline-level"/>] |<xsl:value-of select="."/>|
338:h<xsl:value-of select="@text:outline-level"/>.<xsl:value-of select="."/>
339.*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340:p.
341:hp2.:color fc=darkgray.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.<xsl:value-of select="."/>:font facename=default.:color fc=default.:ehp2.
342</xsl:template>
343
344<!--
345===============================================================================
346== Match Outline Level 4 :: See level 1 for comments
347===============================================================================
348-->
349<xsl:template match="text:h[@text:outline-level='4']">
350<xsl:text>&#10;</xsl:text>
351<xsl:text>&#10;</xsl:text>
352.*--------------------------------------------------------------------------[<xsl:value-of select="@text:outline-level"/>] |<xsl:value-of select="."/>|
353:h<xsl:value-of select="@text:outline-level"/>.<xsl:value-of select="."/>
354.*-----------------------------------------------------------------------------
355:p.
356:hp5.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.<xsl:value-of select="."/>:font facename=default.:ehp5.
357</xsl:template>
358
359<!--
360===============================================================================
361== Match Outline Level 5 :: See level 1 for comments
362===============================================================================
363-->
364<xsl:template match="text:h[@text:outline-level='5']">
365<xsl:text>&#10;</xsl:text>
366:h<xsl:value-of select="@text:outline-level"/>.<xsl:value-of select="."/>
367.***************************************************************************[<xsl:value-of select="@text:outline-level"/>] |<xsl:value-of select="."/>|
368:p.
369<!--
370:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.[ <xsl:value-of select="."/> ]:font facename=default.
371-->
372:color fc=darkblue.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.<xsl:value-of select="."/>:font facename=default.:color fc=default.
373</xsl:template>
374
375<!--
376===============================================================================
377== Match Outline Level 6 :: See level 1 for comments
378===============================================================================
379-->
380<xsl:template match="text:h[@text:outline-level='6']">
381<xsl:text>&#10;</xsl:text>
382:h<xsl:value-of select="@text:outline-level"/>.<xsl:value-of select="."/>
383.*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[<xsl:value-of select="@text:outline-level"/>] |<xsl:value-of select="."/>|
384:p.
385<!--
386:lm margin=5.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.| <xsl:value-of select="."/> |:font facename=default.:lm margin=default.
387-->
388<!--
389:lm margin=5.:color fc=darkblue.:font facename='default' size=14x14.:hp1.<xsl:value-of select="."/>:ehp1.:font facename=default.:color fc=default.:lm margin=default.
390-->
391:lm margin=5.:color fc=darkblue.:font facename='default' size=14x14.<xsl:value-of select="."/>:font facename=default.:color fc=default.:lm margin=default.
392</xsl:template>
393
394
395<!--
396===============================================================================
397== Match Topic Level 1
398== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
399== Sometimes we want the 'level 1' attributes but have IPF not see it as a new
400== section. That is what these 'topic' styles are for. They use the same
401== attributes as the corresponding 'outline' style but omit the ':h?' marker
402== and thus do not start a new section. Additionally, they have a name which is
403== used when resolving automatic styles.
404===============================================================================
405-->
406<xsl:template name="topic-level-1" match="text:p[@text:style-name='topic-level-1']">
407:p.
408<!--
409:hp2.:color fc=darkblue.:font facename='<xsl:value-of select="$default-text-font"/>' size=17x17.<xsl:value-of select="."/>:font facename=default.:color fc=default.:ehp2.
410-->
411:color fc=darkblue.:font facename='WarpSans'.<xsl:value-of select="."/>:font facename=default.:color fc=default.
412</xsl:template>
413
414<!--
415===============================================================================
416== Match Topic Level 2 :: See level 1 for comments
417===============================================================================
418-->
419<xsl:template name="topic-level-2" match="text:p[@text:style-name='topic-level-2']">
420:p.
421<!--
422:hp2.:color fc=darkblue.:font facename='<xsl:value-of select="$default-text-font"/>' size=15x15.<xsl:value-of select="."/>:font facename=default.:color fc=default.:ehp2.
423-->
424:color fc=darkblue.:font facename='Helv' size=15x15.<xsl:value-of select="."/>:font facename=default.:color fc=default.
425</xsl:template>
426
427<!--
428===============================================================================
429== Match Topic Level 3 :: See level 1 for comments
430===============================================================================
431-->
432<xsl:template name="topic-level-3" match="text:p[@text:style-name='topic-level-3']">
433:p.
434:hp2.:color fc=darkgray.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.<xsl:value-of select="."/>:font facename=default.:color fc=default.:ehp2.
435</xsl:template>
436
437<!--
438===============================================================================
439== Match Topic Level 4 :: See level 1 for comments
440===============================================================================
441-->
442<xsl:template name="topic-level-4" match="text:p[@text:style-name='topic-level-4']">
443:p.
444:hp5.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.<xsl:value-of select="."/>:font facename=default.:ehp5.
445</xsl:template>
446
447<!--
448===============================================================================
449== Match Topic Level 5 :: See level 1 for comments
450===============================================================================
451-->
452<xsl:template name="topic-level-5" match="text:p[@text:style-name='topic-level-5']">
453:p.
454:color fc=darkblue.:font facename='<xsl:value-of select="$default-text-font"/>' size=14x14.<xsl:value-of select="."/>:font facename=default.:color fc=default.
455</xsl:template>
456
457<!--
458===============================================================================
459== Match Topic Level 6 :: See level 1 for comments
460===============================================================================
461-->
462<xsl:template name="topic-level-6" match="text:p[@text:style-name='topic-level-6']">
463:p.
464:lm margin=5.:color fc=darkblue.:font facename='default' size=14x14.<xsl:value-of select="."/>:font facename=default.:color fc=default.:lm margin=default.
465</xsl:template>
466
467
468
469
470
471
472<!--
473===============================================================================
474== Match 'ipf-text-level-1'
475== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
476== The text in the outer most level usually describes what the chapter is
477== about. For this we do a slight increase in font size. The other levels
478== currently use the standard font, but this can be overridden. For this to
479== work, the text-body of the relevant level must have the 'ipf-text-level-?'
480== style. This stuff can be used to put more nuances related to levels.
481== These templates also have a name which is used to resolve automatic styles.
482===============================================================================
483-->
484<xsl:template name="ipf-text-level-1" match="text:p[@text:style-name='ipf-text-level-1']">
485:p.
486<xsl:call-template name="warpsans">
487<!--
488<xsl:call-template name="helv">
489-->
490<!--
491<xsl:with-param name="font-size">14x14</xsl:with-param>
492-->
493</xsl:call-template>
494</xsl:template>
495
496<!--
497===============================================================================
498== Match 'ipf-text-level-2' :: See 'ipf-text-level-1' for comments
499===============================================================================
500-->
501<xsl:template name="ipf-text-level-2" match="text:p[@text:style-name='ipf-text-level-2']">
502:p.
503<xsl:call-template name="warpsans"/>
504</xsl:template>
505
506<!--
507===============================================================================
508== Match 'ipf-text-level-3' :: See 'ipf-text-level-1' for comments
509===============================================================================
510-->
511<xsl:template name="ipf-text-level-3" match="text:p[@text:style-name='ipf-text-level-3']">
512:p.
513<xsl:call-template name="warpsans"/>
514</xsl:template>
515
516<!--
517===============================================================================
518== Match 'ipf-text-level-4' :: See 'ipf-text-level-1' for comments
519===============================================================================
520-->
521<xsl:template name="ipf-text-level-4" match="text:p[@text:style-name='ipf-text-level-4']">
522:p.
523<xsl:call-template name="warpsans"/>
524</xsl:template>
525
526<!--
527===============================================================================
528== Match 'ipf-text-level-5' :: See 'ipf-text-level-1' for comments
529===============================================================================
530-->
531<xsl:template name="ipf-text-level-5" match="text:p[@text:style-name='ipf-text-level-5']">
532.br
533<!--
534:color fc=neutral.
535-->
536:color fc=default.
537<xsl:call-template name="warpsans"/>
538:color fc=default.
539</xsl:template>
540
541<!--
542===============================================================================
543== Match 'ipf-text-level-6' :: See 'ipf-text-level-1' for comments
544===============================================================================
545-->
546<xsl:template name="ipf-text-level-6" match="text:p[@text:style-name='ipf-text-level-6']">
547.br
548:lm margin=5.
549<!--
550:color fc=neutral.
551-->
552:color fc=default.
553:hp1.
554<xsl:call-template name="ipf-default"/>
555:ehp1.
556:color fc=default.
557:lm margin=default.
558</xsl:template>
559
560
561
562
563<!--
564===============================================================================
565== Match 'ipf-text-body'
566===============================================================================
567-->
568<xsl:template name="ipf-text-body" match="text:p[@text:style-name='ipf-text-body']">
569:p.
570<xsl:call-template name="warpsans"/>
571</xsl:template>
572
573<!--
574===============================================================================
575== Match 'ipf-start-center'
576== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
577== This is a special ODT paragrah style that is used to trigger the ':lines.'
578== tag so subsequent text is centered in IPF. This is a workaround for the bug
579== where ':lines.' emits trailing blank lines, which would accumulate if the
580== ":lines.' tag would be used by every 'center' paragraph. This template has
581== a matching 'end' template with emits the ':elines.' tag ending centering.
582== In the ODT document these 'trigger' styles are at the beginning and the end
583== of the text to be centered.
584===============================================================================
585-->
586<xsl:template match="text:p[@text:style-name='ipf-start-center']">
587.*# START FORCING CENTERING
588:lines align=center.
589</xsl:template>
590
591<!--
592===============================================================================
593== Match 'ipf-text-body-centered'
594== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
595== The IPF ':lines.' tag is kinda broken because it emits spurious new lines.
596== IBM 'ipfc' has the problem and Open Watcom 'wipfc' is even worse.
597== Spurious new lines are generated after the ':elines.' end-tag, making it
598== unsuitable to center paragraphs without generating empty lines.
599== This cannot be solved directly by '.ce' because that tag only affects the
600== one line after it. And .ce is also broken because it also emits blank lines.
601== We'll have to find a workaround for this issue.
602==
603== Workaround:
604== Matching templates can have a user defined 'mode'. This kinda acts as a
605== selector when applying templates. To handle the centering, the IPF ':lines.'
606== tag is still used, but now it emitted when the special paragraph
607== 'ipf-start-center' is encountered. On the style 'ipf-text-centered',
608== a special named template 'warpsans-ce' is called which does the further
609== applying using the 'mode="center"' selector. A few matching templates,
610== like line-breaks and bold emppasis now have a 'mode="center" sibling.
611==
612== The title page of the ODT-document has an empty 'ipf-start-center' at the
613== start and an 'ipf-end-center', which emits ':elines.' near the end.
614== While this is fragile stuff, it solves the problem. Sometimes however,
615== invisible empty styles my be present, which requires cleaning-up the
616== relevant section by resetting styles to default, and then re-applying them.
617==
618== Anyway, the title page has a strictly tuned layout to make this work.
619===============================================================================
620-->
621<xsl:template match="text:p[@text:style-name='ipf-text-body-centered']">
622<!-- Use the special handler that uses 'mode="center" -->
623<xsl:call-template name="warpsans-ce" />
624</xsl:template>
625
626<!--
627===============================================================================
628== Match 'ipf-end-center'
629== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
630== This matches the special 'end centering' paragraph in the ODT document and
631== effectively ends the centering by emitting the ':eclines.' IPF-tag.
632===============================================================================
633-->
634<xsl:template match="text:p[@text:style-name='ipf-end-center']">
635<!--
636<xsl:text>&#10;</xsl:text>
637-->
638.*# END FORCING CENTERING
639:elines.
640</xsl:template>
641
642
643<!--
644===============================================================================
645== Match 'ipf-text-body-code'
646== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
647== When code-lines are inserted from a foreign source into the ODT-document,
648== each separate line usually ends up being a paragraph. When all the pasted
649== lines are selected and given 'ipf-text-body-code' as the paragraph-style,
650== then instead of the IPF ':p.'paragraph-marker, a regular '.br' is emitted.
651== This solves the problem of disproportional line-spacing for pasted code.
652== This template also works when the lines are itself not paragraphs but
653== separated by a soft line-break.
654===============================================================================
655-->
656<xsl:template match="text:p[@text:style-name='ipf-text-body-code']">
657.br
658<!--
659:font facename="Monotype Sans Duospace WT J" size=11x11.<xsl:apply-templates />:font facename=default.
660-->
661:font facename="Courier" size=11x11.<xsl:apply-templates />:font facename=default.
662</xsl:template>
663
664
665<!--
666===============================================================================
667== Match 'ipf-text-body-commands'
668== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
669== Like with the 'ipf-text-body-code' style, ':p.' IPF-markup is not generated
670== and instead '.br' is emitted.
671===============================================================================
672-->
673<xsl:template match="text:p[@text:style-name='ipf-text-body-commands']">
674.br
675<!--
676:font facename="Monotype Sans Duospace WT J" size=14x14.<xsl:apply-templates />:font facename=default.
677-->
678:font facename="Courier" size=11x11.<xsl:apply-templates />:font facename=default.
679</xsl:template>
680
681
682<!--
683===============================================================================
684== Match 'ipf-text-body-red'
685===============================================================================
686-->
687<xsl:template match="text:p[@text:style-name='ipf-text-body-red']">
688:p.
689<xsl:text>:color fc=red.</xsl:text>
690<xsl:call-template name="warpsans"/>
691<xsl:text>:color fc=default.</xsl:text>
692</xsl:template>
693
694
695
696
697
698
699<!--
700===============================================================================
701== Match 'text:s' which is used for leading (and trailing) spaces by ODT
702===============================================================================
703-->
704<xsl:template match="text:s">
705<xsl:apply-templates />
706</xsl:template>
707
708
709
710<!--
711===============================================================================
712== Match generic 'text:p' para-style
713== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
714== Because paragraph styles can get automatic names in an ODT-document,
715== these cannot be used to inject markup properties. To partially solve this
716== we track the '@style:parent-style-name' attribute and check if that matches
717== any of our 'topic-*' or 'ipf-*' styles. If so, then the corresponding
718== template is called. If the parent-style does not match one of our custom
719== styles the 'text:p' style is ignored.
720==
721== This is a dirty hack and will be improved in future versions of this
722== transform-sheet. Also note the inability of XSLT-1.0 to call a named
723== template using a variable-name. So we have to use 'xsl:choose' to call the
724== corresponding template.
725==
726== A possible solution to this problem might be to use EXSLT functions so that
727== it becomes possible to contruct a 'match-expression' by using the
728== 'parent-style' attribute directly.
729===============================================================================
730-->
731<xsl:template match="text:p">
732<xsl:variable name="csn" select="@text:style-name"/>
733<xsl:variable name="psn" select="/office:document-content/office:automatic-styles/style:style[@style:name=$csn]/@style:parent-style-name"/>
734<xsl:variable name="sub6" select="substring($psn,1,6)"/>
735<xsl:variable name="sub4" select="substring($psn,1,4)"/>
736.*# AUTOMATIC STYLE '<xsl:value-of select="@text:style-name"/>' ENCOUNTERED -- TRYING TO RESOLVE TO 'topic-*' or 'ipf-*' STYLE<xsl:text/>
737<xsl:choose>
738<xsl:when test="$sub6='topic-'">
739.*# STYLE '<xsl:value-of select="@text:style-name"/>' RESOLVED TO: '<xsl:value-of select="$psn" />'<xsl:text/>
740<xsl:choose>
741<xsl:when test="$psn='topic-level-1'"><xsl:call-template name="topic-level-1"/></xsl:when>
742<xsl:when test="$psn='topic-level-2'"><xsl:call-template name="topic-level-2"/></xsl:when>
743<xsl:when test="$psn='topic-level-3'"><xsl:call-template name="topic-level-3"/></xsl:when>
744<xsl:when test="$psn='topic-level-4'"><xsl:call-template name="topic-level-4"/></xsl:when>
745<xsl:when test="$psn='topic-level-5'"><xsl:call-template name="topic-level-5"/></xsl:when>
746<xsl:when test="$psn='topic-level-6'"><xsl:call-template name="topic-level-6"/></xsl:when>
747<xsl:otherwise>
748.*# TOPIC-STYLE ?? '<xsl:value-of select="$psn"/>' ??
749</xsl:otherwise>
750</xsl:choose>
751</xsl:when>
752<xsl:when test="$sub4='ipf-'">
753.*# STYLE '<xsl:value-of select="@text:style-name"/>' RESOLVED TO: '<xsl:value-of select="$psn" />'<xsl:text/>
754<xsl:choose>
755<xsl:when test="$psn='ipf-text-level-1'"><xsl:call-template name="ipf-text-level-1"/></xsl:when>
756<xsl:when test="$psn='ipf-text-level-2'"><xsl:call-template name="ipf-text-level-2"/></xsl:when>
757<xsl:when test="$psn='ipf-text-level-3'"><xsl:call-template name="ipf-text-level-3"/></xsl:when>
758<xsl:when test="$psn='ipf-text-level-4'"><xsl:call-template name="ipf-text-level-4"/></xsl:when>
759<xsl:when test="$psn='ipf-text-level-5'"><xsl:call-template name="ipf-text-level-5"/></xsl:when>
760<xsl:when test="$psn='ipf-text-level-6'"><xsl:call-template name="ipf-text-level-6"/></xsl:when>
761<xsl:otherwise>
762.*# IPF-STYLE ?? '<xsl:value-of select="$psn"/>' ??
763</xsl:otherwise>
764</xsl:choose>
765</xsl:when>
766<xsl:otherwise>
767.*# STYLE '<xsl:value-of select="@text:style-name"/>' COULD NOT BE RESOLVED, IGNORING STYLE
768<xsl:apply-templates />
769</xsl:otherwise>
770</xsl:choose>
771</xsl:template>
772
773
774
775<!--
776===============================================================================
777== Match generic 'text:span' char-style
778===============================================================================
779-->
780<!-- Standard Span -->
781<xsl:template match="text:span">
782<xsl:variable name="style-name" select="@text:style-name"/>
783<xsl:apply-templates />
784<!-- Span in Centered Text -->
785</xsl:template>
786<xsl:template match="text:span" mode="center">
787<xsl:variable name="style-name" select="@text:style-name"/>
788<xsl:apply-templates mode="center" />
789</xsl:template>
790
791
792
793
794
795
796
797<!--
798===============================================================================
799== Match generic 'text:tab' style
800===============================================================================
801-->
802<xsl:template match="text:tab">
803<xsl:apply-templates/>
804</xsl:template>
805
806<!--
807===============================================================================
808== Match generic 'text:soft-page-break' style
809===============================================================================
810-->
811<xsl:template match="text:soft-page-break">
812<xsl:apply-templates/>
813</xsl:template>
814
815<!--
816===============================================================================
817== Match generic 'text:a' style
818===============================================================================
819-->
820<xsl:template match="text:a">
821<xsl:apply-templates/>
822</xsl:template>
823
824
825
826
827
828<!--
829===============================================================================
830== Match generic 'draw:frame' style
831===============================================================================
832-->
833<xsl:template match="draw:frame">
834<xsl:apply-templates/>
835</xsl:template>
836
837<!--
838===============================================================================
839== Match generic 'draw:image' style
840===============================================================================
841-->
842<xsl:template match="draw:image">
843<xsl:param name="path"/>
844<xsl:text>:artwork name='</xsl:text>
845<xsl:value-of select="$imgdirprefix"/>
846<xsl:text>/</xsl:text>
847<xsl:value-of select="@xlink:href" /><xsl:text>.bmp</xsl:text>
848<xsl:text>' runin.</xsl:text>
849<xsl:apply-templates />
850</xsl:template>
851
852
853
854<!--
855===============================================================================
856== Match lists and list-items
857== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
858== These templates support IPF two-level list nesting.
859== A generic ODT list maps to a compact unordered list.
860== The custom 'ipf-?l?' ODT list styles traverse down a path corresponding to
861== the list type being ordered or unordered. This is accomplished with the
862== 'mode' selector.
863===============================================================================
864-->
865
866<!-- Match line-breaks -->
867<xsl:template match="text:line-break" mode="ul">
868.br
869</xsl:template>
870<xsl:template match="text:line-break" mode="ol">
871.br
872</xsl:template>
873
874<!-- Match spans -->
875<xsl:template match="text:span" mode="ul">
876<xsl:apply-templates mode="ul" />
877</xsl:template>
878<xsl:template match="text:span" mode="ol">
879<xsl:apply-templates mode="ol" />
880</xsl:template>
881
882<!-- Match paragraphs -->
883<xsl:template match="text:p" mode="ul">
884:li.<xsl:apply-templates mode="ul" />
885</xsl:template>
886<xsl:template match="text:p" mode="ol">
887:li.<xsl:apply-templates mode="ol" />
888</xsl:template>
889
890<!-- Match list items -->
891<xsl:template match="text:list-item" mode="ul">
892<xsl:apply-templates mode="ul" />
893</xsl:template>
894<xsl:template match="text:list-item" mode="ol">
895<xsl:apply-templates mode="ol" />
896</xsl:template>
897
898<!-- Match custom lists -->
899<xsl:template match="text:list[@text:style-name='ipf-ul']">
900:ul.<xsl:apply-templates mode="ul" />
901:eul.
902</xsl:template>
903<xsl:template match="text:list[@text:style-name='ipf-ulc']">
904:ul compact.<xsl:apply-templates mode="ul" />
905:eul.
906</xsl:template>
907<xsl:template match="text:list[@text:style-name='ipf-ol']">
908:ol.<xsl:apply-templates mode="ol" />
909:eol.
910</xsl:template>
911<xsl:template match="text:list[@text:style-name='ipf-olc']">
912:ol compact.<xsl:apply-templates mode="ol"/>
913:eol.
914</xsl:template>
915<xsl:template match="text:list" mode="ul">
916:ul compact.<xsl:apply-templates mode="ul"/>
917:eul.
918</xsl:template>
919<xsl:template match="text:list" mode="ol">
920:ol compact.<xsl:apply-templates mode="ol"/>
921:eol.
922</xsl:template>
923
924<!-- Match a generic list -->
925<xsl:template match="text:list">
926:ul compact.<xsl:apply-templates mode="ul"/>
927:eul.
928</xsl:template>
929
930
931<!--
932===============================================================================
933== Match the various IPF 'hp?' styles
934== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
935== These are meant to be span and thus charcter styles.
936== There is a template for each IPF 'hp?' style, an easier named alias, and
937== a variant for the "center" mode so they can also be used in text blocks
938== with the 'ipf-text-body-centered' paragraph style.
939===============================================================================
940-->
941
942<!-- Match 'ipf-hp1' ~~ italic -->
943<xsl:template match="text:span[@text:style-name='ipf-hp1']">
944<xsl:text>:hp1.</xsl:text><xsl:apply-templates/><xsl:text>:ehp1.</xsl:text>
945</xsl:template>
946<xsl:template match="text:span[@text:style-name='ipf-hp1']" mode="center">
947<xsl:text>:hp1.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp1.</xsl:text>
948</xsl:template>
949<!-- 'ipf-italic' alias -->
950<xsl:template match="text:span[@text:style-name='ipf-italic']">
951<xsl:text>:hp1.</xsl:text><xsl:apply-templates/><xsl:text>:ehp1.</xsl:text>
952</xsl:template>
953<xsl:template match="text:span[@text:style-name='ipf-italic']" mode="center">
954<xsl:text>:hp1.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp1.</xsl:text>
955</xsl:template>
956
957<!-- Match 'ipf-hp2' ~~ bold -->
958<xsl:template match="text:span[@text:style-name='ipf-hp2']">
959<xsl:text>:hp2.:color fc=darkgray.</xsl:text><xsl:apply-templates/><xsl:text>:color fc=default.:ehp2.</xsl:text>
960</xsl:template>
961<xsl:template match="text:span[@text:style-name='ipf-hp2']" mode="center">
962<xsl:text>:hp2.:color fc=darkgray.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:color fc=default.:ehp2.</xsl:text>
963</xsl:template>
964<!-- 'ipf-bold' alias -->
965<xsl:template match="text:span[@text:style-name='ipf-bold']">
966<xsl:text>:hp2.:color fc=darkgray.</xsl:text><xsl:apply-templates/><xsl:text>:color fc=default.:ehp2.</xsl:text>
967</xsl:template>
968<xsl:template match="text:span[@text:style-name='ipf-bold']" mode="center">
969<xsl:text>:hp2.:color fc=darkgray.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:color fc=default.:ehp2.</xsl:text>
970</xsl:template>
971
972<!-- Match 'ipf-hp3' ~~ bold italic -->
973<xsl:template match="text:span[@text:style-name='ipf-hp3']">
974<xsl:text>:hp3.:color fc=darkgray.</xsl:text><xsl:apply-templates/><xsl:text>:color fc=default.:ehp3.</xsl:text>
975</xsl:template>
976<xsl:template match="text:span[@text:style-name='ipf-hp3']" mode="center">
977<xsl:text>:hp3.:color fc=darkgray.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:color fc=default.:ehp3.</xsl:text>
978</xsl:template>
979<!-- 'ipf-bold-italic' alias -->
980<xsl:template match="text:span[@text:style-name='ipf-bold-italic']">
981<xsl:text>:hp3.:color fc=darkgray.</xsl:text><xsl:apply-templates/><xsl:text>:color fc=default.:ehp3.</xsl:text>
982</xsl:template>
983<xsl:template match="text:span[@text:style-name='ipf-bold-italic']" mode="center">
984<xsl:text>:hp3.:color fc=darkgray.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:color fc=default.:ehp3.</xsl:text>
985</xsl:template>
986
987<!-- Match 'ipf-hp4'~~ blue -->
988<xsl:template match="text:span[@text:style-name='ipf-hp4']">
989<xsl:text>:hp4.</xsl:text><xsl:apply-templates/><xsl:text>:ehp4.</xsl:text>
990</xsl:template>
991<xsl:template match="text:span[@text:style-name='ipf-hp4']" mode="center">
992<xsl:text>:hp4.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp4.</xsl:text>
993</xsl:template>
994<!-- 'ipf-blue' alias -->
995<xsl:template match="text:span[@text:style-name='ipf-blue']">
996<xsl:text>:hp4.</xsl:text><xsl:apply-templates/><xsl:text>:ehp4.</xsl:text>
997</xsl:template>
998<xsl:template match="text:span[@text:style-name='ipf-blue']" mode="center">
999<xsl:text>:hp4.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp4.</xsl:text>
1000</xsl:template>
1001
1002<!-- Match 'ipf-hp5' ~~ underline -->
1003<xsl:template match="text:span[@text:style-name='ipf-hp5']">
1004<xsl:text>:hp5.</xsl:text><xsl:apply-templates/><xsl:text>:ehp5.</xsl:text>
1005</xsl:template>
1006<xsl:template match="text:span[@text:style-name='ipf-hp5']" mode="center">
1007<xsl:text>:hp5.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp5.</xsl:text>
1008</xsl:template>
1009<!-- 'ipf-underline' alias -->
1010<xsl:template match="text:span[@text:style-name='ipf-underline']">
1011<xsl:text>:hp5.</xsl:text><xsl:apply-templates/><xsl:text>:ehp5.</xsl:text>
1012</xsl:template>
1013<xsl:template match="text:span[@text:style-name='ipf-underline']" mode="center">
1014<xsl:text>:hp5.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp5.</xsl:text>
1015</xsl:template>
1016
1017<!-- Match 'ipf-hp6' ~~ underline italic -->
1018<xsl:template match="text:span[@text:style-name='ipf-hp6']">
1019<xsl:text>:hp6.</xsl:text><xsl:apply-templates/><xsl:text>:ehp6.</xsl:text>
1020</xsl:template>
1021<xsl:template match="text:span[@text:style-name='ipf-hp6']" mode="center">
1022<xsl:text>:hp6.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp6.</xsl:text>
1023</xsl:template>
1024<!-- 'ipf-underline-italic alias -->
1025<xsl:template match="text:span[@text:style-name='ipf-underline-italic']">
1026<xsl:text>:hp6.</xsl:text><xsl:apply-templates/><xsl:text>:ehp6.</xsl:text>
1027</xsl:template>
1028<xsl:template match="text:span[@text:style-name='ipf-underline-italic']" mode="center">
1029<xsl:text>:hp6.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp6.</xsl:text>
1030</xsl:template>
1031
1032<!-- Match 'ipf-hp7' ~~ underline bold -->
1033<xsl:template match="text:span[@text:style-name='ipf-hp7']">
1034<xsl:text>:hp7.:color fc=darkgray.</xsl:text><xsl:apply-templates/><xsl:text>:color fc=default.:ehp7.</xsl:text>
1035</xsl:template>
1036<xsl:template match="text:span[@text:style-name='ipf-hp7']" mode="center">
1037<xsl:text>:hp7.:color fc=darkgray.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:color fc=default.:ehp7.</xsl:text>
1038</xsl:template>
1039<!-- 'ipf-underline-bold' alias -->
1040<xsl:template match="text:span[@text:style-name='ipf-underline-bold']">
1041<xsl:text>:hp7.:color fc=darkgray.</xsl:text><xsl:apply-templates/><xsl:text>:color fc=default.:ehp7.</xsl:text>
1042</xsl:template>
1043<xsl:template match="text:span[@text:style-name='ipf-underline-bold']" mode="center">
1044<xsl:text>:hp7.:color fc=darkgray.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:color fc=default.:ehp7.</xsl:text>
1045</xsl:template>
1046
1047<!-- Match 'ipf-hp8' ~~ red -->
1048<xsl:template match="text:span[@text:style-name='ipf-hp8']">
1049<xsl:text>:hp8.</xsl:text><xsl:apply-templates/><xsl:text>:ehp8.</xsl:text>
1050</xsl:template>
1051<xsl:template match="text:span[@text:style-name='ipf-hp8']" mode="center">
1052<xsl:text>:hp8.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp8.</xsl:text>
1053</xsl:template>
1054<!-- 'ipf-red' alias -->
1055<xsl:template match="text:span[@text:style-name='ipf-red']">
1056<xsl:text>:hp8.</xsl:text><xsl:apply-templates/><xsl:text>:ehp8.</xsl:text>
1057</xsl:template>
1058<xsl:template match="text:span[@text:style-name='ipf-red']" mode="center">
1059<xsl:text>:hp8.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp8.</xsl:text>
1060</xsl:template>
1061
1062<!-- Match 'ipf-hp9' ~~ pink -->
1063<xsl:template match="text:span[@text:style-name='ipf-hp9']">
1064<xsl:text>:hp9.</xsl:text><xsl:apply-templates/><xsl:text>:ehp9.</xsl:text>
1065</xsl:template>
1066<xsl:template match="text:span[@text:style-name='ipf-hp9']" mode="center">
1067<xsl:text>:hp9.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp9.</xsl:text>
1068</xsl:template>
1069<!-- 'ipf-pink' alias -->
1070<xsl:template match="text:span[@text:style-name='ipf-pink']">
1071<xsl:text>:hp9.</xsl:text><xsl:apply-templates/><xsl:text>:ehp9.</xsl:text>
1072</xsl:template>
1073<xsl:template match="text:span[@text:style-name='ipf-pink']" mode="center">
1074<xsl:text>:hp9.</xsl:text><xsl:apply-templates mode="center"/><xsl:text>:ehp9.</xsl:text>
1075</xsl:template>
1076
1077<!--
1078===============================================================================
1079== Match the various IPF custom styles
1080== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1081== These are custom ODT character styles that map onto IPF ':color.' tags.
1082== This allows for some more variations and also 'softer' text by applying
1083== the 'neutral' color.
1084===============================================================================
1085-->
1086<!-- Match 'ipf-neutral' -->
1087<xsl:template match="text:span[@text:style-name='ipf-neutral']">
1088<xsl:text>:color fc=neutral.</xsl:text><xsl:apply-templates /><xsl:text>:color fc=default.</xsl:text>
1089</xsl:template>
1090<xsl:template match="text:span[@text:style-name='ipf-neutral']">
1091<xsl:text>:color fc=neutral.</xsl:text><xsl:apply-templates mode="center" /><xsl:text>:color fc=default.</xsl:text>
1092</xsl:template>
1093
1094
1095
1096<!--
1097===============================================================================
1098== This matches the textual content the ODT-document
1099== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1100== Now we are at the place we are interested in.
1101== Here are the style elements and their content, which are mainly heading
1102== and paragraph styles. Heading styles are going to be mapped to IPF ':h?.'
1103== tags and paragraph styles to IPF ':p.' tags. And we also process character
1104== styles we defined in the ODF to do highlighting and other emphasis.
1105==
1106== This is also the correct place to indert the IPF document-header and the
1107== IPF document-footer. In fact, the processing of this 'office:text' tag
1108== generated the whole IPF content.
1109===============================================================================
1110-->
1111<xsl:template match="office:text">
1112<!--
1113[<xsl:value-of select="name()" />]
1114-->
1115<xsl:call-template name="ipf-header"/>
1116<xsl:call-template name="ipf-initial-h1"/>
1117<!--
1118<xsl:call-template name="ipf-test-content"/>
1119<xsl:call-template name="inject-font-view"/>
1120-->
1121<xsl:apply-templates />
1122<xsl:call-template name="ipf-footer"/>
1123</xsl:template>
1124
1125
1126<!--
1127===============================================================================
1128== This matches the body the ODT-document
1129== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1130== This is an encapsulating element and we are only interested in processing
1131== its child 'office:text' which holds the true content.
1132===============================================================================
1133-->
1134<xsl:template match="office:body">
1135<!--
1136[<xsl:value-of select="name()" />]
1137-->
1138<xsl:apply-templates select="office:text" />
1139</xsl:template>
1140
1141
1142<!--
1143===============================================================================
1144== This matches the root-element of the ODT-document
1145== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1146== An ODT-document contains a whole lot more than just the textual content.
1147== We match to the root-element here to prepare for possible future extensions.
1148== For now, we are only interested in processing 'office:body' and its direct
1149== child 'office:text' which hold the true content.
1150===============================================================================
1151-->
1152<xsl:template match="office:document-content">
1153<!--
1154[<xsl:value-of select="name()" />]
1155-->
1156<xsl:apply-templates select="office:body" />
1157</xsl:template>
1158
1159
1160
1161
1162
1163<!--
1164:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1165 MATCHING TEMPLATES ARE DEFINED ABOVE
1166:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1167Such templates are usually closely related to the document being transformed.
1168If there is more that one template with the same matching criterium, the last
1169one processed is the one used. This is why the matching template for the
1170root-element is just above, so it can be overridden by placing an equal one
1171below it.
1172:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1173-->
1174
1175
1176<!--
1177@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1178@@
1179@@ MATCH THE DOCUMENT ROOT
1180@@ ____________________________________________________________________________
1181@@
1182@@ A match on '/' matches the *document-root* and not the *root-element*.
1183@@ This means there is no current node yet and everything emitted here would
1184@@ precede the content emitted by processing the root-element.
1185@@
1186@@ To have more control over over the general transformation, the real
1187@@ processing is delegated to a named template. This allows easy switching to
1188@@ another named template with different processing rules.
1189@@
1190@@ Named templates can be regarded as library templates.
1191@@ To separate the 'matching' part from the 'library' part, named templates
1192@@ are located *below* this initial matching of the document root.
1193@@
1194@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1195-->
1196<xsl:template match="/">
1197<xsl:call-template name="main" />
1198</xsl:template>
1199
1200
1201<!--
1202:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1203 NAMED TEMPLATES ARE DEFINED BELOW
1204:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1205Unlike matching templates, named templates do not nesseccarily relate to the
1206document being transformed. Some could perform generic actions, like string
1207manipulations on element content.
1208Also unlike matching templates, more that one named template with the same
1209name is an error, so there is no override concept for named templates.
1210Thus it is a good idea to use some kind of prefix for the name, to lower the
1211chance of name clashes.
1212:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1213-->
1214
1215
1216
1217
1218
1219<!--
1220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1221%% Main Proccessing Template
1222%% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1223%% Here we are still in the context of the document root.
1224%% While we could already emit the IPF-header here, this is not truly the
1225%% correct place. The correct place is when the 'office:text' tag is processed,
1226%% because that tag holds the ODT textual content.
1227%%
1228%% What we really do here is applying the specific 'office:document-content'
1229%% tag, which is the ODT root-element. This specific naming prevents spurious
1230%% output when a non-ODT document would be fed for transformation.
1231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1232-->
1233<xsl:template name="main">
1234<xsl:apply-templates select="office:document-content" />
1235</xsl:template>
1236
1237
1238<!--
1239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1240%% Header for the generated IPF document
1241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1242-->
1243<xsl:template name="ipf-header">.*!! GENERATED DOCUMENT !!
1244.*#############################################################################
1245.*# <xsl:value-of select="$basename"/>.ipf :: OS/2 Information Presentation Fascility Source
1246.*# ---------------------------------------------------------------------------
1247.*#
1248.*# This file is generated from the corresponding OpenOffice Document, which
1249.*# has custom paragraph and character style definitions. The overall document
1250.*# structure and custom styles are transformed to IPF markup by applying XSLT.
1251.*#
1252.*# The following steps are executed to create the final INF document:
1253.*#
1254.*# o The ODT is exploded using UNZIP
1255.*# o PNG images are converted to OS/2 BMP using GBM (gbmconv)
1256.*# o The file 'content.xml' is transformed to this 'airboot.ipf' by the
1257.*# transformation-sheet 'odt2ipf.xsl' using XSLTPROC
1258.*# o Finally, 'airboot.ipf' is compiled to 'airboot.inf' using WIPFC
1259.*#
1260.*#############################################################################
1261
1262
1263.*# Start the IPF Document
1264:userdoc.
1265:title.<xsl:value-of select="$doctitle"/>
1266:docprof toc=<xsl:value-of select="$toclevels"/>.
1267</xsl:template>
1268
1269
1270<!--
1271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1272%% Initial 'h1' for the generated IPF document
1273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1274-->
1275<xsl:template name="ipf-initial-h1">
1276.*# Initial Header
1277:h1.<xsl:value-of select="$doctitle"/>
1278.*# ___________________________________________________________________________
1279</xsl:template>
1280
1281
1282<!--
1283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1284%% Some content to test IPF compilation
1285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1286-->
1287<xsl:template name="ipf-test-content">
1288.*# Test Content
1289:p.Test Content
1290</xsl:template>
1291
1292
1293<!--
1294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295%% Footer for the generated IPF document
1296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297-->
1298<xsl:template name="ipf-footer">
1299.*# End the IPF Document
1300:euserdoc.
1301</xsl:template>
1302
1303<xsl:template match="*" mode="center">
1304<xsl:text>&#10;</xsl:text>
1305</xsl:template>
1306
1307<!--
1308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1309%% IPF Default
1310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1311-->
1312<xsl:template name="ipf-default">
1313<xsl:param name="font-size">14x14</xsl:param>
1314:font facename='default' size=<xsl:value-of select="$font-size"/>.
1315<xsl:apply-templates />
1316:font facename=default.
1317</xsl:template>
1318
1319<!--
1320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1321%% WarpSans
1322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1323-->
1324<xsl:template name="warpsans">
1325<xsl:param name="font-size">14x14</xsl:param>
1326:font facename='WarpSans' size=<xsl:value-of select="$font-size"/>.
1327<xsl:apply-templates />
1328:font facename=default.
1329</xsl:template>
1330
1331<xsl:template name="warpsans-ce">
1332<!--
1333<xsl:param name="font-size">14x14</xsl:param>
1334:font facename='WarpSans' size=<xsl:value-of select="$font-size"/>.
1335-->
1336<xsl:apply-templates mode="center" />
1337<!--
1338:font facename=default.
1339-->
1340</xsl:template>
1341
1342<!--
1343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1344%% Workplace Sans
1345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1346-->
1347<xsl:template name="workplace-sans">
1348<xsl:param name="font-size">15x15</xsl:param>
1349:font facename='Workplace Sans' size=<xsl:value-of select="$font-size"/>.
1350<xsl:apply-templates />
1351:font facename=default.
1352</xsl:template>
1353
1354<!--
1355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1356%% Arial
1357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1358-->
1359<xsl:template name="arial">
1360<xsl:param name="font-size">14x14</xsl:param>
1361:font facename='Arial' size=<xsl:value-of select="$font-size"/>.
1362<xsl:apply-templates />
1363:font facename=default.
1364</xsl:template>
1365
1366<!--
1367%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1368%% Helv
1369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1370-->
1371<xsl:template name="helv">
1372<xsl:param name="font-size">14x14</xsl:param>
1373:font facename='Helv' size=<xsl:value-of select="$font-size"/>.
1374<xsl:apply-templates />
1375:font facename=default.
1376</xsl:template>
1377
1378<!-- courier -->
1379<xsl:template name="courier">
1380:font facename="Monotype Sans Duospace WT J" size=11x11.
1381<xsl:apply-templates />
1382:font facename=default.
1383</xsl:template>
1384
1385
1386<!--
1387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1388%% Inject a bunch of fonts
1389%% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1390%% hp1 : italic
1391%% hp2 : bold
1392%% hp5 : underline
1393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1394-->
1395<xsl:template name="inject-fonts">
1396<xsl:param name="fontname">UNKNOWN FONT NAME</xsl:param>
1397<xsl:param name="string">This is a rendering test for font:</xsl:param>
1398.*#############################################################################
1399.*# Generated by XSLT-template "inject-fonts"
1400.*#############################################################################
1401.br
1402.br
1403:font facename="<xsl:value-of select="$fontname"/>" size=9x9.9 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1404.br
1405:font facename="<xsl:value-of select="$fontname"/>" size=10x10.10 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1406.br
1407:font facename="<xsl:value-of select="$fontname"/>" size=11x11.11 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1408.br
1409:font facename="<xsl:value-of select="$fontname"/>" size=12x12.12 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1410.br
1411:font facename="<xsl:value-of select="$fontname"/>" size=13x13.13 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1412.br
1413:font facename="<xsl:value-of select="$fontname"/>" size=14x14.14 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1414.br
1415:font facename="<xsl:value-of select="$fontname"/>" size=15x15.15 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1416.br
1417:font facename="<xsl:value-of select="$fontname"/>" size=16x16.16 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1418.br
1419:font facename="<xsl:value-of select="$fontname"/>" size=17x17.17 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1420.br
1421:font facename="<xsl:value-of select="$fontname"/>" size=18x18.18 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1422.br
1423:font facename="<xsl:value-of select="$fontname"/>" size=19x19.19 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1424.br
1425:font facename="<xsl:value-of select="$fontname"/>" size=20x20.20 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1426.br
1427:font facename="<xsl:value-of select="$fontname"/>" size=21x21.21 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1428.br
1429:font facename="<xsl:value-of select="$fontname"/>" size=22x22.22 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1430.br
1431:font facename="<xsl:value-of select="$fontname"/>" size=23x23.23 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1432.br
1433:font facename="<xsl:value-of select="$fontname"/>" size=24x24.24 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1434.br
1435.*#:font facename="<xsl:value-of select="$fontname"/>" size=25x25.25 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1436.*#.br
1437.*#:font facename="<xsl:value-of select="$fontname"/>" size=26x26.26 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1438.*#.br
1439.*#:font facename="<xsl:value-of select="$fontname"/>" size=27x27.27 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1440.*#.br
1441.*#:font facename="<xsl:value-of select="$fontname"/>" size=28x28.28 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1442.*#.br
1443.*#:font facename="<xsl:value-of select="$fontname"/>" size=29x29.29 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1444.*#.br
1445.*#:font facename="<xsl:value-of select="$fontname"/>" size=30x30.30 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1446.*#.br
1447.*#:font facename="<xsl:value-of select="$fontname"/>" size=31x31.31 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1448.*#.br
1449.*#:font facename="<xsl:value-of select="$fontname"/>" size=32x32.32 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1450.*#.br
1451.*#:font facename="<xsl:value-of select="$fontname"/>" size=33x33.33 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1452.*#.br
1453.*#:font facename="<xsl:value-of select="$fontname"/>" size=34x34.34 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1454.*#.br
1455.*#:font facename="<xsl:value-of select="$fontname"/>" size=35x35.35 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1456.*#.br
1457.*#:font facename="<xsl:value-of select="$fontname"/>" size=36x36.36 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1458.*#.br
1459.*#:font facename="<xsl:value-of select="$fontname"/>" size=37x37.37 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1460.*#.br
1461.*#:font facename="<xsl:value-of select="$fontname"/>" size=38x38.38 <xsl:value-of select='$string'/>:hp2.<xsl:value-of select="$fontname"/> !!:ehp2.:font facename=default.
1462.*#.br
1463</xsl:template>
1464
1465
1466
1467
1468
1469
1470<!--
1471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1472%% Inject Fonts for Testing
1473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1474-->
1475<xsl:template name="inject-font-view">
1476.*#############################################################################
1477.*# Fonts Preview
1478.*# ---------------------------------------------------------------------------
1479.*# This section was generated by a named XSLT templates.
1480.*# Its purpose is to preview OS/2 INF font rendering for Manuals.
1481.*# It seems INF is a bit limited with regard to the number of fonts that can
1482.*# be used simultaniously and possibly also sizes. Note that sizes above 25
1483.# points fall back to the default size, so we'll comment those out.
1484.*#############################################################################
1485
1486.*# Heading Level 1
1487:h1.Fonts
1488.*#____________________________________________________________________________
1489
1490:font facename=WarpSans.
1491:hp2.:color fc=darkgreen.Fonts:color fc=default.:ehp2.
1492:font facename=default.
1493
1494<!-- WarpSans :: Looks Good in more sizes -->
1495<!--
1496<xsl:call-template name="inject-fonts">
1497<xsl:with-param name="fontname">WarpSans</xsl:with-param>
1498</xsl:call-template>
1499-->
1500
1501<!-- Workplace Sans :: Looks Good in more sizes -->
1502<!--
1503<xsl:call-template name="inject-fonts">
1504<xsl:with-param name="fontname">Workplace Sans</xsl:with-param>
1505</xsl:call-template>
1506-->
1507
1508<!-- Source Code Pro -->
1509<!--
1510<xsl:call-template name="inject-fonts">
1511<xsl:with-param name="fontname">Source Code Pro</xsl:with-param>
1512</xsl:call-template>
1513-->
1514<!--
1515<xsl:call-template name="inject-fonts">
1516<xsl:with-param name="fontname">Source Code Pro Light</xsl:with-param>
1517</xsl:call-template>
1518-->
1519<!--
1520<xsl:call-template name="inject-fonts">
1521<xsl:with-param name="fontname">Source Code Pro Medium</xsl:with-param>
1522</xsl:call-template>
1523-->
1524
1525<!-- Ugly -->
1526<!--
1527<xsl:call-template name="inject-fonts">
1528<xsl:with-param name="fontname">Source Sans Pro</xsl:with-param>
1529</xsl:call-template>
1530-->
1531<!-- Some sizes are doable -->
1532<!--
1533<xsl:call-template name="inject-fonts">
1534<xsl:with-param name="fontname">Source Sans Pro ExtraLight</xsl:with-param>
1535</xsl:call-template>
1536-->
1537<!--
1538<xsl:call-template name="inject-fonts">
1539<xsl:with-param name="fontname">Source Sans Pro Medium</xsl:with-param>
1540</xsl:call-template>
1541-->
1542
1543<!-- Workable -->
1544<!--
1545<xsl:call-template name="inject-fonts">
1546<xsl:with-param name="fontname">Droid Sans</xsl:with-param>
1547</xsl:call-template>
1548-->
1549
1550<!-- Ugly -->
1551<!--
1552<xsl:call-template name="inject-fonts">
1553<xsl:with-param name="fontname">Droid Serif</xsl:with-param>
1554</xsl:call-template>
1555-->
1556
1557<!-- Not recognized -->
1558<!--
1559<xsl:call-template name="inject-fonts">
1560<xsl:with-param name="fontname">System VIO Bitmap</xsl:with-param>
1561</xsl:call-template>
1562-->
1563
1564<!-- Not recognized -->
1565<!--
1566<xsl:call-template name="inject-fonts">
1567<xsl:with-param name="fontname">System Monospaced Bitmap</xsl:with-param>
1568</xsl:call-template>
1569-->
1570
1571<!-- Some sizes are doable -->
1572<!--
1573<xsl:call-template name="inject-fonts">
1574<xsl:with-param name="fontname">Times New Roman</xsl:with-param>
1575</xsl:call-template>
1576-->
1577
1578<!-- Looks Good -->
1579<!--
1580<xsl:call-template name="inject-fonts">
1581<xsl:with-param name="fontname">Arial</xsl:with-param>
1582</xsl:call-template>
1583-->
1584
1585<!-- Looks Good, Helv.14 -->
1586<!--
1587-->
1588<xsl:call-template name="inject-fonts">
1589<xsl:with-param name="fontname">Helv</xsl:with-param>
1590</xsl:call-template>
1591
1592<!-- Looks Good -->
1593<!--
1594<xsl:call-template name="inject-fonts">
1595<xsl:with-param name="fontname">Helvetica</xsl:with-param>
1596</xsl:call-template>
1597-->
1598
1599<!-- Ugly -->
1600<!--
1601<xsl:call-template name="inject-fonts">
1602<xsl:with-param name="fontname">URW Bookman L</xsl:with-param>
1603</xsl:call-template>
1604-->
1605
1606<!-- Looks Good -->
1607<!--
1608<xsl:call-template name="inject-fonts">
1609<xsl:with-param name="fontname">Tms Rmn</xsl:with-param>
1610</xsl:call-template>
1611-->
1612
1613<!-- Not recognized -->
1614<!--
1615<xsl:call-template name="inject-fonts">
1616<xsl:with-param name="fontname">Tms Rmn Bitmap</xsl:with-param>
1617</xsl:call-template>
1618-->
1619
1620<!-- Looks Good for a few sizes -->
1621<!--
1622<xsl:call-template name="inject-fonts">
1623<xsl:with-param name="fontname">System Proportional</xsl:with-param>
1624</xsl:call-template>
1625-->
1626
1627<!-- Same as ISO version ? -->
1628<!--
1629<xsl:call-template name="inject-fonts">
1630<xsl:with-param name="fontname">System Proportional Non-ISO</xsl:with-param>
1631</xsl:call-template>
1632-->
1633
1634<!-- Looks Good, but Courier looks a little better -->
1635<!--
1636<xsl:call-template name="inject-fonts">
1637<xsl:with-param name="fontname">Courier New</xsl:with-param>
1638</xsl:call-template>
1639-->
1640
1641<!-- Looks Good -->
1642<!--
1643<xsl:call-template name="inject-fonts">
1644<xsl:with-param name="fontname">Courier</xsl:with-param>
1645</xsl:call-template>
1646-->
1647
1648<!-- Looks Good ~~ PREFERRED -->
1649<!--
1650<xsl:call-template name="inject-fonts">
1651<xsl:with-param name="fontname">Monotype Sans Duospace WT J</xsl:with-param>
1652</xsl:call-template>
1653-->
1654
1655<!-- Looks OK ~~ not monospaced -->
1656<!--
1657<xsl:call-template name="inject-fonts">
1658<xsl:with-param name="fontname">Monotype Sans WT</xsl:with-param>
1659</xsl:call-template>
1660-->
1661
1662<!-- Some sizes are doable -->
1663<!--
1664<xsl:call-template name="inject-fonts">
1665<xsl:with-param name="fontname">System Monospaced</xsl:with-param>
1666</xsl:call-template>
1667-->
1668
1669<!-- Does not render correctly ~~ lower base gets clipped -->
1670<!--
1671<xsl:call-template name="inject-fonts">
1672<xsl:with-param name="fontname">Droid Sans Mono</xsl:with-param>
1673</xsl:call-template>
1674-->
1675
1676<!-- Ugly -->
1677<!--
1678<xsl:call-template name="inject-fonts">
1679<xsl:with-param name="fontname">URW Palladio L</xsl:with-param>
1680</xsl:call-template>
1681-->
1682
1683<!-- Workable -->
1684<!--
1685<xsl:call-template name="inject-fonts">
1686<xsl:with-param name="fontname">URW Chancery L</xsl:with-param>
1687</xsl:call-template>
1688-->
1689
1690<!-- Looks Good -->
1691<!--
1692<xsl:call-template name="inject-fonts">
1693<xsl:with-param name="fontname">Helv</xsl:with-param>
1694</xsl:call-template>
1695-->
1696
1697<!-- Some usable -->
1698<!--
1699<xsl:call-template name="inject-fonts">
1700<xsl:with-param name="fontname">Helvetica</xsl:with-param>
1701</xsl:call-template>
1702-->
1703
1704<!-- Only 14-points works -->
1705<!--
1706<xsl:call-template name="inject-fonts">
1707<xsl:with-param name="fontname">LEDPanel</xsl:with-param>
1708</xsl:call-template>
1709-->
1710
1711<!-- Not recognized -->
1712<!--
1713<xsl:call-template name="inject-fonts">
1714<xsl:with-param name="fontname">MARKSYM</xsl:with-param>
1715</xsl:call-template>
1716-->
1717
1718<!-- Looks Good -->
1719<!--
1720<xsl:call-template name="inject-fonts">
1721<xsl:with-param name="fontname">Heuristica Regular</xsl:with-param>
1722</xsl:call-template>
1723-->
1724
1725<!-- Looks OK for italics -->
1726<!--
1727<xsl:call-template name="inject-fonts">
1728<xsl:with-param name="fontname">Heuristica Italic</xsl:with-param>
1729</xsl:call-template>
1730-->
1731
1732<!-- Some sizes are doable ~~ has artifacts -->
1733<!--
1734<xsl:call-template name="inject-fonts">
1735<xsl:with-param name="fontname">URW Gothic L</xsl:with-param>
1736</xsl:call-template>
1737-->
1738
1739<!-- Shows empty squares -->
1740<!--
1741<xsl:call-template name="inject-fonts">
1742<xsl:with-param name="fontname">OpenSymbol</xsl:with-param>
1743</xsl:call-template>
1744-->
1745
1746<!-- Has Artifacts -->
1747<!--
1748<xsl:call-template name="inject-fonts">
1749<xsl:with-param name="fontname">Midori Sans</xsl:with-param>
1750</xsl:call-template>
1751-->
1752
1753<!-- Only works for digits ~~ some sizes only -->
1754<!--
1755<xsl:call-template name="inject-fonts">
1756<xsl:with-param name="fontname">MMPMDigital</xsl:with-param>
1757</xsl:call-template>
1758-->
1759
1760<!-- Doable but some sizes have artifacts -->
1761<!--
1762<xsl:call-template name="inject-fonts">
1763<xsl:with-param name="fontname">Nimbus Sans L Condensed</xsl:with-param>
1764</xsl:call-template>
1765-->
1766
1767<!-- Looks like Greek -->
1768<!--
1769<xsl:call-template name="inject-fonts">
1770<xsl:with-param name="fontname">Symbol</xsl:with-param>
1771</xsl:call-template>
1772-->
1773
1774<!-- Same as Symbol ? -->
1775<!--
1776<xsl:call-template name="inject-fonts">
1777<xsl:with-param name="fontname">Symbol Set</xsl:with-param>
1778</xsl:call-template>
1779-->
1780
1781<!-- Looks Good ~~ has map, file, keyboard and mouse glyphs -->
1782<!--
1783<xsl:call-template name="inject-fonts">
1784<xsl:with-param name="fontname">Wingdings</xsl:with-param>
1785</xsl:call-template>
1786-->
1787
1788</xsl:template>
1789
1790
1791
1792<!--
1793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1794%% Get Style Properties :: not used anymore
1795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1796-->
1797<xsl:template name="get-style-properties">
1798<xsl:param name="style-name">Standard</xsl:param>
1799<xsl:variable name="alignment">left</xsl:variable>
1800<xsl:variable name="fgc">default</xsl:variable>
1801<xsl:variable name="bgc">default</xsl:variable>
1802<xsl:variable name="font-weight">default</xsl:variable>
1803<xsl:variable name="font-style">default</xsl:variable>
1804<xsl:variable name="parent-style-name">default</xsl:variable>
1805<xsl:variable name="node-ptr" select="/office:document-content/office:automatic-styles/style:style[@style:name=$style-name]" />
1806<!--xsl:text>BEGIN</xsl:text>
1807<xsl:value-of select="$style-name"/>
1808<xsl:text>[</xsl:text>
1809<xsl:value-of select="$node-ptr/@style:family" />
1810<xsl:text>]</xsl:text>
1811<xsl:text>[</xsl:text>
1812<xsl:value-of select="$node-ptr/style:text-properties/@fo:color" />
1813<xsl:text>]</xsl:text>
1814<xsl:text>[</xsl:text>
1815<xsl:value-of select="$node-ptr/style:text-properties/@fo:background-color" />
1816<xsl:text>]</xsl:text>
1817<xsl:text>END</xsl:text-->
1818</xsl:template>
1819
1820
1821</xsl:transform>
Note: See TracBrowser for help on using the repository browser.