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 9651 2012-10-26 20:44:10Z bobstayton $
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.xsl'/>
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:variable name="content">
65 <xsl:apply-templates select='$authors[1]' mode='doc:docprop.author'/>
67 <xsl:value-of select="$content"/>
69 <xsl:otherwise>Unknown</xsl:otherwise>
73 <xsl:variable name="content">
75 <xsl:when test='$info/revhistory/revision[1]/*[self::author|self::authorinitials]'>
76 <xsl:apply-templates select='$info/revhistory/revision[1]/*[self::author|self::authorinitials]' mode='doc:docprop.author'/>
78 <xsl:when test='$authors'>
79 <xsl:apply-templates select='$authors[1]' mode='doc:docprop.author'/>
81 <xsl:otherwise>Unknown</xsl:otherwise>
84 <xsl:value-of select="$content"/>
86 <o:Revision>1</o:Revision>
87 <o:TotalTime></o:TotalTime>
90 <o:Created>2004-01-01T07:07:00Z</o:Created>
91 <o:LastSaved>2004-01-01T08:08:00Z</o:LastSaved>
95 <o:Characters>1</o:Characters>
97 <!-- could derive this from author -->
98 <o:Company>DocBook</o:Company>
101 <o:Paragraphs>1</o:Paragraphs>
102 <o:CharactersWithSpaces>1</o:CharactersWithSpaces>
103 <o:Version>11.6113</o:Version>
104 </o:DocumentProperties>
106 <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'/>
109 <w:view w:val="print"/>
110 <w:zoom w:percent="100"/>
111 <w:doNotEmbedSystemFonts/>
112 <w:attachedTemplate w:val=""/>
113 <w:documentProtection w:formatting='on' w:enforcement='on'
114 w:unprotectPassword='CAA7FF77'/>
115 <w:defaultTabStop w:val="720"/>
117 <w:hyphenationZone w:val="357"/>
118 <w:doNotHyphenateCaps/>
119 <w:evenAndOddHeaders/>
120 <w:characterSpacingControl w:val="DontCompress"/>
121 <w:optimizeForBrowser/>
122 <w:validateAgainstSchema/>
123 <w:saveInvalidXML w:val="off"/>
124 <w:ignoreMixedContent w:val="off"/>
125 <w:alwaysShowPlaceholderText w:val="off"/>
127 <w:footnote w:type="separator">
134 <w:footnote w:type="continuation-separator">
137 <w:continuationSeparator/>
143 <w:endnote w:type="separator">
150 <w:endnote w:type="continuation-separator">
153 <w:continuationSeparator/>
159 <w:breakWrappedTables/>
160 <w:snapToGridInCell/>
161 <w:wrapTextWithPunct/>
162 <w:useAsianBreakRules/>
163 <w:useWord2002TableStyleRules/>
169 <xsl:apply-templates select='$doc/*' mode='doc:toplevel'/>
174 <xsl:template name='doc:make-body'>
175 <xsl:param name='content'>
176 <xsl:apply-templates mode='doc:body'/>
182 <xsl:copy-of select='$content'/>
188 <xsl:template name='doc:make-subsection'>
189 <xsl:param name='content'>
190 <xsl:apply-templates mode='doc:body'/>
194 <xsl:copy-of select='$content'/>
198 <xsl:template name='doc:make-paragraph'>
199 <xsl:param name='style' select='"unknown"'/>
200 <xsl:param name='content'>
201 <xsl:apply-templates mode='doc:body'/>
203 <xsl:param name='outline.level' select='0'/>
204 <xsl:param name='attributes.node' select='.'/>
207 <xsl:if test='$style != "" or
208 $outline.level != 0'>
210 <xsl:if test='$style != ""'>
211 <w:pStyle w:val='{$style}'/>
214 <xsl:if test='$outline.level != 0'>
215 <w:outlineLvl w:val='{$outline.level}'/>
220 <xsl:call-template name='attributes'>
221 <xsl:with-param name='node' select='$attributes.node'/>
224 <xsl:copy-of select='$content'/>
228 <xsl:template name='doc:make-phrase'>
229 <xsl:param name='style' select='""'/>
230 <xsl:param name='italic' select='0'/>
231 <xsl:param name='bold' select='0'/>
232 <xsl:param name='content'>
233 <xsl:apply-templates mode='doc:phrase'/>
237 <xsl:if test='$style != "" or
241 <xsl:if test='$style != ""'>
242 <w:rStyle w:val='{$style}'/>
244 <xsl:if test='$italic = 1'>
247 <xsl:if test='$bold = 1'>
254 <xsl:copy-of select='$content'/>
259 <xsl:template name='doc:make-hyperlink'>
260 <xsl:param name='target'/>
261 <xsl:param name='content'>
262 <xsl:apply-templates mode='doc:body'/>
265 <w:hlink w:dest='{$target}'>
266 <xsl:copy-of select='$content'/>
270 <xsl:template name='doc:make-table'>
271 <xsl:param name='columns'/>
272 <xsl:param name='content'>
273 <xsl:apply-templates select='*[not(self::caption|self::doc:caption|self::textobject|self::doc:textobject)]'
279 <w:tblW w:w="0" w:type="auto"/>
280 <w:tblInd w:w="108" w:type="dxa"/>
281 <w:tblLayout w:type="Fixed"/>
284 <xsl:copy-of select='$columns'/>
286 <xsl:copy-of select='$content'/>
290 <xsl:template name='doc:make-column'>
291 <xsl:param name='width' select='0'/>
293 <w:gridcol w:w='{$width}'/>
296 <xsl:template name='doc:make-table-row'>
297 <xsl:param name='content'>
298 <xsl:apply-templates mode='doc:body'/>
300 <xsl:param name='is-header' select='false()'/>
304 <xsl:if test='$is-header'>
308 <xsl:copy-of select='$content'/>
312 <xsl:template name='doc:make-table-cell'>
313 <xsl:param name='width' select='0'/>
314 <xsl:param name='hidden' select='false()'/>
315 <xsl:param name='rowspan' select='1'/>
316 <xsl:param name='colspan' select='1'/>
317 <xsl:param name='content'>
318 <xsl:apply-templates mode='doc:body'/>
322 <xsl:if test='$colspan != 1 or
325 <xsl:if test='$colspan != 1 or
327 <w:tcW w:w='{$width}' w:type='dxa'/>
329 <xsl:if test='$hidden'>
330 <w:vmerge w:val='{$hidden}'/>
332 <xsl:if test='$rowspan != 1'>
333 <w:vmerge w:val='restart'/>
335 <xsl:if test='$colspan != 1'>
336 <w:gridspan w:val='{$colspan}'/>
341 <xsl:copy-of select='$content'/>
345 <xsl:template name='doc:make-soft-break'>
349 <xsl:template name='attributes'>
350 <xsl:param name='node' select='.'/>
352 <xsl:if test='$node/@*'>
353 <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.Start'/>
356 <w:rStyle w:val='attributes'/>
359 <xsl:text> </xsl:text>
362 <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.End'/>
365 <w:rStyle w:val='CommentReference'/>
367 <aml:annotation aml:id='{count(preceding::*) + 1}' aml:author="DocBook" aml:createdate='2004-12-23T00:01:00' w:type='Word.Comment' w:initials='DBK'>
371 <w:pStyle w:val='CommentText'/>
375 <w:rStyle w:val='CommentReference'/>
379 <xsl:for-each select='$node/@*'>
382 <w:rStyle w:val='attribute-name'/>
385 <xsl:value-of select='name()'/>
393 <w:rStyle w:val='attribute-value'/>
396 <xsl:value-of select='.'/>