1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt  v" xmlns:an="urn:flr:annotate">
2
3<an:page-layout-properties
4     context-node-input="w:sectPr"
5     context-node-output="style:page-layout-properties">
6<an:so-supported select="w:pgMar/@w:gutter"/>
7<an:so-supported select="w:pgSz/@w:code"/>
8</an:page-layout-properties>
9
10<xsl:template name="page-layout-properties">
11
12<xsl:attribute name="fo:margin-top.value">
13  <xsl:value-of select="concat('(.(twips2cm(?[',name(w:hdr),'](?(>=($0[',w:pgMar/@w:top,'])($1(|[',w:pgMar/@w:header,'][720])))($1)($0))[',w:pgMar/@w:top,']))[cm])')"/>
14</xsl:attribute>
15<xsl:attribute name="fo:margin-bottom.value">
16  <xsl:value-of select="concat('(.(twips2cm(?[',name(w:ftr),'](|[',w:pgMar/@w:footer,'][720])[',w:pgMar/@w:bottom,']))[cm])')"/>
17</xsl:attribute>
18<xsl:attribute name="fo:margin-left.value">
19  <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:left,'])[cm])')"/>
20</xsl:attribute>
21<xsl:attribute name="fo:margin-right.value">
22  <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:right,'])[cm])')"/>
23</xsl:attribute>
24
25<xsl:attribute name="fo:page-width.value">
26  <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:w,'])[cm])')"/>
27</xsl:attribute>
28<xsl:attribute name="fo:page-height.value">
29  <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:h,'])[cm])')"/>
30</xsl:attribute>
31<xsl:attribute name="style:footnote-max-height.value">
32  <xsl:value-of select="'[0cm]'"/>
33</xsl:attribute>
34<xsl:attribute name="style:print-orientation.value">
35  <xsl:value-of select="concat('(|[',w:pgSz/@w:orient,'][portrait])')"/>
36</xsl:attribute>
37<xsl:apply-templates select="//w:bgPict"/>
38<xsl:call-template name="column-properties"/>
39</xsl:template>
40
41
42<an:column-properties
43     context-node-input="w:sectPr"
44     context-node-output="style:page-layout-properties">
45<an:so-supported select="w:cols/@w:sep"/>
46</an:column-properties>
47<xsl:template name="column-properties">
48<style:columns>
49<xsl:attribute name="fo:column-count.value">
50  <xsl:value-of select="concat('(|[',w:cols/@w:num,'][1])')"/>
51</xsl:attribute>
52
53<xsl:if test="not(w:cols/w:col)">
54<!-- bug in the OASIS spec resp. bug in xmloff  -->
55<xsl:attribute name="fo:column-gap.value">
56  <xsl:value-of select="concat('(.(twips2cm[',w:cols/@w:space,'])[cm])')"/>
57</xsl:attribute>
58</xsl:if>
59
60<xsl:for-each select="w:cols/w:col">
61  <style:column>
62     <xsl:attribute name="style:rel-width.value">
63       <xsl:value-of select="concat('(.[',@w:w,'][*])')"/>
64     </xsl:attribute>
65     <xsl:attribute name="fo:start-indent.value">
66       <xsl:value-of select="'[0cm]'"/>
67     </xsl:attribute>
68     <xsl:attribute name="fo:end-indent.value">
69       <xsl:value-of select="concat('(.(twips2cm(|[',@w:space,'][0]))[cm])')"/>
70     </xsl:attribute>
71  </style:column>
72</xsl:for-each>
73</style:columns>
74</xsl:template>
75
76<an:text-properties
77     context-node-input="w:rPr"
78     context-node-output="style:text-properties">
79</an:text-properties >
80<xsl:template name="text-properties">
81<xsl:attribute name="fo:font-weight.value">
82 <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
83</xsl:attribute>
84<xsl:attribute name="style:font-weight-asian.value">
85 <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
86</xsl:attribute>
87<xsl:attribute name="style:font-weight-complex.value">
88 <xsl:value-of select="concat('(switch(|[',w:b-cs/@val,'][',local-name(w:b-cs),'])[on][bold][off][normal][b-cs][bold][])')"/>
89</xsl:attribute>
90<xsl:attribute name="fo:font-style.value">
91 <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
92</xsl:attribute>
93<xsl:attribute name="style:font-style-asian.value">
94 <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
95</xsl:attribute>
96<xsl:attribute name="style:font-style-complex.value">
97 <xsl:value-of select="concat('(switch(|[',w:i-cs/@val,'][',local-name(w:i-cs),'])[on][italic][off][normal][i-cs][italic][])')"/>
98</xsl:attribute>
99<xsl:attribute name="fo:text-transform.value">
100 <xsl:value-of select="concat('(switch(|[',w:caps/@val,'][',local-name(w:caps),'])[on][uppercase][off][normal][caps][uppercase][])')"/>
101</xsl:attribute>
102<xsl:attribute name="fo:font-variant.value">
103 <xsl:value-of select="concat('(switch(|[',w:smallCaps/@val,'][',local-name(w:smallCaps),'])[on][small-caps][off][normal][smallCaps][small-caps][])')"/>
104</xsl:attribute>
105</xsl:template>
106
107</xsl:stylesheet>