]> git.stg.codes - stg.git/blob - doc/xslt/roundtrip/dbk2ooo.xsl
Merge branch 'master' into full-month-stats
[stg.git] / doc / xslt / roundtrip / dbk2ooo.xsl
1 <xsl:stylesheet version="1.0"
2   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
3   xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
4   xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
5   xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
6   xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
7   xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
8   xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
9   xmlns:xlink="http://www.w3.org/1999/xlink"
10   xmlns:dc="http://purl.org/dc/elements/1.1/"
11   xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
12   xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
13   xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
14   xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
15   xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
16   xmlns:math="http://www.w3.org/1998/Math/MathML"
17   xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
18   xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
19   xmlns:ooo="http://openoffice.org/2004/office"
20   xmlns:ooow="http://openoffice.org/2004/writer"
21   xmlns:oooc="http://openoffice.org/2004/calc"
22   xmlns:dom="http://www.w3.org/2001/xml-events"
23   xmlns:xforms="http://www.w3.org/2002/xforms"
24   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
25   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26   xmlns:doc='http://docbook.org/ns/docbook'
27   exclude-result-prefixes='doc'>
28
29   <xsl:import href='dbk2wp.xsl'/>
30
31   <xsl:output method="xml" indent='yes'/>
32
33   <!-- ********************************************************************
34        $Id: dbk2ooo.xsl 7701 2008-02-22 06:07:31Z balls $
35        ********************************************************************
36
37        This file is part of the XSL DocBook Stylesheet distribution.
38        See ../README or http://docbook.sf.net/release/xsl/current/ for
39        copyright and other information.
40
41        ******************************************************************** -->
42
43   <xsl:include href='../VERSION'/>
44
45   <xsl:template match="/" name='ooo.top'>
46     <xsl:param name='doc' select='/'/>
47
48     <office:document-content
49       office:version='1.0'>
50
51       <office:script/>
52       <office:font-face-decls>
53         <style:font-face style:name="Nimbus Roman No9 L"
54           svg:font-family="'Nimbus Roman No9 L'"
55           style:font-family-generic="roman"
56           style:font-pitch="variable"/>
57         <style:font-face style:name="Nimbus Sans L"
58           svg:font-family="'Nimbus Sans L'"
59           style:font-family-generic="swiss"
60           style:font-pitch="variable"/>
61         <style:font-face style:name="DejaVu LGC Sans"
62           svg:font-family="'DejaVu LGC Sans'"
63           style:font-family-generic="system"
64           style:font-pitch="variable"/>
65       </office:font-face-decls>
66       <office:automatic-styles/>
67
68       <xsl:apply-templates select='$doc/*'
69         mode='doc:toplevel'/>
70     </office:document-content>
71   </xsl:template>
72
73   <xsl:template name='doc:make-body'>
74     <xsl:param name='content'>
75       <xsl:apply-templates mode='doc:body'/>
76     </xsl:param>
77
78     <office:body>
79       <office:text>
80         <office-forms form:automatic-focus='false'
81           form:apply-design-mode='false'/>
82         <text:sequence-decls>
83           <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
84           <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
85           <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
86           <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
87         </text:sequence-decls>
88
89         <xsl:copy-of select='$content'/>
90       </office:text>
91     </office:body>
92   </xsl:template>
93
94   <xsl:template name='doc:make-subsection'>
95     <xsl:param name='content'>
96       <xsl:apply-templates mode='doc:body'/>
97     </xsl:param>
98
99     <xsl:copy-of select='$content'/>
100   </xsl:template>
101
102   <xsl:template name='doc:make-paragraph'>
103     <xsl:param name='style' select='"unknown"'/>
104     <xsl:param name='content'>
105       <xsl:apply-templates mode='doc:body'/>
106     </xsl:param>
107     <xsl:param name='outline.level' select='0'/>
108     <xsl:param name='attributes.node' select='.'/>
109
110     <text:p text:style-name='{$style}'>
111
112       <xsl:call-template name='attributes'>
113         <xsl:with-param name='node' select='$attributes.node'/>
114       </xsl:call-template>
115
116       <xsl:copy-of select='$content'/>
117     </text:p>
118   </xsl:template>
119
120   <xsl:template name='doc:make-phrase'>
121     <xsl:param name='style' select='"unknown"'/>
122     <xsl:param name='content'>
123       <xsl:apply-templates mode='doc:body'/>
124     </xsl:param>
125
126     <text:span text:style-name='{$style}'>
127       <xsl:copy-of select='$content'/>
128     </text:span>
129   </xsl:template>
130
131   <xsl:template name='doc:make-hyperlink'/>
132   <xsl:template name='doc:make-hyperlink-not-implemented'>
133     <xsl:param name='target'/>
134     <xsl:param name='content'>
135       <xsl:apply-templates mode='doc:body'/>
136     </xsl:param>
137
138     <text:link href='{$target}'>
139     </text:link>
140   </xsl:template>
141
142   <xsl:template name='doc:make-table'/>
143   <xsl:template name='doc:make-table-not-yet-implemented'>
144     <xsl:param name='columns'/>
145     <xsl:param name='content'>
146       <xsl:apply-templates mode='doc:body'/>
147     </xsl:param>
148
149   </xsl:template>
150
151   <xsl:template name='doc:make-table-row'>
152     <xsl:param name='content'>
153       <xsl:apply-templates mode='doc:body'/>
154     </xsl:param>
155     <xsl:param name='is-header' select='false()'/>
156
157   </xsl:template>
158
159   <xsl:template name='doc:make-table-cell'>
160     <xsl:param name='width' select='0'/>
161     <xsl:param name='hidden' select='false()'/>
162     <xsl:param name='rowspan' select='1'/>
163     <xsl:param name='colspan' select='1'/>
164     <xsl:param name='content'>
165       <xsl:apply-templates mode='doc:body'/>
166     </xsl:param>
167
168   </xsl:template>
169
170   <xsl:template name='doc:make-soft-break'>
171     <text:br/>
172   </xsl:template>
173
174   <xsl:template name='attributes'>
175     <xsl:param name='node' select='.'/>
176
177   </xsl:template>
178 </xsl:stylesheet>