1 <xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'
4 xmlns:v='urn:schemas-microsoft-com:vml'
5 xmlns:w10="urn:schemas-microsoft-com:office:word"
6 xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
7 xmlns:wx='http://schemas.microsoft.com/office/word/2003/auxHint'
8 xmlns:o="urn:schemas-microsoft-com:office:office"
9 xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
10 xmlns:sl='http://schemas.microsoft.com/schemaLibrary/2003/core'
11 xmlns:doc='http://docbook.org/ns/docbook'
12 exclude-result-prefixes='doc'>
14 <xsl:import href='dbk2wp.xsl'/>
16 <xsl:output method="xml" indent='yes' standalone='yes' encoding='UTF-8'/>
18 <!-- ********************************************************************
19 $Id: dbk2wordml.xsl 7701 2008-02-22 06:07:31Z balls $
20 ********************************************************************
22 This file is part of the XSL DocBook Stylesheet distribution.
23 See ../README or http://docbook.sf.net/release/xsl/current/ for
24 copyright and other information.
26 ******************************************************************** -->
28 <xsl:include href='../VERSION'/>
29 <xsl:include href='param.xsl'/>
31 <xsl:strip-space elements='*'/>
32 <xsl:preserve-space elements='literallayout doc:literallayout
33 programlisting doc:programlisting'/>
35 <xsl:variable name='templatedoc' select='document($wordml.template)'/>
37 <xsl:template match="/" name='wordml.top'>
38 <xsl:param name='doc' select='/'/>
40 <xsl:if test='not($wordml.template)'>
41 <xsl:message terminate='yes'>Please specify the template document with the "wordml.template" parameter</xsl:message>
43 <xsl:if test='not($templatedoc)'>
44 <xsl:message terminate='yes'>Unable to open template document "<xsl:value-of select='$wordml.template'/>"</xsl:message>
47 <xsl:processing-instruction name='mso-application'>
48 <xsl:text>progid="Word.Document"</xsl:text>
49 </xsl:processing-instruction>
50 <xsl:text>
</xsl:text>
52 <xsl:variable name='info'
53 select='$doc/book/bookinfo|$doc/article/articleinfo'/>
54 <xsl:variable name='authors' select='$info/author|$info/authorinitials|$info/authorgroup/author|$info/authorgroup/editor'/>
57 w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no">
58 <xsl:attribute name='xml:space'>preserve</xsl:attribute>
60 <o:DocumentProperties>
63 <xsl:when test='$authors'>
64 <xsl:apply-templates select='$authors[1]' mode='doc:docprop.author'/>
66 <xsl:otherwise>Unknown</xsl:otherwise>
71 <xsl:when test='$info/revhistory/revision[1]/*[self::author|self::authorinitials]'>
72 <xsl:apply-templates select='$info/revhistory/revision[1]/*[self::author|self::authorinitials]' mode='doc:docprop.author'/>
74 <xsl:when test='$authors'>
75 <xsl:apply-templates select='$authors[1]' mode='doc:docprop.author'/>
77 <xsl:otherwise>Unknown</xsl:otherwise>
80 <o:Revision>1</o:Revision>
81 <o:TotalTime></o:TotalTime>
84 <o:Created>2004-01-01T07:07:00Z</o:Created>
85 <o:LastSaved>2004-01-01T08:08:00Z</o:LastSaved>
89 <o:Characters>1</o:Characters>
91 <!-- could derive this from author -->
92 <o:Company>DocBook</o:Company>
95 <o:Paragraphs>1</o:Paragraphs>
96 <o:CharactersWithSpaces>1</o:CharactersWithSpaces>
97 <o:Version>11.6113</o:Version>
98 </o:DocumentProperties>
100 <xsl:apply-templates select='$templatedoc/w:wordDocument/o:CustomDocumentProperties|$templatedoc/w:wordDocument/w:fonts|$templatedoc/w:wordDocument/w:lists|$templatedoc/w:wordDocument/w:styles' mode='doc:copy'/>
103 <w:view w:val="print"/>
104 <w:zoom w:percent="100"/>
105 <w:doNotEmbedSystemFonts/>
106 <w:attachedTemplate w:val=""/>
107 <w:documentProtection w:formatting='on' w:enforcement='on'
108 w:unprotectPassword='CAA7FF77'/>
109 <w:defaultTabStop w:val="720"/>
111 <w:hyphenationZone w:val="357"/>
112 <w:doNotHyphenateCaps/>
113 <w:evenAndOddHeaders/>
114 <w:characterSpacingControl w:val="DontCompress"/>
115 <w:optimizeForBrowser/>
116 <w:validateAgainstSchema/>
117 <w:saveInvalidXML w:val="off"/>
118 <w:ignoreMixedContent w:val="off"/>
119 <w:alwaysShowPlaceholderText w:val="off"/>
121 <w:footnote w:type="separator">
128 <w:footnote w:type="continuation-separator">
131 <w:continuationSeparator/>
137 <w:endnote w:type="separator">
144 <w:endnote w:type="continuation-separator">
147 <w:continuationSeparator/>
153 <w:breakWrappedTables/>
154 <w:snapToGridInCell/>
155 <w:wrapTextWithPunct/>
156 <w:useAsianBreakRules/>
157 <w:useWord2002TableStyleRules/>
163 <xsl:apply-templates select='$doc/*' mode='doc:toplevel'/>
168 <xsl:template name='doc:make-body'>
169 <xsl:param name='content'>
170 <xsl:apply-templates mode='doc:body'/>
176 <xsl:copy-of select='$content'/>
182 <xsl:template name='doc:make-subsection'>
183 <xsl:param name='content'>
184 <xsl:apply-templates mode='doc:body'/>
188 <xsl:copy-of select='$content'/>
192 <xsl:template name='doc:make-paragraph'>
193 <xsl:param name='style' select='"unknown"'/>
194 <xsl:param name='content'>
195 <xsl:apply-templates mode='doc:body'/>
197 <xsl:param name='outline.level' select='0'/>
198 <xsl:param name='attributes.node' select='.'/>
201 <xsl:if test='$style != "" or
202 $outline.level != 0'>
204 <xsl:if test='$style != ""'>
205 <w:pStyle w:val='{$style}'/>
208 <xsl:if test='$outline.level != 0'>
209 <w:outlineLvl w:val='{$outline.level}'/>
214 <xsl:call-template name='attributes'>
215 <xsl:with-param name='node' select='$attributes.node'/>
218 <xsl:copy-of select='$content'/>
222 <xsl:template name='doc:make-phrase'>
223 <xsl:param name='style' select='""'/>
224 <xsl:param name='italic' select='0'/>
225 <xsl:param name='bold' select='0'/>
226 <xsl:param name='content'>
227 <xsl:apply-templates mode='doc:phrase'/>
231 <xsl:if test='$style != "" or
235 <xsl:if test='$style != ""'>
236 <w:rStyle w:val='{$style}'/>
238 <xsl:if test='$italic = 1'>
241 <xsl:if test='$bold = 1'>
248 <xsl:copy-of select='$content'/>
253 <xsl:template name='doc:make-hyperlink'>
254 <xsl:param name='target'/>
255 <xsl:param name='content'>
256 <xsl:apply-templates mode='doc:body'/>
259 <w:hlink w:dest='{$target}'>
260 <xsl:copy-of select='$content'/>
264 <xsl:template name='doc:make-table'>
265 <xsl:param name='columns'/>
266 <xsl:param name='content'>
267 <xsl:apply-templates select='*[not(self::caption|self::doc:caption|self::textobject|self::doc:textobject)]'
273 <w:tblW w:w="0" w:type="auto"/>
274 <w:tblInd w:w="108" w:type="dxa"/>
275 <w:tblLayout w:type="Fixed"/>
278 <xsl:copy-of select='$columns'/>
280 <xsl:copy-of select='$content'/>
284 <xsl:template name='doc:make-column'>
285 <xsl:param name='width' select='0'/>
287 <w:gridcol w:w='{$width}'/>
290 <xsl:template name='doc:make-table-row'>
291 <xsl:param name='content'>
292 <xsl:apply-templates mode='doc:body'/>
294 <xsl:param name='is-header' select='false()'/>
298 <xsl:if test='$is-header'>
302 <xsl:copy-of select='$content'/>
306 <xsl:template name='doc:make-table-cell'>
307 <xsl:param name='width' select='0'/>
308 <xsl:param name='hidden' select='false()'/>
309 <xsl:param name='rowspan' select='1'/>
310 <xsl:param name='colspan' select='1'/>
311 <xsl:param name='content'>
312 <xsl:apply-templates mode='doc:body'/>
316 <xsl:if test='$colspan != 1 or
319 <xsl:if test='$colspan != 1 or
321 <w:tcW w:w='{$width}' w:type='dxa'/>
323 <xsl:if test='$hidden'>
324 <w:vmerge w:val='{$hidden}'/>
326 <xsl:if test='$rowspan != 1'>
327 <w:vmerge w:val='restart'/>
329 <xsl:if test='$colspan != 1'>
330 <w:gridspan w:val='{$colspan}'/>
335 <xsl:copy-of select='$content'/>
339 <xsl:template name='doc:make-soft-break'>
343 <xsl:template name='attributes'>
344 <xsl:param name='node' select='.'/>
346 <xsl:if test='$node/@*'>
347 <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.Start'/>
350 <w:rStyle w:val='attributes'/>
353 <xsl:text> </xsl:text>
356 <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.End'/>
359 <w:rStyle w:val='CommentReference'/>
361 <aml:annotation aml:id='{count(preceding::*) + 1}' aml:author="DocBook" aml:createdate='2004-12-23T00:01:00' w:type='Word.Comment' w:initials='DBK'>
365 <w:pStyle w:val='CommentText'/>
369 <w:rStyle w:val='CommentReference'/>
373 <xsl:for-each select='$node/@*'>
376 <w:rStyle w:val='attribute-name'/>
379 <xsl:value-of select='name()'/>
387 <w:rStyle w:val='attribute-value'/>
390 <xsl:value-of select='.'/>