1 <xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:d="http://docbook.org/ns/docbook"
4 xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'
5 xmlns:v='urn:schemas-microsoft-com:vml'
6 xmlns:w10="urn:schemas-microsoft-com:office:word"
7 xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
8 xmlns:wx='http://schemas.microsoft.com/office/word/2003/auxHint'
9 xmlns:o="urn:schemas-microsoft-com:office:office"
10 xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
11 xmlns:sl='http://schemas.microsoft.com/schemaLibrary/2003/core'
12 xmlns:doc='http://docbook.org/ns/docbook'
13 exclude-result-prefixes='doc'>
15 <xsl:import href='dbk2wp.xsl'/>
17 <xsl:output method="xml" indent='yes' standalone='yes' encoding='UTF-8'/>
19 <!-- ********************************************************************
21 This file is part of the XSL DocBook Stylesheet distribution.
22 See ../README or http://cdn.docbook.org/release/xsl/current/ for
23 copyright and other information.
25 ******************************************************************** -->
27 <xsl:include href='../VERSION.xsl'/>
28 <xsl:include href='param.xsl'/>
30 <xsl:strip-space elements='*'/>
31 <xsl:preserve-space elements='d:literallayout doc:literallayout
32 d:programlisting doc:programlisting'/>
34 <xsl:variable name='templatedoc' select='document($wordml.template)'/>
36 <xsl:template match="/" name='wordml.top'>
37 <xsl:param name='doc' select='/'/>
39 <xsl:if test='not($wordml.template)'>
40 <xsl:message terminate='yes'>Please specify the template document with the "wordml.template" parameter</xsl:message>
42 <xsl:if test='not($templatedoc)'>
43 <xsl:message terminate='yes'>Unable to open template document "<xsl:value-of select='$wordml.template'/>"</xsl:message>
46 <xsl:processing-instruction name='mso-application'>
47 <xsl:text>progid="Word.Document"</xsl:text>
48 </xsl:processing-instruction>
49 <xsl:text>
</xsl:text>
51 <xsl:variable name='info'
52 select='$doc/d:book/d:bookinfo|$doc/d:article/d:articleinfo'/>
53 <xsl:variable name='authors' select='$info/d:author|$info/d:authorinitials|$info/d:authorgroup/d:author|$info/d:authorgroup/d:editor'/>
56 w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no">
57 <xsl:attribute name='xml:space'>preserve</xsl:attribute>
59 <o:DocumentProperties>
62 <xsl:when test='$authors'>
63 <xsl:variable name="content">
64 <xsl:apply-templates select='$authors[1]' mode='doc:docprop.author'/>
66 <xsl:value-of select="$content"/>
68 <xsl:otherwise>Unknown</xsl:otherwise>
72 <xsl:variable name="content">
74 <xsl:when test='$info/d:revhistory/d:revision[1]/*[self::d:author|self::d:authorinitials]'>
75 <xsl:apply-templates select='$info/d:revhistory/d:revision[1]/*[self::d:author|self::d:authorinitials]' mode='doc:docprop.author'/>
77 <xsl:when test='$authors'>
78 <xsl:apply-templates select='$authors[1]' mode='doc:docprop.author'/>
80 <xsl:otherwise>Unknown</xsl:otherwise>
83 <xsl:value-of select="$content"/>
85 <o:Revision>1</o:Revision>
86 <o:TotalTime></o:TotalTime>
89 <o:Created>2004-01-01T07:07:00Z</o:Created>
90 <o:LastSaved>2004-01-01T08:08:00Z</o:LastSaved>
94 <o:Characters>1</o:Characters>
96 <!-- could derive this from author -->
97 <o:Company>DocBook</o:Company>
100 <o:Paragraphs>1</o:Paragraphs>
101 <o:CharactersWithSpaces>1</o:CharactersWithSpaces>
102 <o:Version>11.6113</o:Version>
103 </o:DocumentProperties>
105 <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'/>
108 <w:view w:val="print"/>
109 <w:zoom w:percent="100"/>
110 <w:doNotEmbedSystemFonts/>
111 <w:attachedTemplate w:val=""/>
112 <w:documentProtection w:formatting='on' w:enforcement='on'
113 w:unprotectPassword='CAA7FF77'/>
114 <w:defaultTabStop w:val="720"/>
116 <w:hyphenationZone w:val="357"/>
117 <w:doNotHyphenateCaps/>
118 <w:evenAndOddHeaders/>
119 <w:characterSpacingControl w:val="DontCompress"/>
120 <w:optimizeForBrowser/>
121 <w:validateAgainstSchema/>
122 <w:saveInvalidXML w:val="off"/>
123 <w:ignoreMixedContent w:val="off"/>
124 <w:alwaysShowPlaceholderText w:val="off"/>
126 <w:footnote w:type="separator">
133 <w:footnote w:type="continuation-separator">
136 <w:continuationSeparator/>
142 <w:endnote w:type="separator">
149 <w:endnote w:type="continuation-separator">
152 <w:continuationSeparator/>
158 <w:breakWrappedTables/>
159 <w:snapToGridInCell/>
160 <w:wrapTextWithPunct/>
161 <w:useAsianBreakRules/>
162 <w:useWord2002TableStyleRules/>
168 <xsl:apply-templates select='$doc/*' mode='doc:toplevel'/>
173 <xsl:template name='doc:make-body'>
174 <xsl:param name='content'>
175 <xsl:apply-templates mode='doc:body'/>
181 <xsl:copy-of select='$content'/>
187 <xsl:template name='doc:make-subsection'>
188 <xsl:param name='content'>
189 <xsl:apply-templates mode='doc:body'/>
193 <xsl:copy-of select='$content'/>
197 <xsl:template name='doc:make-paragraph'>
198 <xsl:param name='style' select='"d:unknown"'/>
199 <xsl:param name='content'>
200 <xsl:apply-templates mode='doc:body'/>
202 <xsl:param name='outline.level' select='0'/>
203 <xsl:param name='attributes.node' select='.'/>
206 <xsl:if test='$style != "" or
207 $outline.level != 0'>
209 <xsl:if test='$style != ""'>
210 <w:pStyle w:val='{$style}'/>
213 <xsl:if test='$outline.level != 0'>
214 <w:outlineLvl w:val='{$outline.level}'/>
219 <xsl:call-template name='attributes'>
220 <xsl:with-param name='node' select='$attributes.node'/>
223 <xsl:copy-of select='$content'/>
227 <xsl:template name='doc:make-phrase'>
228 <xsl:param name='style' select='""'/>
229 <xsl:param name='italic' select='0'/>
230 <xsl:param name='bold' select='0'/>
231 <xsl:param name='content'>
232 <xsl:apply-templates mode='doc:phrase'/>
236 <xsl:if test='$style != "" or
240 <xsl:if test='$style != ""'>
241 <w:rStyle w:val='{$style}'/>
243 <xsl:if test='$italic = 1'>
246 <xsl:if test='$bold = 1'>
253 <xsl:copy-of select='$content'/>
258 <xsl:template name='doc:make-hyperlink'>
259 <xsl:param name='target'/>
260 <xsl:param name='content'>
261 <xsl:apply-templates mode='doc:body'/>
264 <w:hlink w:dest='{$target}'>
265 <xsl:copy-of select='$content'/>
269 <xsl:template name='doc:make-table'>
270 <xsl:param name='columns'/>
271 <xsl:param name='content'>
272 <xsl:apply-templates select='*[not(self::d:caption|self::doc:caption|self::d:textobject|self::doc:textobject)]'
278 <w:tblW w:w="0" w:type="auto"/>
279 <w:tblInd w:w="108" w:type="dxa"/>
280 <w:tblLayout w:type="Fixed"/>
283 <xsl:copy-of select='$columns'/>
285 <xsl:copy-of select='$content'/>
289 <xsl:template name='doc:make-column'>
290 <xsl:param name='width' select='0'/>
292 <w:gridcol w:w='{$width}'/>
295 <xsl:template name='doc:make-table-row'>
296 <xsl:param name='content'>
297 <xsl:apply-templates mode='doc:body'/>
299 <xsl:param name='is-header' select='false()'/>
303 <xsl:if test='$is-header'>
307 <xsl:copy-of select='$content'/>
311 <xsl:template name='doc:make-table-cell'>
312 <xsl:param name='width' select='0'/>
313 <xsl:param name='hidden' select='false()'/>
314 <xsl:param name='rowspan' select='1'/>
315 <xsl:param name='colspan' select='1'/>
316 <xsl:param name='content'>
317 <xsl:apply-templates mode='doc:body'/>
321 <xsl:if test='$colspan != 1 or
324 <xsl:if test='$colspan != 1 or
326 <w:tcW w:w='{$width}' w:type='dxa'/>
328 <xsl:if test='$hidden'>
329 <w:vmerge w:val='{$hidden}'/>
331 <xsl:if test='$rowspan != 1'>
332 <w:vmerge w:val='restart'/>
334 <xsl:if test='$colspan != 1'>
335 <w:gridspan w:val='{$colspan}'/>
340 <xsl:copy-of select='$content'/>
344 <xsl:template name='doc:make-soft-break'>
348 <xsl:template name='attributes'>
349 <xsl:param name='node' select='.'/>
351 <xsl:if test='$node/@*'>
352 <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.Start'/>
355 <w:rStyle w:val='attributes'/>
358 <xsl:text> </xsl:text>
361 <aml:annotation aml:id='{count(preceding::*) + 1}' w:type='Word.Comment.End'/>
364 <w:rStyle w:val='CommentReference'/>
366 <aml:annotation aml:id='{count(preceding::*) + 1}' aml:author="DocBook" aml:createdate='2004-12-23T00:01:00' w:type='Word.Comment' w:initials='DBK'>
370 <w:pStyle w:val='CommentText'/>
374 <w:rStyle w:val='CommentReference'/>
378 <xsl:for-each select='$node/@*'>
381 <w:rStyle w:val='attribute-name'/>
384 <xsl:value-of select='name()'/>
392 <w:rStyle w:val='attribute-value'/>
395 <xsl:value-of select='.'/>