home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 January / PCWorld_2004-01_cd.bin / akce / openoffice / f_0384 / MsWordXMLImport.xsl
Extensible Markup Language  |  2003-06-30  |  83KB  |  1,598 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- #  The Contents of this file are made available subject to the terms of
  3.  #  either of the following licenses
  4.  #
  5.  #         - GNU Lesser General Public License Version 2.1
  6.  #         - Sun Industry Standards Source License Version 1.1
  7.  #
  8.  #  Sun Microsystems Inc., October, 2000
  9.  #
  10.  #  GNU Lesser General Public License Version 2.1
  11.  #  =============================================
  12.  #  Copyright 2000 by Sun Microsystems, Inc.
  13.  #  901 San Antonio Road, Palo Alto, CA 94303, USA
  14.  #
  15.  #  This library is free software; you can redistribute it and/or
  16.  #  modify it under the terms of the GNU Lesser General Public
  17.  #  License version 2.1, as published by the Free Software Foundation.
  18.  #
  19.  #  This library is distributed in the hope that it will be useful,
  20.  #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  22.  #  Lesser General Public License for more details.
  23.  #
  24.  #  You should have received a copy of the GNU Lesser General Public
  25.  #  License along with this library; if not, write to the Free Software
  26.  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  27.  #  MA  02111-1307  USA
  28.  #
  29.  #
  30.  #  Sun Industry Standards Source License Version 1.1
  31.  #  =================================================
  32.  #  The contents of this file are subject to the Sun Industry Standards
  33.  #  Source License Version 1.1 (the "License"); You may not use this file
  34.  #  except in compliance with the License. You may obtain a copy of the
  35.  #  License at http://www.openoffice.org/license.html.
  36.  #
  37.  #  Software provided under this License is provided on an "AS IS" basis,
  38.  #  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  39.  #  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  40.  #  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  41.  #  See the License for the specific provisions governing your rights and
  42.  #  obligations concerning the Software.
  43.  #
  44.  #  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  45.  #
  46.  #  Copyright: 2000 by Sun Microsystems, Inc.
  47.  #
  48.  #  All Rights Reserved.
  49.  #
  50.  #  Contributor(s): _______________________________________
  51.  #
  52.  #-->
  53. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:SL="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:office="http://openoffice.org/2000/office" xmlns:table="http://openoffice.org/2000/table" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" office:class="text" office:version="1.0">
  54.     <xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="UTF-8" version="1.0"/>
  55.     <!--<xsl:include href="mstables.xsl"/>
  56. <xsl:include href="mslists.xsl"/>
  57. <xsl:include href="styles.xsl"/>
  58. <xsl:include href="graphics.xsl"/>
  59. <xsl:include href="fields.xsl"/>-->
  60.     <xsl:template match="w:wordDocument">
  61.         <office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" office:class="text" office:version="1.0">
  62.             <xsl:apply-templates/>
  63.         </office:document>
  64.     </xsl:template>
  65.     <xsl:template match="w:body">
  66.         <xsl:element name="office:body">
  67.             <xsl:apply-templates/>
  68.         </xsl:element>
  69.     </xsl:template>
  70.     <xsl:template match="o:DocumentProperties"/>
  71.     <xsl:template match="w:p[child::w:pPr/w:listPr]">
  72.         <xsl:call-template name="genlist"/>
  73.     </xsl:template>
  74.     <xsl:template match="w:hlink">
  75.         <xsl:element name="text:a">
  76.             <xsl:attribute name="xlink:type">simple</xsl:attribute>
  77.             <xsl:attribute name="xlink:href"><xsl:value-of select="@w:dest"/></xsl:attribute>
  78.             <xsl:value-of select="descendant::w:t"/>
  79.         </xsl:element>
  80.     </xsl:template>
  81.     <xsl:template match="w:p">
  82.         <xsl:choose>
  83.             <!-- because word treats page breaks as separate tags, we must split some paragraphs up so that we can 
  84.             give the sub para a fo:break-before ="page" attribute
  85.         -->
  86.             <xsl:when test="child::w:r[child::w:br/@w:type='page']  ">
  87.                 <xsl:call-template name="processPageBreaks"/>
  88.             </xsl:when>
  89.             <xsl:otherwise>
  90.                 <xsl:call-template name="commonPara"/>
  91.             </xsl:otherwise>
  92.         </xsl:choose>
  93.         <!--<xsl:apply-templates/>-->
  94.     </xsl:template>
  95.     <xsl:template name="processPageBreaks">
  96.         <xsl:variable name="pageBreak" select="child::w:r[child::w:br/@w:type='page']"/>
  97.         <xsl:call-template name="createSubPara">
  98.             <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::w:r"/>
  99.             <xsl:with-param name="pageBreak"/>
  100.             <xsl:with-param name="needsPageBreak">false</xsl:with-param>
  101.         </xsl:call-template>
  102.         <xsl:for-each select="$pageBreak">
  103.             <xsl:call-template name="createSubPara">
  104.                 <xsl:with-param name="list" select="./following-sibling::w:r[preceding::w:r/child::w:br = '.']"/>
  105.                 <xsl:with-param name="pageBreak" select="."/>
  106.                 <xsl:with-param name="needsPageBreak">true</xsl:with-param>
  107.             </xsl:call-template>
  108.         </xsl:for-each>
  109.     </xsl:template>
  110.     <xsl:template name="createSubPara">
  111.         <xsl:param name="list"/>
  112.         <xsl:param name="pageBreak"/>
  113.         <xsl:param name="needsPageBreak"/>
  114.         <xsl:if test="(count($list) > 0) or ($needsPageBreak ='true') ">
  115.             <xsl:element name="text:p">
  116.                 <xsl:choose>
  117.                     <xsl:when test="$needsPageBreak = 'true'">
  118.                         <xsl:choose>
  119.                             <xsl:when test="ancestor::w:p/w:pPr">
  120.                                 <xsl:attribute name="text:style-name">P<xsl:value-of select="count(ancestor::w:p/w:pPr/preceding::w:pPr)"/></xsl:attribute>
  121.                             </xsl:when>
  122.                             <xsl:otherwise>
  123.                                 <xsl:attribute name="text:style-name">PageBreak</xsl:attribute>
  124.                             </xsl:otherwise>
  125.                         </xsl:choose>
  126.                     </xsl:when>
  127.                     <xsl:otherwise>
  128.                         <xsl:attribute name="text:style-name">Normal</xsl:attribute>
  129.                     </xsl:otherwise>
  130.                 </xsl:choose>
  131.                 <xsl:if test="$pageBreak">
  132.                     <xsl:apply-templates select="$pageBreak"/>
  133.                 </xsl:if>
  134.                 <xsl:apply-templates select="$list"/>
  135.             </xsl:element>
  136.         </xsl:if>
  137.     </xsl:template>
  138.     <xsl:template name="commonPara">
  139.         <!-- Heading or normal para-->
  140.         <xsl:choose>
  141.             <xsl:when test="(child::w:pPr/w:pStyle/@w:val='Heading1') or (child::w:pPr/w:pStyle/@w:val='Heading2') or 
  142.                         (child::w:pPr/w:pStyle/@w:val='Heading3') or  (child::w:pPr/w:pStyle/@w:val='Heading4') or 
  143.                         (child::w:pPr/w:pStyle/@w:val='Heading5') or  (child::w:pPr/w:pStyle/@w:val='Heading6') or  
  144.                         (child::w:pPr/w:pStyle/@w:val='Heading7') or  (child::w:pPr/w:pStyle/@w:val='Heading8') or  
  145.                         (child::w:pPr/w:pStyle/@w:val='Heading9')">
  146.                 <xsl:variable name="styleid" select="child::w:pPr/w:pStyle/@w:val"/>
  147.                 <xsl:element name="text:h">
  148.                     <xsl:variable name="outlinelevel" select="number(/descendant::w:style[@w:styleId = $styleid]/w:pPr/w:outlineLvl/@w:val)+1"/>
  149.                     <xsl:if test="$outlinelevel">
  150.                         <xsl:attribute name="text:level"><xsl:value-of select="$outlinelevel"/></xsl:attribute>
  151.                     </xsl:if>
  152.                     <xsl:call-template name="commonParaAttribs"/>
  153.                 </xsl:element>
  154.             </xsl:when>
  155.             <xsl:otherwise>
  156.                 <xsl:element name="text:p">
  157.                     <xsl:call-template name="commonParaAttribs"/>
  158.                 </xsl:element>
  159.             </xsl:otherwise>
  160.         </xsl:choose>
  161.     </xsl:template>
  162.     <xsl:template name="commonParaAttribs">
  163.         <!-- Common  paragraph attributes-->
  164.         <xsl:choose>
  165.             <xsl:when test="child::w:pPr">
  166.                 <!--<xsl:choose>
  167.                     <xsl:when test="child::w:pPr/w:pStyle">
  168.                         <xsl:attribute name="text:style-name"><xsl:value-of select="child::w:pPr/w:pStyle/@w:val"/></xsl:attribute>
  169.                     </xsl:when>
  170.                     <xsl:otherwise>
  171.                         <xsl:attribute name="text:style-name">P<xsl:value-of select="count(preceding::w:pPr)"/></xsl:attribute>
  172.                     </xsl:otherwise>
  173.                 </xsl:choose>-->
  174.                 <xsl:attribute name="text:style-name">P<xsl:value-of select="count(preceding::w:pPr)"/></xsl:attribute>
  175.             </xsl:when>
  176.             <xsl:when test="not(child::w:pPr) and (descendant::w:br[@w:type = 'column'] or ancestor::wx:sect/descendant::w:sectPr[w:cols/@w:num > 1])">
  177.                 <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
  178.             </xsl:when>
  179.             <xsl:otherwise>
  180.                 <xsl:attribute name="text:style-name">Normal</xsl:attribute>
  181.             </xsl:otherwise>
  182.         </xsl:choose>
  183.         <xsl:apply-templates select="child::*"/>
  184.     </xsl:template>
  185.     <xsl:template match="w:pPr"/>
  186.     <xsl:template match="w:rPr"/>
  187.     <xsl:template match="wx:sect">
  188.         <xsl:apply-templates/>
  189.     </xsl:template>
  190.     <xsl:template match="wx:sub-section">
  191.         <xsl:apply-templates/>
  192.     </xsl:template>
  193.     <xsl:template match="w:t">
  194.         <xsl:choose>
  195.             <xsl:when test="string(.) = ' ' ">
  196.                 <xsl:element name="text:s"/>
  197.             </xsl:when>
  198.             <xsl:when test="contains(.,'  ')">
  199.                 <xsl:call-template name="replace-spaces">
  200.                     <xsl:with-param name="curr-string" select="."/>
  201.                 </xsl:call-template>
  202.             </xsl:when>
  203.             <xsl:otherwise>
  204.                 <xsl:apply-templates/>
  205.             </xsl:otherwise>
  206.         </xsl:choose>
  207.     </xsl:template>
  208.     <xsl:template name="replace-spaces">
  209.         <xsl:param name="curr-string"/>
  210.         <xsl:if test="contains($curr-string,'  ')">
  211.             <xsl:value-of select="substring-before($curr-string,' ')"/>
  212.             <xsl:element name="text:s">
  213.                 <xsl:attribute name="text:c">2</xsl:attribute>
  214.             </xsl:element>
  215.             <xsl:variable name="next-string" select="substring-after($curr-string,'  ')"/>
  216.             <xsl:choose>
  217.                 <xsl:when test="contains($next-string, '  ')">
  218.                     <xsl:call-template name="replace-spaces">
  219.                         <xsl:with-param name="curr-string" select="$next-string"/>
  220.                     </xsl:call-template>
  221.                 </xsl:when>
  222.                 <xsl:otherwise>
  223.                     <xsl:value-of select="$next-string"/>
  224.                 </xsl:otherwise>
  225.             </xsl:choose>
  226.         </xsl:if>
  227.     </xsl:template>
  228.     <xsl:template match="w:tab">
  229.         <xsl:element name="text:tab-stop"/>
  230.     </xsl:template>
  231.     <xsl:template match="w:hdr">
  232.         <!-- empty template to ignore inline processing of header
  233.         These are handled as part of the master style in styles.xsl
  234.     -->
  235.     </xsl:template>
  236.     <xsl:template match="w:ftr">
  237.         <!-- empty template to ignore inline processing of header
  238.         These are handled as part of the master style in styles.xsl
  239.     -->
  240.     </xsl:template>
  241.     <xsl:template match="w:docPr"/>
  242.     <xsl:template match="w:r">
  243.         <xsl:variable name="body" select="ancestor::w:body"/>
  244.         <xsl:if test="child::w:br[@w:type='text-wrapping'] or child::w:br[not(@w:type)]">
  245.             <xsl:element name="text:line-break"/>
  246.         </xsl:if>
  247.         <xsl:choose>
  248.             <!--<xsl:when test="child::w:br[@w:type='text-wrapping'] and not(child::w:t)">
  249.             <xsl:element name="text:p"> 
  250.             </xsl:element>
  251.         </xsl:when>-->
  252.             <xsl:when test="child::w:rPr/w:vanish">
  253.                 <xsl:element name="text:hidden-text">
  254.                     <xsl:attribute name="text:is-hidden">false</xsl:attribute>
  255.                     <xsl:attribute name="text:condition">hide==1</xsl:attribute>
  256.                     <xsl:attribute name="text:string-value"><xsl:value-of select="."/></xsl:attribute>
  257.                     <xsl:apply-templates/>
  258.                 </xsl:element>
  259.             </xsl:when>
  260.             <xsl:when test="(preceding-sibling::w:r) or (child::w:rPr)">
  261.                 <xsl:element name="text:span">
  262.                     <!--<xsl:if test="child::w:rPr">
  263.                             <xsl:attribute name="text:style-name">T<xsl:value-of select="count(preceding::w:rPr)"/></xsl:attribute>
  264.                     </xsl:if>        -->
  265.                     <xsl:choose>
  266.                         <xsl:when test="child::w:rPr/w:rStyle">
  267.                             <xsl:attribute name="text:style-name"><xsl:value-of select="child::w:rPr/w:rStyle/@w:val"/></xsl:attribute>
  268.                         </xsl:when>
  269.                         <xsl:when test="child::w:rPr">
  270.                             <xsl:attribute name="text:style-name">T<xsl:value-of select="count(preceding::w:rPr)"/></xsl:attribute>
  271.                         </xsl:when>
  272.                         <!--<xsl:when test="child::w:br/@w:type='page'">
  273.                                 <xsl:attribute name="text:style-name">PageBreak</xsl:attribute>
  274.                         </xsl:when>-->
  275.                     </xsl:choose>
  276.                     <!--<xsl:if test="not(child::w:rPr) and ((count($body/preceding::w:rPr) - count($body/descendant::w:rPr))> 0)">
  277.                             <xsl:attribute name="text:style-name">T<xsl:value-of select="count(preceding::w:rPr)"/></xsl:attribute>
  278.                     </xsl:if>-->
  279.                     <!--<xsl:apply-templates select="w:t"/>-->
  280.                     <xsl:apply-templates/>
  281.                 </xsl:element>
  282.             </xsl:when>
  283.             <xsl:otherwise>
  284.                 <xsl:apply-templates/>
  285.             </xsl:otherwise>
  286.         </xsl:choose>
  287.     </xsl:template>
  288.     <xsl:template match="wx:sect">
  289.         <xsl:apply-templates/>
  290.     </xsl:template>
  291.     <!-- Paragraph properties-->
  292.     <!--<xsl:template match="w:rPr[ancestor::w:body]">
  293.         <xsl:attribute name="text:style-name">T<xsl:value-of select="count(preceding::w:rPr)+count(preceding::w:pPr)+1"/></xsl:attribute>
  294.         <xsl:apply-templates select="descendant::*"/>
  295. </xsl:template>
  296.  
  297. <xsl:template match="w:pPr[ancestor::w:body]">
  298.         <xsl:attribute name="text:style-name">T<xsl:value-of select="count(preceding::w:rPr)+count(preceding::w:pPr)+1"/></xsl:attribute>
  299.         <xsl:apply-templates select="w:rPr"/>
  300. </xsl:template>-->
  301.     <xsl:template match="wx:font[ancestor::w:fonts]">
  302.         <xsl:if test="not(ancestor::w:p)">
  303.             <xsl:attribute name="style:font-name"><xsl:value-of select="@wx:val"/></xsl:attribute>
  304.             <xsl:apply-templates/>
  305.         </xsl:if>
  306.     </xsl:template>
  307.     <xsl:template match="w:pStyle">
  308.         <xsl:if test="not(ancestor-or-self::w:styles)">
  309.             <xsl:choose>
  310.                 <xsl:when test="not(@w:val = '')">
  311.                     <xsl:attribute name="text:style-name"><xsl:value-of select="@w:val"/></xsl:attribute>
  312.                 </xsl:when>
  313.                 <xsl:otherwise>
  314.                     <xsl:attribute name="text:style-name">Normal</xsl:attribute>
  315.                 </xsl:otherwise>
  316.             </xsl:choose>
  317.             <xsl:apply-templates/>
  318.         </xsl:if>
  319.     </xsl:template>
  320.     <xsl:template match="w:sz">
  321.         <xsl:attribute name="fo:font-size"><xsl:value-of select="number(@w:val) div 2 "/>pt</xsl:attribute>
  322.         <xsl:apply-templates/>
  323.     </xsl:template>
  324.     <xsl:template match="w:i">
  325.         <xsl:attribute name="fo:font-style">italic</xsl:attribute>
  326.         <xsl:apply-templates/>
  327.     </xsl:template>
  328.     <xsl:template match="w:b">
  329.         <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
  330.         <xsl:apply-templates/>
  331.     </xsl:template>
  332.     <xsl:template match="w:u">
  333.         <xsl:attribute name="style:text-underline"><xsl:value-of select="@w:val"/></xsl:attribute>
  334.         <xsl:if test="@w:color">
  335.             <xsl:attribute name="style:text-underline-color">#<xsl:value-of select="@w:color"/></xsl:attribute>
  336.         </xsl:if>
  337.         <xsl:apply-templates/>
  338.     </xsl:template>
  339.     <xsl:template match="w:vertAlign">
  340.         <xsl:attribute name="style:text-position"><xsl:choose><xsl:when test="@w:val = 'superscript'">super 58%</xsl:when><xsl:when test="@w:val = 'subscript'">sub 58%</xsl:when></xsl:choose></xsl:attribute>
  341.         <xsl:apply-templates/>
  342.     </xsl:template>
  343.     <xsl:template match="w:shadow">
  344.         <xsl:attribute name="style:text-shadow">1pt 1pt</xsl:attribute>
  345.         <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
  346.         <xsl:apply-templates/>
  347.     </xsl:template>
  348.     <xsl:template match="w:strike">
  349.         <xsl:attribute name="style:text-crossing-out">single-line</xsl:attribute>
  350.         <xsl:apply-templates/>
  351.     </xsl:template>
  352.     <xsl:template match="w:dstrike">
  353.         <xsl:attribute name="style:text-crossing-out">double-line</xsl:attribute>
  354.         <xsl:apply-templates/>
  355.     </xsl:template>
  356.     <xsl:template match="w:color">
  357.         <xsl:attribute name="fo:color">#<xsl:value-of select="@w:val"/></xsl:attribute>
  358.         <xsl:apply-templates/>
  359.     </xsl:template>
  360.     <xsl:template match="w:smallCaps">
  361.         <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
  362.         <xsl:apply-templates/>
  363.     </xsl:template>
  364.     <xsl:template match="w:caps">
  365.         <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
  366.         <xsl:apply-templates/>
  367.     </xsl:template>
  368.     <xsl:template match="w:imprint">
  369.         <xsl:attribute name="style:font-relief">engraved</xsl:attribute>
  370.         <xsl:apply-templates/>
  371.     </xsl:template>
  372.     <xsl:template match="w:emboss">
  373.         <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
  374.         <xsl:apply-templates/>
  375.     </xsl:template>
  376.     <xsl:template match="w:outline">
  377.         <xsl:attribute name="style:text-outline">true</xsl:attribute>
  378.         <xsl:apply-templates/>
  379.     </xsl:template>
  380.     <xsl:template match="w:listPr/wx:font"/>
  381.     <xsl:template match="wx:font">
  382.         <xsl:attribute name="style:font-name"><xsl:value-of select="@wx:val"/></xsl:attribute>
  383.         <xsl:apply-templates/>
  384.     </xsl:template>
  385.     <!-- <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Normal">
  386.             <style:properties style:text-underline="single" style:text-underline-color="font-color"/>
  387.         </style:style>
  388.         <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Normal">
  389.             <style:properties fo:font-weight="bold"/>
  390.         </style:style>
  391.         <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Normal">
  392.             <style:properties fo:font-style="italic"/>
  393.         </style:style>
  394.         <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Normal">
  395.             <style:properties style:text-crossing-out="single-line"/> <w:strike/> <w:strike>
  396.         </style:style>
  397.         <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Normal">
  398.             <style:properties style:text-position="super 58%"/>     <w:vertAlign w:val="superscript"/>
  399.         </style:style>
  400.         <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Normal">
  401.             <style:properties style:text-position="sub 58%"/>         <w:vertAlign w:val="subscript"/>
  402.         </style:style>
  403.         <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Normal">
  404.             <style:properties fo:text-shadow="1pt 1pt"/> <w:shadow>
  405.         </style:style>
  406.         <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Normal">
  407.             <style:properties style:text-outline="true"/>
  408.         </style:style>
  409.         <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Normal">
  410.             <style:properties fo:font-style="italic" fo:font-weight="bold"/>
  411.         </style:style>
  412.         <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Normal">
  413.             <style:properties style:text-underline="double" style:text-underline-color="font-color"/>
  414.         </style:style>
  415. -->
  416.     <!-- <style:style style:name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text body" style:class="text">
  417.             <style:properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold"  style:font-name-complex="Tahoma1"/>
  418.         </style:style>
  419.  
  420.  
  421.         
  422.         <w:style w:type="paragraph" w:default="on" w:styleId="Normal">
  423.             <w:name w:val="Normal"/>
  424.             <w:rsid w:val="CA2749"/>
  425.             <w:rPr>
  426.                 <wx:font wx:val="Times New Roman"/>
  427.                 <w:sz w:val="24"/>
  428.                 <w:sz-cs w:val="24"/>
  429.                 <w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/>
  430.             </w:rPr>
  431.         </w:style>
  432.  
  433.         
  434.         -->
  435.     <xsl:template match="w:fonts">
  436.         <xsl:element name="office:font-decls">
  437.             <style:font-decl style:name="Arial" fo:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
  438.             <style:font-decl style:name="Times New Roman" fo:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
  439.             <!-- <style:font-decl style:name="Microsoft Sans Serif" fo:font-family="'Microsoft Sans Serif'" style:font-family-generic="swiss" style:font-pitch="variable"/>-->
  440.             <style:font-decl style:name="Symbol" fo:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
  441.             <xsl:if test="not(/w:wordDocument/w:fonts/w:font[@w:name='StarSymbol'])">
  442.                 <style:font-decl style:name="StarSymbol" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
  443.             </xsl:if>
  444.             <style:font-decl style:name="Courier New" fo:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
  445.             <xsl:apply-templates/>
  446.         </xsl:element>
  447.     </xsl:template>
  448.     <xsl:template match="w:font">
  449.         <xsl:element name="style:font-decl">
  450.             <xsl:attribute name="style:name"><xsl:value-of select="@w:name"/></xsl:attribute>
  451.             <xsl:attribute name="fo:font-family"><xsl:value-of select="@w:name"/></xsl:attribute>
  452.             <xsl:apply-templates/>
  453.         </xsl:element>
  454.     </xsl:template>
  455.     <xsl:template match="w:family">
  456.         <xsl:attribute name="style:font-family-generic"><xsl:choose><xsl:when test="@w:val = 'Swiss'">swiss</xsl:when><xsl:when test="@w:val='Modern'">modern</xsl:when><xsl:when test="@w:val='Roman'">roman</xsl:when><xsl:when test="@w:val='Script'">script</xsl:when><xsl:when test="@w:val='Decorative'">decorative</xsl:when><xsl:when test="@w:val='System'">system</xsl:when></xsl:choose></xsl:attribute>
  457.     </xsl:template>
  458.     <xsl:template match="w:pitch">
  459.         <xsl:attribute name="style:font-pitch"><xsl:value-of select="@w:val"/></xsl:attribute>
  460.     </xsl:template>
  461.     <!-- 
  462. <w:fonts>
  463.         <w:defaultFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" w:cs="Times New Roman"/>
  464.         <w:font w:name="Tahoma">
  465.             <w:panose-1 w:val="020B0604030504040204"/>
  466.             <w:charset w:val="00"/>
  467.             <w:family w:val="Swiss"/>
  468.             <w:pitch w:val="variable"/>
  469.             <w:sig w:usb-0="61007A87" w:usb-1="80000000" w:usb-2="00000008" w:usb-3="00000000" w:csb-0="000101FF" w:csb-1="00000000"/>
  470.         </w:font>
  471.         <w:font w:name="Palatino">
  472.             <w:panose-1 w:val="00000000000000000000"/>
  473.             <w:charset w:val="00"/>
  474.             <w:family w:val="Roman"/>
  475.             <w:notTrueType/>
  476.             <w:pitch w:val="variable"/>
  477.             <w:sig w:usb-0="00000003" w:usb-1="00000000" w:usb-2="00000000" w:usb-3="00000000" w:csb-0="00000001" w:csb-1="00000000"/>
  478.         </w:font>
  479.     </w:fonts>
  480.     
  481.         <style:font-decl style:name="Andale Sans UI" fo:font-family="'Andale Sans UI'" style:font-pitch="variable"/>
  482.         <style:font-decl style:name="Thorndale" fo:font-family="Thorndale" style:font-family-generic="roman" style:font-pitch="variable"/>
  483.  
  484.     
  485. -->
  486.     <xsl:template match="wx:sect">
  487.         <!-- We handle Columns as seperate Sections to allow for different numbers of columns on the same page-->
  488.         <xsl:choose>
  489.             <xsl:when test="descendant::w:sectPr[w:cols/@w:num > 1]">
  490.                 <xsl:element name="text:section">
  491.                     <xsl:attribute name="text:style-name">sect<xsl:value-of select="count(preceding::w:sectPr[child::w:cols/@w:num >1])"/></xsl:attribute>
  492.                     <xsl:attribute name="text:name">sect<xsl:value-of select="count(preceding::w:sectPr[child::w:cols/@w:num >1])"/></xsl:attribute>
  493.                     <xsl:apply-templates/>
  494.                 </xsl:element>
  495.             </xsl:when>
  496.             <xsl:otherwise>
  497.                 <xsl:apply-templates/>
  498.             </xsl:otherwise>
  499.         </xsl:choose>
  500.     </xsl:template>
  501.     <xsl:template match="*">
  502.         <xsl:apply-templates/>
  503.     </xsl:template>
  504.     <!-- 
  505.     Style Handling 
  506.  
  507. -->
  508.     <!--Styles-->
  509.     <xsl:template match="w:styles">
  510.         <xsl:element name="office:styles">
  511.             <style:style style:name="Numbering Symbols" style:family="text"/>
  512.             <style:style style:name="ColumnBreakPara" style:family="paragraph">
  513.                 <style:properties fo:break-after="column"/>
  514.             </style:style>
  515.             <xsl:element name="style:default-style">
  516.                 <xsl:attribute name="style:family">paragraph</xsl:attribute>
  517.                 <xsl:element name="style:properties">
  518.                     <xsl:attribute name="style:font-name"><xsl:choose><!--    <w:defaultFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" w:cs="Times New Roman"/>
  519.  --><xsl:when test="preceding::w:fonts/w:defaultFonts"><xsl:value-of select="preceding::w:fonts/w:defaultFonts/@w:ascii"/></xsl:when><xsl:otherwise><xsl:text>Times New Roman</xsl:text></xsl:otherwise></xsl:choose></xsl:attribute>
  520.                     <xsl:attribute name="style:tab-stop-distance"><xsl:value-of select="(number(/descendant::w:docPr/w:defaultTabStop/@w:val)div 1440)*2.54"/>cm</xsl:attribute>
  521.                 </xsl:element>
  522.             </xsl:element>
  523.             <xsl:apply-templates/>
  524.             <style:style style:name="Bullet Symbols" style:family="text">
  525.                 <style:properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/>
  526.             </style:style>
  527.         </xsl:element>
  528.         <xsl:element name="office:automatic-styles">
  529.             <xsl:element name="style:style">
  530.                 <xsl:attribute name="style:name">PageBreak</xsl:attribute>
  531.                 <xsl:attribute name="style:family">paragraph</xsl:attribute>
  532.                 <xsl:attribute name="style:parent-style-name">Normal</xsl:attribute>
  533.                 <xsl:element name="style:properties">
  534.                     <xsl:attribute name="fo:break-before">page</xsl:attribute>
  535.                 </xsl:element>
  536.             </xsl:element>
  537.             <xsl:for-each select="/descendant::w:rPr">
  538.                 <style:style>
  539.                     <xsl:attribute name="style:name">T<xsl:value-of select="count(preceding::w:rPr)"/></xsl:attribute>
  540.                     <xsl:choose>
  541.                         <xsl:when test="@w:type">
  542.                             <xsl:choose>
  543.                                 <xsl:when test="@w:type = 'character' ">
  544.                                     <xsl:attribute name="style:family">text</xsl:attribute>
  545.                                 </xsl:when>
  546.                                 <xsl:when test="@w:type = 'list' ">
  547.                                     <xsl:attribute name="style:family">text</xsl:attribute>
  548.                                 </xsl:when>
  549.                                 <xsl:otherwise>
  550.                                     <xsl:attribute name="style:family"><xsl:value-of select="@w:type"/></xsl:attribute>
  551.                                 </xsl:otherwise>
  552.                             </xsl:choose>
  553.                         </xsl:when>
  554.                         <xsl:when test="ancestor::w:pPr">
  555.                             <xsl:attribute name="style:family">paragraph</xsl:attribute>
  556.                         </xsl:when>
  557.                         <xsl:otherwise>
  558.                             <xsl:attribute name="style:family">text</xsl:attribute>
  559.                         </xsl:otherwise>
  560.                     </xsl:choose>
  561.                     <xsl:choose>
  562.                         <xsl:when test="child::w:rStyle">
  563.                             <xsl:attribute name="style:parent-style-name"><xsl:value-of select="child::w:rStyle/@w:val"/></xsl:attribute>
  564.                         </xsl:when>
  565.                         <xsl:otherwise>
  566.                             <xsl:attribute name="style:parent-style-name">Normal</xsl:attribute>
  567.                         </xsl:otherwise>
  568.                     </xsl:choose>
  569.                     <xsl:element name="style:properties">
  570.                         <xsl:apply-templates select="child::*"/>
  571.                     </xsl:element>
  572.                 </style:style>
  573.             </xsl:for-each>
  574.             <xsl:for-each select="/descendant::w:pPr">
  575.                 <style:style>
  576.                     <xsl:attribute name="style:name">P<xsl:value-of select="count(preceding::w:pPr)"/></xsl:attribute>
  577.                     <xsl:choose>
  578.                         <xsl:when test="@w:type">
  579.                             <xsl:choose>
  580.                                 <xsl:when test="@w:type = 'character' ">
  581.                                     <xsl:attribute name="style:family">text</xsl:attribute>
  582.                                 </xsl:when>
  583.                                 <xsl:when test="@w:type = 'list' ">
  584.                                     <xsl:attribute name="style:family">text</xsl:attribute>
  585.                                 </xsl:when>
  586.                                 <xsl:otherwise>
  587.                                     <xsl:attribute name="style:family"><xsl:value-of select="@w:type"/></xsl:attribute>
  588.                                 </xsl:otherwise>
  589.                             </xsl:choose>
  590.                         </xsl:when>
  591.                         <xsl:when test="parent::w:p">
  592.                             <xsl:attribute name="style:family">paragraph</xsl:attribute>
  593.                         </xsl:when>
  594.                         <xsl:otherwise>
  595.                             <xsl:attribute name="style:family">text</xsl:attribute>
  596.                         </xsl:otherwise>
  597.                     </xsl:choose>
  598.                     <xsl:choose>
  599.                         <xsl:when test="child::w:pStyle">
  600.                             <xsl:attribute name="style:parent-style-name"><xsl:value-of select="child::w:pStyle/@w:val"/></xsl:attribute>
  601.                         </xsl:when>
  602.                         <xsl:otherwise>
  603.                             <xsl:attribute name="style:parent-style-name">Normal</xsl:attribute>
  604.                         </xsl:otherwise>
  605.                     </xsl:choose>
  606.                     <!-- We don't want to change the page style if there are columns being created. 
  607.                     The Columns will be handled by using in-line sections.-->
  608.                     <xsl:if test="not(ancestor::wx:sect[1]/descendant::w:sectPr/w:cols[@w:num > 1])">
  609.                         <xsl:variable name="parentpara" select="parent::w:p"/>
  610.                         <xsl:if test="generate-id(ancestor::wx:sect/descendant::w:p[1]) = generate-id($parentpara)">
  611.                             <xsl:choose>
  612.                                 <xsl:when test="not(count(preceding::wx:sect) > 0)">
  613.                                     <xsl:attribute name="style:master-page-name">Standard</xsl:attribute>
  614.                                 </xsl:when>
  615.                                 <xsl:otherwise>
  616.                                     <xsl:attribute name="style:master-page-name">Standard<xsl:value-of select="number(count(preceding::wx:sect) )"/></xsl:attribute>
  617.                                 </xsl:otherwise>
  618.                             </xsl:choose>
  619.                         </xsl:if>
  620.                     </xsl:if>
  621.                     <xsl:variable name="rootPara" select="parent::w:p"/>
  622.                     <xsl:if test="$rootPara/descendant::w:br[@w:type = 'page']">
  623.                         <!--<w:br w:type="page"/>
  624.         <style:properties fo:margin-left="0.026cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false" fo:break-before="page"/>
  625.                                 -->
  626.                         <xsl:if test="not(ancestor::wx:sect[1]/descendant::w:sectPr/w:cols[@w:num > 1]) and not($rootPara/descendant::w:br/@w:type='text-wrapping')">
  627.                             <xsl:variable name="parentsect" select="ancestor::wx:sect"/>
  628.                             <xsl:choose>
  629.                                 <xsl:when test="following::w:sectPr">
  630.                                     <xsl:choose>
  631.                                         <xsl:when test="not(count(preceding::wx:sect) > 0)">
  632.                                             <xsl:attribute name="style:master-page-name">Standard</xsl:attribute>
  633.                                         </xsl:when>
  634.                                         <xsl:otherwise>
  635.                                             <xsl:attribute name="style:master-page-name">Standard<xsl:value-of select="number(count(preceding::wx:sect) )"/></xsl:attribute>
  636.                                         </xsl:otherwise>
  637.                                     </xsl:choose>
  638.                                 </xsl:when>
  639.                                 <xsl:otherwise>
  640.                                     <xsl:attribute name="fo:break-before"><xsl:value-of select="$rootPara/descendant::w:br/@w:type"/></xsl:attribute>
  641.                                 </xsl:otherwise>
  642.                             </xsl:choose>
  643.                         </xsl:if>
  644.                     </xsl:if>
  645.                     <xsl:element name="style:properties">
  646.                         <xsl:if test="parent::w:p">
  647.                             <!-- Initial indent values-->
  648.                             <!--<xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
  649.                         <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
  650.                         <xsl:attribute name="fo:text-indent">0cm</xsl:attribute>-->
  651.                             <xsl:call-template name="paragraph-alignment"/>
  652.                         </xsl:if>
  653.                         <xsl:if test="not(ancestor::wx:sect = following::w:pPr/ancestor::wx:sect)">
  654.                             <!--<xsl:attribute name="fo:break-after">page</xsl:attribute>-->
  655.                         </xsl:if>
  656.                         <xsl:apply-templates select="parent::w:p/child::w:rPr/*[not(name() = 'w:tabs')]"/>
  657.                         <xsl:apply-templates select="child::*[not(name() = 'w:tabs')]"/>
  658.                     </xsl:element>
  659.                 </style:style>
  660.             </xsl:for-each>
  661.             <xsl:for-each select="/descendant::w:gridCol ">
  662.                 <style:style>
  663.                     <xsl:variable name="tableRoot" select="ancestor::w:tbl"/>
  664.                     <xsl:attribute name="style:name">TColumn<xsl:value-of select="count(preceding::w:gridCol)"/></xsl:attribute>
  665.                     <xsl:attribute name="style:family">table-column</xsl:attribute>
  666.                     <xsl:element name="style:properties">
  667.                         <xsl:attribute name="style:column-width"><xsl:choose><xsl:when test="$tableRoot/w:tblPr/w:tblW/@w:type = 'pct'"><xsl:variable name="pageSize" select="number(/descendant::w:body/wx:sect/w:sectPr/w:pgSz/@w:w)"/><xsl:variable name="pageLeftMar" select="number(/descendant::w:body/wx:sect/w:sectPr/w:pgMar/@w:left)"/><xsl:variable name="pageRightMar" select="number(/descendant::w:body/wx:sect/w:sectPr/w:pgMar/@w:right)"/><xsl:variable name="pctTotal" select="$tableRoot/w:tblPr/w:tblW/@w:w"/><xsl:variable name="prevCols" select="count(preceding-sibling::w:gridCol)"/><xsl:variable name="relSize" select="$tableRoot/w:tr[1]/w:tc[$prevCols+1]/w:tcPr/w:tcW/@w:w"/><!--<xsl:value-of select="$relSize"/>
  668.                             <xsl:text> </xsl:text>
  669.                             <xsl:value-of select="$pctTotal"/>
  670.                             <xsl:text> </xsl:text>
  671.                             <xsl:value-of select="$pageSize"/>
  672.                             <xsl:text> </xsl:text>--><xsl:value-of select="(number(($relSize div $pctTotal) * ($pageSize - ($pageLeftMar + $pageRightMar))) div 1440) *2.54"/><!-- 
  673.                                 <w:tblPr>
  674.                     <w:tblStyle w:val="TableGrid"/>
  675.                     <w:tblW w:w="0" w:type="auto"/>
  676.                     <w:tblLook w:val="000001E0"/>
  677.                 </w:tblPr>
  678.  
  679.                         
  680.                             <xsl:variable name="percentTotal" select="child::w:tblW/@w:w"/>
  681.                             <xsl:variable name="aRow" select="following-sibling::w:tr[1]/w:tc/w:tcPr/w:tcW/@w:w"/>
  682.                             <xsl:for-each select="$aRow">
  683.                         
  684.                                 --></xsl:when><xsl:otherwise><xsl:value-of select="(number(@w:w) div 1440) *2.54"/></xsl:otherwise></xsl:choose><xsl:text>cm</xsl:text></xsl:attribute>
  685.                     </xsl:element>
  686.                 </style:style>
  687.             </xsl:for-each>
  688.             <xsl:for-each select="/descendant::w:tblPr">
  689.                 <xsl:element name="style:style">
  690.                     <xsl:attribute name="style:name">TTable<xsl:value-of select="count(preceding::w:tblPr)"/></xsl:attribute>
  691.                     <xsl:attribute name="style:family">table</xsl:attribute>
  692.                     <xsl:element name="style:properties">
  693.                         <!-- Hard coded to be over-ridden later-->
  694.                         <xsl:attribute name="table:align">left</xsl:attribute>
  695.                         <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute>
  696.                         <!-- <w:tblW w:w="5000" w:type="pct"/>-->
  697.                         <!-- Setting table margins using cell padding-->
  698.                         <xsl:if test="child::w:tblStyle/@w:val">
  699.                             <xsl:variable name="rootStyle" select="child::w:tblStyle/@w:val"/>
  700.                             <xsl:variable name="rootStyleNode" select="/descendant::w:style[@w:styleId = $rootStyle]"/>
  701.                             <xsl:variable name="paddingleft">
  702.                                 <xsl:value-of select="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:left/@w:w"/>
  703.                             </xsl:variable>
  704.                             <xsl:variable name="paddingright">
  705.                                 <xsl:value-of select="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:right/@w:w"/>
  706.                             </xsl:variable>
  707.                             <xsl:variable name="paddingtop">
  708.                                 <xsl:value-of select="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:top/@w:w"/>
  709.                             </xsl:variable>
  710.                             <xsl:variable name="paddingbottom">
  711.                                 <xsl:value-of select="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:bottom/@w:w"/>
  712.                             </xsl:variable>
  713.                             <xsl:if test="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:left">
  714.                                 <xsl:attribute name="fo:margin-left">-<xsl:value-of select="(number($paddingleft) div 1440) *2.54"/>cm</xsl:attribute>
  715.                             </xsl:if>
  716.                             <!--
  717.                         <xsl:if test="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:right">
  718.                             <xsl:attribute name="fo:margin-right">-<xsl:value-of select="(number($paddingright) div 1440) *2.54"/>cm</xsl:attribute>
  719.                         </xsl:if>
  720.                         -->
  721.                         </xsl:if>
  722.                         <xsl:choose>
  723.                             <xsl:when test="child::w:tblW/@w:type ='pct'">
  724.                                 <xsl:variable name="sectPr" select="/descendant::wx:sect/w:sectPr"/>
  725.                                 <xsl:variable name="pageSize" select="number($sectPr/w:pgSz/@w:w)"/>
  726.                                 <xsl:variable name="pageLeftMar" select="number($sectPr/w:pgMar/@w:left)"/>
  727.                                 <xsl:variable name="pageRightMar" select="number($sectPr/w:pgMar/@w:right)"/>
  728.                                 <xsl:attribute name="style:width"><xsl:value-of select="((    (number($sectPr/w:pgSz/@w:w) - number($pageLeftMar + $pageRightMar)  +(113 *2))div 1440)*2.54)*(number(child::w:tblW/@w:w) div 5000)"/><xsl:text>cm</xsl:text></xsl:attribute>
  729.                             </xsl:when>
  730.                             <xsl:otherwise>
  731.                                 <xsl:variable name="colwidth" select="parent::w:tbl"/>
  732.                                 <xsl:variable name="gridcols" select="$colwidth/w:tblGrid/w:gridCol"/>
  733.                                 <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/>
  734.                                 <xsl:if test="not($tblsize='0')">
  735.                                     <xsl:attribute name="style:width"><xsl:choose><xsl:when test="child::w:tblInd"><xsl:value-of select="(number($tblsize -  child::w:tblInd/@w:w) div 1440)*2.54"/></xsl:when><xsl:otherwise><xsl:value-of select="(number($tblsize  ) div 1440)*2.54"/></xsl:otherwise></xsl:choose><xsl:text>cm</xsl:text></xsl:attribute>
  736.                                 </xsl:if>
  737.                                 <!-- If previous w:p has a page break, the table must have
  738.                                  the page break attribute applied to it
  739.                             -->
  740.                                 <!-- May need this for tables starting on new pages-->
  741.                                 <!--<xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']">
  742.                                 <xsl:attribute name="fo:break-before">page</xsl:attribute>
  743.                             </xsl:if>-->
  744.                             </xsl:otherwise>
  745.                         </xsl:choose>
  746.                         <!-- initial values for tables-->
  747.                         <!--<xsl:attribute name="fo:border-left">0.002cm solid #000000</xsl:attribute>
  748.                            <xsl:attribute name="fo:border-right">0.002cm solid #000000</xsl:attribute>
  749.                         <xsl:attribute name="fo:border-top">0.002cm solid #000000</xsl:attribute>
  750.                         <xsl:attribute name="fo:border-bottom">0.002cm solid #000000</xsl:attribute>
  751.                         <xsl:attribute name="fo:vertical-align">top</xsl:attribute>
  752.                         <xsl:attribute name="fo:padding-left">0.191cm</xsl:attribute>
  753.                         <xsl:attribute name="fo:padding-right">0.191cm</xsl:attribute>
  754.                         <xsl:attribute name="fo:padding-top">0cm</xsl:attribute>
  755.                         <xsl:attribute name="fo:padding-bottom">0cm</xsl:attribute>-->
  756.                         <xsl:apply-templates/>
  757.                     </xsl:element>
  758.                 </xsl:element>
  759.             </xsl:for-each>
  760.             <xsl:for-each select="/descendant::w:tcPr">
  761.                 <style:style>
  762.                     <xsl:attribute name="style:name">TCell<xsl:value-of select="count(preceding::w:tcPr)"/></xsl:attribute>
  763.                     <xsl:attribute name="style:family">table-cell</xsl:attribute>
  764.                     <xsl:element name="style:properties">
  765.                         <!-- Hard coded initial borders-->
  766.                         <xsl:if test="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val">
  767.                             <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/>
  768.                             <xsl:variable name="rootStyleNode" select="/descendant::w:style[@w:styleId = $rootStyle]"/>
  769.                             <xsl:if test="$rootStyleNode/w:tcPr/w:shd/@wx:bgcolor">
  770.                                 <xsl:attribute name="fo:background-color">#<xsl:value-of select="$rootStyleNode/w:tcPr/w:shd/@wx:bgcolor"/></xsl:attribute>
  771.                             </xsl:if>
  772.                             <xsl:variable name="tblpropsright" select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/w:right"/>
  773.                             <xsl:variable name="tblpropsleft" select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/w:left"/>
  774.                             <xsl:variable name="tblpropstop" select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/w:top"/>
  775.                             <xsl:variable name="tblpropsbottom" select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/w:bottom"/>
  776.                             <xsl:variable name="paddingright">
  777.                                 <xsl:value-of select="$tblpropsright/@w:w"/>
  778.                             </xsl:variable>
  779.                             <xsl:variable name="paddingleft">
  780.                                 <xsl:value-of select="$tblpropsleft/@w:w"/>
  781.                             </xsl:variable>
  782.                             <xsl:variable name="paddingtop">
  783.                                 <xsl:value-of select="$tblpropstop/@w:w"/>
  784.                             </xsl:variable>
  785.                             <xsl:variable name="paddingbottom">
  786.                                 <xsl:value-of select="$tblpropsbottom/@w:w"/>
  787.                             </xsl:variable>
  788.                             <!--<xsl:variable name="paddingleft"><xsl:value-of select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/child::w:left/@w:w"/></xsl:variable>    
  789.                             <xsl:variable name="paddingright"><xsl:value-of select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/child::w:right/@w:w"/></xsl:variable>    
  790.                             <xsl:variable name="paddingtop"><xsl:value-of select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/child::w:top/@w:w"/></xsl:variable>    
  791.                             <xsl:variable name="paddingbottom"><xsl:value-of select="$rootStyleNode/child::w:tblPr/child::w:tblCellMar/child::w:bottom/@w:w"/></xsl:variable>    
  792.                     -->
  793.                             <xsl:if test="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:left">
  794.                                 <xsl:attribute name="fo:padding-left"><xsl:value-of select="(number($paddingleft) div 1440) *2.54"/>cm</xsl:attribute>
  795.                             </xsl:if>
  796.                             <xsl:if test="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:right">
  797.                                 <xsl:attribute name="fo:padding-right"><xsl:value-of select="(number($paddingright) div 1440) *2.54"/>cm</xsl:attribute>
  798.                             </xsl:if>
  799.                             <xsl:if test="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:top">
  800.                                 <xsl:attribute name="fo:padding-top"><xsl:value-of select="(number($paddingtop) div 1440) *2.54"/>cm</xsl:attribute>
  801.                             </xsl:if>
  802.                             <xsl:if test="$rootStyleNode/child::w:tblPr/w:tblCellMar/w:bottom">
  803.                                 <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="(number($paddingbottom) div 1440) *2.54"/>cm</xsl:attribute>
  804.                             </xsl:if>
  805.                         </xsl:if>
  806.                         <xsl:variable name="cellbefore">
  807.                             <xsl:value-of select="count(ancestor::w:tc/preceding-sibling::w:tc)"/>
  808.                         </xsl:variable>
  809.                         <xsl:variable name="cellafter">
  810.                             <xsl:value-of select="count(ancestor::w:tc/following-sibling::w:tc)"/>
  811.                         </xsl:variable>
  812.                         <xsl:variable name="rowbefore">
  813.                             <xsl:value-of select="count(ancestor::w:tr/preceding-sibling::w:tr)"/>
  814.                         </xsl:variable>
  815.                         <xsl:variable name="table" select="ancestor::w:tbl/w:tblPr"/>
  816.                         <xsl:choose>
  817.                             <xsl:when test="$table/w:tblBorders">
  818.                                 <!--<w:top w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  819.                         <w:left w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  820.                         <w:bottom w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  821.                         <w:right w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  822.                         <w:insideH w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  823.                         <w:insideV w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>-->
  824.                                 <xsl:variable name="Borders" select="$table/w:tblBorders"/>
  825.                                 <xsl:attribute name="fo:border-top"><xsl:choose><xsl:when test="number($rowbefore) > 0"><xsl:text>none</xsl:text></xsl:when><xsl:otherwise><xsl:value-of select="(number($Borders/w:top/@wx:bdrwidth)div 1440)*2.54"/><xsl:text>cm </xsl:text></xsl:otherwise></xsl:choose><xsl:if test="not(number($rowbefore) > 0)"><xsl:choose><xsl:when test="$Borders/w:top/@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="$Borders/w:top/@w:color"/></xsl:otherwise></xsl:choose></xsl:if></xsl:attribute>
  826.                                 <xsl:attribute name="fo:border-bottom"><xsl:value-of select="(number($Borders/w:bottom/@wx:bdrwidth)div 1440)*2.54"/><xsl:text>cm </xsl:text><xsl:choose><xsl:when test="$Borders/w:bottom/@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="$Borders/w:bottom/@w:color"/></xsl:otherwise></xsl:choose></xsl:attribute>
  827.                                 <xsl:attribute name="text:aidan"><xsl:value-of select="$cellafter"/></xsl:attribute>
  828.                                 <xsl:attribute name="fo:border-right"><xsl:choose><xsl:when test="number($cellafter) > 0"><xsl:text>none</xsl:text></xsl:when><xsl:otherwise><xsl:value-of select="(number($Borders/w:right/@wx:bdrwidth)div 1440)*2.54"/><xsl:text>cm </xsl:text></xsl:otherwise></xsl:choose><xsl:if test="not(number($cellafter) > 0)"><xsl:choose><xsl:when test="$Borders/w:right/@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="$Borders/w:right/@w:color"/></xsl:otherwise></xsl:choose></xsl:if></xsl:attribute>
  829.                                 <xsl:attribute name="fo:border-left"><xsl:value-of select="(number($Borders/w:left/@wx:bdrwidth)div 1440)*2.54"/><xsl:text>cm </xsl:text><xsl:choose><xsl:when test="$Borders/w:left/@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="$Borders/w:left/@w:color"/></xsl:otherwise></xsl:choose></xsl:attribute>
  830.                             </xsl:when>
  831.                             <xsl:otherwise>
  832.                                 <xsl:attribute name="fo:border-right"><xsl:choose><xsl:when test="number($cellafter) > 0"><xsl:text>none</xsl:text></xsl:when><xsl:otherwise><xsl:text>0.002cm solid #000000</xsl:text></xsl:otherwise></xsl:choose></xsl:attribute>
  833.                                 <xsl:attribute name="fo:border-left"><xsl:text>0.002cm solid #000000</xsl:text></xsl:attribute>
  834.                                 <xsl:attribute name="fo:border-top"><xsl:choose><xsl:when test="number($rowbefore) > 0"><xsl:text>none</xsl:text></xsl:when><xsl:otherwise><xsl:text>0.002cm solid #000000</xsl:text></xsl:otherwise></xsl:choose></xsl:attribute>
  835.                                 <xsl:attribute name="fo:border-bottom">0.002cm solid #000000</xsl:attribute>
  836.                             </xsl:otherwise>
  837.                         </xsl:choose>
  838.                         <xsl:attribute name="fo:vertical-align">top</xsl:attribute>
  839.                         <!--<xsl:attribute name="fo:padding-left">0.191cm</xsl:attribute>
  840.                         <xsl:attribute name="fo:padding-right">0.191cm</xsl:attribute>
  841.                         <xsl:attribute name="fo:padding-top">0cm</xsl:attribute>
  842.                         <xsl:attribute name="fo:padding-bottom">0cm</xsl:attribute>-->
  843.                         <xsl:apply-templates/>
  844.                     </xsl:element>
  845.                 </style:style>
  846.             </xsl:for-each>
  847.             <xsl:for-each select="/descendant::w:listPr">
  848.                 <xsl:variable name="currlistid" select="child::w:ilfo/@w:val"/>
  849.                 <xsl:variable name="currlist" select="."/>
  850.                 <xsl:variable name="rootlistmap" select="/descendant::w:list[child::w:ilst/@w:val=$currlistid]"/>
  851.                 <xsl:variable name="rootlistid" select="/descendant::w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
  852.                 <xsl:variable name="rootlist" select="/descendant::w:listDef[@w:listDefId =$rootlistid ]"/>
  853.                 <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p[1]/w:pPr/w:listPr/w:ilfo/@w:val= $currlistid) ">
  854.                     <xsl:element name="text:list-style">
  855.                         <xsl:attribute name="style:name">TList<xsl:value-of select="count(preceding::w:listPr)"/></xsl:attribute>
  856.                         <xsl:variable name="currlevel" select="number(child::w:ilvl/@w:val)"/>
  857.                         <xsl:for-each select="$rootlist/child::w:lvl">
  858.                             <!--<xsl:variable name="listtype" select="$rootlist/w:lvl[@w:ilvl= $currlevel]/w:nfc/@w:val"/>-->
  859.                             <xsl:variable name="listtype" select="w:nfc/@w:val"/>
  860.                             <!--<xsl:value-of select="$currlistid"/>
  861.                     maps to<xsl:value-of select="$rootlistid"/>-->
  862.                             <xsl:choose>
  863.                                 <xsl:when test="$listtype =2">
  864.                                     <xsl:element name="text:list-level-style-number">
  865.                                         <xsl:call-template name="list-styles-common">
  866.                                             <xsl:with-param name="listtype" select="$listtype"/>
  867.                                             <xsl:with-param name="rootlist" select="$rootlist"/>
  868.                                             <xsl:with-param name="currlist" select="$currlist"/>
  869.                                         </xsl:call-template>
  870.                                     </xsl:element>
  871.                                 </xsl:when>
  872.                                 <xsl:when test="$listtype =23">
  873.                                     <xsl:element name="text:list-level-style-bullet">
  874.                                         <!-- should be bullet?-->
  875.                                         <xsl:call-template name="list-styles-common">
  876.                                             <xsl:with-param name="listtype" select="$listtype"/>
  877.                                             <xsl:with-param name="rootlist" select="$rootlist"/>
  878.                                             <xsl:with-param name="currlist" select="$currlist"/>
  879.                                         </xsl:call-template>
  880.                                     </xsl:element>
  881.                                 </xsl:when>
  882.                                 <xsl:otherwise>
  883.                                     <xsl:element name="text:list-level-style-number">
  884.                                         <!-- should be bullet?-->
  885.                                         <xsl:call-template name="list-styles-common">
  886.                                             <xsl:with-param name="listtype" select="$listtype"/>
  887.                                             <xsl:with-param name="rootlist" select="$rootlist"/>
  888.                                             <xsl:with-param name="currlist" select="$currlist"/>
  889.                                         </xsl:call-template>
  890.                                     </xsl:element>
  891.                                 </xsl:otherwise>
  892.                             </xsl:choose>
  893.                         </xsl:for-each>
  894.                     </xsl:element>
  895.                 </xsl:if>
  896.             </xsl:for-each>
  897.             <!--<style:page-master style:name="pm1">
  898.             <style:properties fo:page-width="21.59cm" fo:page-height="27.94cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
  899.                 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
  900.             </style:properties>
  901.             <style:header-style/>
  902.             <style:footer-style/>
  903.         </style:page-master>
  904.         
  905.         <w:sectPr>
  906.                 <w:pgSz w:w="12240" w:h="15840"/>
  907.                 <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="708" w:footer="708" w:gutter="0"/>
  908.                 <w:cols w:space="708"/>
  909.                 <w:docGrid w:line-pitch="360"/>
  910.             </w:sectPr>
  911.         </wx:sect>
  912.  
  913.  -->
  914.             <xsl:variable name="sectPr" select="/descendant::w:sectPr"/>
  915.             <xsl:for-each select="$sectPr">
  916.                 <xsl:element name="style:page-master">
  917.                     <xsl:attribute name="style:name">pm<xsl:value-of select="count(preceding::w:sectPr)"/></xsl:attribute>
  918.                     <xsl:element name="style:properties">
  919.                         <xsl:attribute name="fo:page-width"><xsl:value-of select="(number(w:pgSz/@w:w) div 1440)*2.54"/>cm</xsl:attribute>
  920.                         <xsl:attribute name="fo:page-height"><xsl:value-of select="(number(w:pgSz/@w:h) div 1440)*2.54"/>cm</xsl:attribute>
  921.                         <xsl:attribute name="fo:margin-top"><xsl:value-of select="(number(w:pgMar/@w:top) div 1440)*2.54"/>cm</xsl:attribute>
  922.                         <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="(number(w:pgMar/@w:bottom) div 1440)*2.54"/>cm</xsl:attribute>
  923.                         <xsl:attribute name="fo:margin-left"><xsl:value-of select="(number(w:pgMar/@w:left + w:pgMar/@w:gutter) div 1440)*2.54"/>cm</xsl:attribute>
  924.                         <xsl:attribute name="fo:margin-right"><xsl:value-of select="(number(w:pgMar/@w:right) div 1440)*2.54"/>cm</xsl:attribute>
  925.                         <xsl:attribute name="style:footnote-max-height"><xsl:value-of select="(number(w:pgMar/@w:footer) div 1440)*2.54"/></xsl:attribute>
  926.                         <xsl:if test="w:pgSz/@w:orient">
  927.                             <xsl:attribute name="style:print-orientation"><xsl:value-of select="w:pgSz/@w:orient"/></xsl:attribute>
  928.                         </xsl:if>
  929.                         <xsl:if test="w:cols/@w:num">
  930.                             <!-- needs to be fixed -->
  931.                             <!--<xsl:element name="style:columns">
  932.                             <xsl:attribute name="fo:column-count"><xsl:value-of select="number(w:cols/@w:num)"/></xsl:attribute>
  933.                             <xsl:attribute name="fo:column-gap"><xsl:value-of select="(number(w:cols/@w:space)div 1440)*2.54"/></xsl:attribute>
  934.                         </xsl:element>-->
  935.                         </xsl:if>
  936.                     </xsl:element>
  937.                 </xsl:element>
  938.                 <xsl:if test="w:cols/@w:num">
  939.                     <!-- create sction property-->
  940.                     <xsl:element name="style:style">
  941.                         <xsl:attribute name="style:name">sect<xsl:value-of select="count(preceding::w:sectPr[child::w:cols/@w:num])"/></xsl:attribute>
  942.                         <xsl:attribute name="style:family">section</xsl:attribute>
  943.                         <xsl:element name="style:properties">
  944.                             <xsl:element name="style:columns">
  945.                                 <xsl:attribute name="fo:column-count"><xsl:value-of select="number(w:cols/@w:num)"/></xsl:attribute>
  946.                                 <xsl:attribute name="fo:column-gap"><xsl:value-of select="(number(w:cols/@w:space)div 1440)*2.54"/>cm</xsl:attribute>
  947.                             </xsl:element>
  948.                         </xsl:element>
  949.                     </xsl:element>
  950.                 </xsl:if>
  951.             </xsl:for-each>
  952.         </xsl:element>
  953.         <office:master-styles>
  954.             <xsl:variable name="sectPr" select="/descendant::w:sectPr"/>
  955.             <xsl:for-each select="$sectPr">
  956.                 <!-- style:page-master style:style-->
  957.                 <xsl:element name="style:master-page">
  958.                     <xsl:choose>
  959.                         <xsl:when test="not (count(preceding::w:sectPr) > 0 )">
  960.                             <xsl:attribute name="style:name">Standard</xsl:attribute>
  961.                         </xsl:when>
  962.                         <xsl:otherwise>
  963.                             <xsl:attribute name="style:name">Standard<xsl:value-of select="count(preceding::w:sectPr)"/></xsl:attribute>
  964.                         </xsl:otherwise>
  965.                     </xsl:choose>
  966.                     <xsl:attribute name="style:page-master-name">pm<xsl:value-of select="count(preceding::w:sectPr)"/></xsl:attribute>
  967.                     <xsl:if test="following::w:sectPr">
  968.                         <xsl:attribute name="style:next-style-name">Standard<xsl:value-of select="count(preceding::w:sectPr)+1"/></xsl:attribute>
  969.                     </xsl:if>
  970.                     <!-- Headers and footers-->
  971.                     <xsl:element name="style:header-style">
  972.                         <xsl:element name="style:properties">
  973.                             <xsl:attribute name="fo:min-height"><xsl:value-of select="(number(child::w:pgMar/@w:header)div 1440)*2.54"/>cm</xsl:attribute>
  974.                             <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
  975.                             <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
  976.                         </xsl:element>
  977.                     </xsl:element>
  978.                     <xsl:element name="style:footer-style">
  979.                         <xsl:element name="style:properties">
  980.                             <xsl:attribute name="fo:min-height"><xsl:value-of select="(number(child::w:pgMar/@w:footer)div 1440)*2.54"/>cm</xsl:attribute>
  981.                             <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
  982.                             <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
  983.                         </xsl:element>
  984.                     </xsl:element>
  985.                     <xsl:if test="child::w:hdr">
  986.                         <xsl:element name="style:header">
  987.                             <xsl:apply-templates select="child::w:hdr[@w:type='odd']/*"/>
  988.                         </xsl:element>
  989.                         <xsl:element name="style:header-left">
  990.                             <xsl:apply-templates select="child::w:hdr[@w:type='even']/*"/>
  991.                         </xsl:element>
  992.                     </xsl:if>
  993.                     <xsl:if test="child::w:ftr">
  994.                         <xsl:element name="style:footer">
  995.                             <xsl:apply-templates select="child::w:ftr[@w:type='odd']/*"/>
  996.                         </xsl:element>
  997.                         <xsl:element name="style:footer-left">
  998.                             <xsl:apply-templates select="child::w:ftr[@w:type='even']/*"/>
  999.                         </xsl:element>
  1000.                     </xsl:if>
  1001.                 </xsl:element>
  1002.             </xsl:for-each>
  1003.             <!--<style:master-page style:name="Standard" style:page-master-name="pm1" style:next-style-name="Sandard1"/>
  1004.         <style:master-page style:name="Standard1" style:page-master-name="pm2"/>-->
  1005.         </office:master-styles>
  1006.     </xsl:template>
  1007.     <xsl:template name="paragraph-alignment">
  1008.         <!-- template for setting indents and alignment-->
  1009.         <xsl:choose>
  1010.             <xsl:when test="descendant::w:ind[@w:left]">
  1011.                 <xsl:attribute name="fo:margin-left"><xsl:value-of select="number(((descendant::w:ind/@w:left)div 1440) *2.54)"/>cm</xsl:attribute>
  1012.             </xsl:when>
  1013.             <xsl:otherwise>
  1014.                 <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
  1015.             </xsl:otherwise>
  1016.         </xsl:choose>
  1017.         <xsl:choose>
  1018.             <xsl:when test="descendant::w:ind[@w:right]">
  1019.                 <xsl:attribute name="fo:margin-right"><xsl:value-of select="number(((descendant::w:ind/@w:right)div 1440) *2.54)"/>cm</xsl:attribute>
  1020.             </xsl:when>
  1021.             <xsl:otherwise>
  1022.                 <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
  1023.             </xsl:otherwise>
  1024.         </xsl:choose>
  1025.         <xsl:choose>
  1026.             <xsl:when test="descendant::w:ind[@w:first-line]">
  1027.                 <xsl:attribute name="fo:text-indent"><xsl:value-of select="number(((descendant::w:ind/@w:first-line)div 1440) *2.54)"/>cm</xsl:attribute>
  1028.             </xsl:when>
  1029.             <xsl:otherwise>
  1030.                 <xsl:attribute name="fo:text-indent">0cm</xsl:attribute>
  1031.             </xsl:otherwise>
  1032.         </xsl:choose>
  1033.         <xsl:call-template name="bidi"/>
  1034.         <!--<w:tabs>
  1035.                         <w:tab w:val="left" w:pos="284"/>
  1036.                         <w:tab w:val="left" w:pos="709"/>
  1037.                         <w:tab w:val="left" w:pos="1134"/>
  1038.                         <w:tab w:val="left" w:pos="1985"/>
  1039.                     </w:tabs>-->
  1040.         <xsl:if test="descendant::w:tabs">
  1041.             <xsl:element name="style:tab-stops">
  1042.                 <xsl:for-each select="descendant::w:tabs/w:tab">
  1043.                     <xsl:element name="style:tab-stop">
  1044.                         <xsl:attribute name="style:position"><xsl:value-of select="(number(@w:pos)div 1440)*2.54"/>cm</xsl:attribute>
  1045.                         <xsl:choose>
  1046.                             <xsl:when test="@w:val = 'decimal'">
  1047.                                 <xsl:attribute name="style:type">char</xsl:attribute>
  1048.                                 <xsl:attribute name="style:char"/>
  1049.                             </xsl:when>
  1050.                             <xsl:otherwise>
  1051.                                 <xsl:attribute name="style:type"><xsl:value-of select="@w:val"/></xsl:attribute>
  1052.                             </xsl:otherwise>
  1053.                         </xsl:choose>
  1054.                     </xsl:element>
  1055.                 </xsl:for-each>
  1056.             </xsl:element>
  1057.         </xsl:if>
  1058.         <!-- line spacing-->
  1059.         <xsl:if test="descendant::w:spacing">
  1060.             <!--<xsl:attribute name="fo:line-height"><xsl:value-of select="number(((descendant::w:spacing/@w:line) div 1440)*2.54)"/>cm</xsl:attribute>-->
  1061.             <!--<w:spacing w:before="240" w:after="120"/>-->
  1062.             <xsl:choose>
  1063.                 <xsl:when test="descendant::w:spacing/@w:line-rule='at-least'">
  1064.                     <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="number(((descendant::w:spacing/@w:line) div 1440)*2.54)"/>cm</xsl:attribute>
  1065.                 </xsl:when>
  1066.                 <xsl:when test="descendant::w:spacing/@w:line-rule='auto'">
  1067.                     <xsl:attribute name="fo:line-height"><xsl:value-of select="(number((descendant::w:spacing/@w:line) div 240) * 100)"/>%</xsl:attribute>
  1068.                 </xsl:when>
  1069.                 <xsl:when test="descendant::w:spacing/@w:line-rule='exact'">
  1070.                     <xsl:attribute name="fo:line-height"><xsl:value-of select="number(((descendant::w:spacing/@w:line) div 1440)*2.54)"/>cm</xsl:attribute>
  1071.                 </xsl:when>
  1072.             </xsl:choose>
  1073.             <xsl:if test="descendant::w:spacing/@w:before">
  1074.                 <xsl:attribute name="fo:margin-top"><xsl:value-of select="(number(descendant::w:spacing/@w:before) div 1440 )*2.54"/>cm</xsl:attribute>
  1075.             </xsl:if>
  1076.             <xsl:if test="descendant::w:spacing/@w:after">
  1077.                 <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="(number(descendant::w:spacing/@w:after) div 1440 )*2.54"/>cm</xsl:attribute>
  1078.             </xsl:if>
  1079.         </xsl:if>
  1080.         <xsl:attribute name="style:auto-text-indent">false</xsl:attribute>
  1081.     </xsl:template>
  1082.     <xsl:template name="bidi">
  1083.         <!-- bi-directional support-->
  1084.         <xsl:if test="descendant::w:bidi">
  1085.             <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
  1086.             <xsl:attribute name="fo:text-align">end</xsl:attribute>
  1087.         </xsl:if>
  1088.         <xsl:choose>
  1089.             <xsl:when test="descendant::w:jc[@w:val = 'center']">
  1090.                 <xsl:attribute name="fo:text-align">center</xsl:attribute>
  1091.             </xsl:when>
  1092.             <xsl:when test="descendant::w:jc[@w:val = 'left']">
  1093.                 <xsl:choose>
  1094.                     <xsl:when test="descendant::w:bidi">
  1095.                         <xsl:attribute name="fo:text-align">end</xsl:attribute>
  1096.                     </xsl:when>
  1097.                     <xsl:otherwise>
  1098.                         <xsl:attribute name="fo:text-align">start</xsl:attribute>
  1099.                     </xsl:otherwise>
  1100.                 </xsl:choose>
  1101.             </xsl:when>
  1102.             <xsl:when test="descendant::w:jc[@w:val = 'right']">
  1103.                 <xsl:choose>
  1104.                     <xsl:when test="descendant::w:bidi">
  1105.                         <xsl:attribute name="fo:text-align">start</xsl:attribute>
  1106.                     </xsl:when>
  1107.                     <xsl:otherwise>
  1108.                         <xsl:attribute name="fo:text-align">end</xsl:attribute>
  1109.                     </xsl:otherwise>
  1110.                 </xsl:choose>
  1111.             </xsl:when>
  1112.             <xsl:when test="descendant::w:jc[@w:val = 'both']">
  1113.                 <xsl:attribute name="fo:text-align">justify</xsl:attribute>
  1114.                 <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
  1115.             </xsl:when>
  1116.         </xsl:choose>
  1117.     </xsl:template>
  1118.     <xsl:template name="list-styles-common">
  1119.         <xsl:param name="listtype"/>
  1120.         <xsl:param name="rootlist"/>
  1121.         <xsl:param name="currlist"/>
  1122.         <xsl:variable name="currlevel" select="number(@w:ilvl)"/>
  1123.         <xsl:variable name="startval" select="child::w:start/@w:val"/>
  1124.         <xsl:variable name="outline" select="substring-after(child::w:lvlText/@w:val, '%')"/>
  1125.         <xsl:attribute name="text:level"><xsl:value-of select="$currlevel+1"/></xsl:attribute>
  1126.         <xsl:attribute name="text:min-label-width">0.499cm</xsl:attribute>
  1127.         <xsl:choose>
  1128.             <xsl:when test="$listtype = 23">
  1129.                 <xsl:attribute name="text:style-name"><xsl:text>Bullet Symbols</xsl:text></xsl:attribute>
  1130.                 <!--<xsl:attribute name="style:num-format"><xsl:value-of select="child::wx:t/@wx:val"/></xsl:attribute>-->
  1131.                 <!--<xsl:attribute name="text:bullet-char"><xsl:value-of select="$currlist/child::wx:t/@wx:val"/></xsl:attribute>-->
  1132.                 <xsl:attribute name="text:bullet-char"><xsl:value-of select="child::w:lvlText/@w:val"/></xsl:attribute>
  1133.                 <!-- Font to be used is set further down-->
  1134.                 <!--<xsl:choose>
  1135.                     <xsl:when test="$currlist/child::wx:t/@wx:val = '┬╖' ">
  1136.                         <xsl:attribute name="text:bullet-char">ΓùÅ</xsl:attribute>
  1137.                     </xsl:when>
  1138.                     <xsl:otherwise>
  1139.                         <xsl:attribute name="text:bullet-char"><xsl:value-of select="$currlist/child::wx:t/@wx:val"/></xsl:attribute>
  1140.                     </xsl:otherwise>
  1141.                 </xsl:choose>-->
  1142.             </xsl:when>
  1143.             <xsl:when test="($listtype > 0) and ($listtype < 6)">
  1144.                 <xsl:if test="$startval">
  1145.                     <xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute>
  1146.                 </xsl:if>
  1147.                 <xsl:if test="contains($outline,'%')">
  1148.                     <xsl:call-template name="displaylevels">
  1149.                         <xsl:with-param name="displaylevelsvalue">
  1150.                             <xsl:value-of select="number(2)"/>
  1151.                         </xsl:with-param>
  1152.                         <xsl:with-param name="displaylevelsstring" select="$outline"/>
  1153.                     </xsl:call-template>
  1154.                 </xsl:if>
  1155.                 <xsl:attribute name="text:style-name"><xsl:text>Numbering Symbols</xsl:text></xsl:attribute>
  1156.                 <xsl:attribute name="style:num-format"><!--<xsl:value-of select="child::wx:t/@wx:val"/>--><xsl:choose><xsl:when test="$listtype = 1">I</xsl:when><xsl:when test="$listtype = 2">i</xsl:when><xsl:when test="$listtype = 3">A</xsl:when><xsl:when test="$listtype = 4">a</xsl:when><xsl:when test="$listtype = 5">1</xsl:when></xsl:choose></xsl:attribute>
  1157.             </xsl:when>
  1158.             <xsl:otherwise>
  1159.                 <xsl:if test="$startval">
  1160.                     <xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute>
  1161.                 </xsl:if>
  1162.                 <xsl:if test="contains($outline,'%')">
  1163.                     <xsl:call-template name="displaylevels">
  1164.                         <xsl:with-param name="displaylevelsvalue">
  1165.                             <xsl:value-of select="number(2)"/>
  1166.                         </xsl:with-param>
  1167.                         <xsl:with-param name="displaylevelsstring" select="$outline"/>
  1168.                     </xsl:call-template>
  1169.                 </xsl:if>
  1170.                 <xsl:attribute name="text:style-name"><xsl:text>Numbering Symbols</xsl:text></xsl:attribute>
  1171.                 <xsl:attribute name="style:num-format">1</xsl:attribute>
  1172.             </xsl:otherwise>
  1173.         </xsl:choose>
  1174.         <xsl:attribute name="style:num-suffix">.</xsl:attribute>
  1175.         <!--<xsl:value-of select="$currlevel"/>-->
  1176.         <xsl:element name="style:properties">
  1177.             <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used-->
  1178.             <xsl:variable name="currNode" select="/descendant::w:listPr[child::w:ilvl/@w:val = $currlevel][child::w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/>
  1179.             <xsl:choose>
  1180.                 <xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) ">
  1181.                     <xsl:variable name="test" select="$currNode/wx:t"/>
  1182.                     <xsl:attribute name="text:space-before"><xsl:value-of select="(number($test/@wx:wTabBefore)div 1440)*2.54"/><xsl:text>cm</xsl:text></xsl:attribute>
  1183.                     <xsl:attribute name="text:space-after"><xsl:value-of select="(number($test/@wx:wTabAfter)div 1440)*2.54"/><xsl:text>cm</xsl:text></xsl:attribute>
  1184.                 </xsl:when>
  1185.                 <xsl:otherwise>
  1186.                     <xsl:attribute name="text:space-before"><xsl:value-of select="((number(child::w:pPr/w:ind/@w:left)  div 1440)*2.54) "/>cm</xsl:attribute>
  1187.                     <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440)*2.54"/>cm</xsl:attribute>
  1188.                 </xsl:otherwise>
  1189.             </xsl:choose>
  1190.             <xsl:if test="descendant::w:rFonts/@w:ascii">
  1191.                 <!--<xsl:attribute name="style:font-name"><xsl:value-of select="$currlist/wx:font/@wx:val"/></xsl:attribute>-->
  1192.                 <xsl:attribute name="style:font-name"><xsl:value-of select="descendant::w:rFonts/@w:ascii"/></xsl:attribute>
  1193.             </xsl:if>
  1194.         </xsl:element>
  1195.     </xsl:template>
  1196.     <xsl:template name="displaylevels">
  1197.         <xsl:param name="displaylevelsvalue"/>
  1198.         <xsl:param name="displaylevelsstring"/>
  1199.         <xsl:attribute name="text:display-levels"><xsl:value-of select="$displaylevelsvalue"/></xsl:attribute>
  1200.         <xsl:variable name="outline" select="substring-after($displaylevelsstring, '%')"/>
  1201.         <xsl:if test="contains($outline,'%')">
  1202.             <xsl:call-template name="displaylevels">
  1203.                 <xsl:with-param name="displaylevelsvalue">
  1204.                     <xsl:value-of select="number($displaylevelsvalue +1)"/>
  1205.                 </xsl:with-param>
  1206.                 <xsl:with-param name="displaylevelsstring" select="$outline"/>
  1207.             </xsl:call-template>
  1208.         </xsl:if>
  1209.     </xsl:template>
  1210.     <xsl:template match="w:style">
  1211.         <xsl:element name="style:style">
  1212.             <xsl:attribute name="style:name"><xsl:value-of select="@w:styleId"/></xsl:attribute>
  1213.             <xsl:if test="child::w:basedOn">
  1214.                 <xsl:attribute name="style:parent-style-name"><xsl:value-of select="child::w:basedOn/@w:val"/></xsl:attribute>
  1215.             </xsl:if>
  1216.             <xsl:if test="child::w:next">
  1217.                 <xsl:attribute name="style:next-style-name"><xsl:value-of select="child::w:next/@w:val"/></xsl:attribute>
  1218.             </xsl:if>
  1219.             <!--<xsl:attribute name="style:class"></xsl:attribute>-->
  1220.             <xsl:choose>
  1221.                 <xsl:when test="@w:type">
  1222.                     <xsl:choose>
  1223.                         <xsl:when test="@w:type = 'character' ">
  1224.                             <xsl:attribute name="style:family">text</xsl:attribute>
  1225.                         </xsl:when>
  1226.                         <xsl:when test="@w:type = 'list' ">
  1227.                             <xsl:attribute name="style:family">text</xsl:attribute>
  1228.                         </xsl:when>
  1229.                         <xsl:otherwise>
  1230.                             <xsl:attribute name="style:family"><xsl:value-of select="@w:type"/></xsl:attribute>
  1231.                         </xsl:otherwise>
  1232.                     </xsl:choose>
  1233.                 </xsl:when>
  1234.                 <xsl:when test="ancestor::w:pPr">
  1235.                     <xsl:attribute name="style:family">paragraph</xsl:attribute>
  1236.                 </xsl:when>
  1237.                 <xsl:otherwise>
  1238.                     <xsl:attribute name="style:family">text</xsl:attribute>
  1239.                 </xsl:otherwise>
  1240.             </xsl:choose>
  1241.             <xsl:element name="style:properties">
  1242.                 <xsl:call-template name="paragraph-alignment"/>
  1243.                 <xsl:apply-templates select="child::w:rPr/*"/>
  1244.                 <xsl:apply-templates select="child::w:pPr/*"/>
  1245.             </xsl:element>
  1246.             <xsl:apply-templates/>
  1247.         </xsl:element>
  1248.     </xsl:template>
  1249.     <!-- 
  1250.     Graphics Handling 
  1251.  
  1252. -->
  1253.     <xsl:template match="w:pict">
  1254.         <!--    <draw:image draw:style-name="fr1" draw:name="Graphic2" text:anchor-type="paragraph" svg:width="2.1965inch" svg:height="0.7402inch" draw:z-index="0">-->
  1255.         <!-- <v:shape id="_x0000_i1026" type="#_x0000_t75" style="width:158.25pt;height:53.25pt">
  1256.                             <v:imagedata src="http://01000002.gif" o:title="logonew"/>
  1257.                         </v:shape>
  1258. -->
  1259.         <!-- Cannot load zipped Wmf file-->
  1260.         <xsl:choose>
  1261.             <xsl:when test="descendant::w:binData">
  1262.                 <xsl:if test="not(contains(child::w:binData/@w:name,'.wmz'))">
  1263.                     <xsl:element name="draw:image">
  1264.                         <xsl:if test="child::v:shape/@style">
  1265.                             <xsl:variable name="widthandheight" select="child::v:shape/@style"/>
  1266.                             <xsl:variable name="widthstr" select="substring-before($widthandheight,';')"/>
  1267.                             <xsl:variable name="heightstr" select="substring-after($widthandheight,';')"/>
  1268.                             <xsl:variable name="widthpt" select="substring-after($widthstr,':')"/>
  1269.                             <xsl:variable name="heightpt" select="substring-after($heightstr,':')"/>
  1270.                             <xsl:variable name="width" select="substring-before($widthpt,'pt')"/>
  1271.                             <xsl:variable name="height" select="substring-before($heightpt,'pt')"/>
  1272.                             <xsl:variable name="widthcm" select="number($width)*0.0353"/>
  1273.                             <xsl:variable name="heightcm" select="number($height)*0.0353"/>
  1274.                             <!--<xsl:value-of select="$widthcm"/><xsl:text>cm</xsl:text><xsl:value-of select="$heightcm"/> -->
  1275.                             <xsl:attribute name="svg:width"><xsl:value-of select="$widthcm"/><xsl:text>cm</xsl:text></xsl:attribute>
  1276.                             <xsl:attribute name="svg:height"><xsl:value-of select="$heightcm"/><xsl:text>cm</xsl:text></xsl:attribute>
  1277.                             <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
  1278.                             <xsl:if test="child::v:shape/v:imagedata/@o:title">
  1279.                                 <xsl:attribute name="draw:name"><xsl:value-of select="child::v:shape/v:imagedata/@o:title"/></xsl:attribute>
  1280.                             </xsl:if>
  1281.                             <xsl:apply-templates/>
  1282.                         </xsl:if>
  1283.                     </xsl:element>
  1284.                 </xsl:if>
  1285.             </xsl:when>
  1286.             <xsl:otherwise>
  1287.                 <xsl:apply-templates/>
  1288.             </xsl:otherwise>
  1289.         </xsl:choose>
  1290.     </xsl:template>
  1291.     <xsl:template match="w:binData">
  1292.         <!--office:binary-data-->
  1293.         <xsl:element name="office:binary-data">
  1294.             <xsl:value-of select="."/>
  1295.         </xsl:element>
  1296.     </xsl:template>
  1297.     <xsl:template match="v:group">
  1298.         <xsl:apply-templates/>
  1299.     </xsl:template>
  1300.     <!--     <v:oval id="_x0000_s1030" style="position:absolute;left:3352;top:2911;width:1975;height:1863" fillcolor="red"/>
  1301.        <v:rect id="_x0000_s1031" style="position:absolute;left:3952;top:3074;width:2838;height:1912" fillcolor="yellow" strokecolor="blue"/>
  1302.  
  1303. <draw:rect text:anchor-type="paragraph" draw:z-index="1" draw:style-name="gr1" draw:text-style-name="P1" svg:width="2.0634inch" svg:height="1.1362inch" svg:x="0.5953inch" svg:y="0.222inch"/>
  1304.             <draw:ellipse text:anchor-type="paragraph" draw:z-index="2" draw:style-name="gr1" draw:text-style-name="P1" svg:width="1.9382inch" svg:height="1.0425inch" svg:x="1.2098inch" svg:y="0.4827inch" draw:kind="section" draw:start-angle="338.51" draw:end-angle="241.21"/>
  1305.  
  1306. -->
  1307.     <xsl:template match="v:oval">
  1308.         <xsl:element name="draw:ellipse">
  1309.             <xsl:variable name="style" select="@style"/>
  1310.             <xsl:variable name="position" select="substring-after($style,'position:')"/>
  1311.             <xsl:variable name="positionval" select="substring-before($position,';')"/>
  1312.             <xsl:variable name="left" select="substring-after($style,'left:')"/>
  1313.             <xsl:variable name="leftval" select="substring-before($left,';')"/>
  1314.             <xsl:variable name="top" select="substring-after($style,'top:')"/>
  1315.             <xsl:variable name="topval" select="substring-before($top,';')"/>
  1316.             <xsl:variable name="width" select="substring-after($style,'width:')"/>
  1317.             <xsl:variable name="widthval" select="substring-before($width,';')"/>
  1318.             <xsl:variable name="height" select="substring-after($style,'height:')"/>
  1319.             <xsl:variable name="heightval" select="$height"/>
  1320.             <!--<xsl:if test="parent::v:group">
  1321.              
  1322.             <xsl:variable name="parentgroup" select="parent::v:group"/>
  1323.             <xsl:variable name="origin" select="$coordorigin"/>
  1324.             <xsl:variable name="groupleft" select="substring-before($origin,',')"/>
  1325.             <xsl:variable name="grouptop" select="substring-after($origin,',')"/>
  1326.              </xsl:if>         -->
  1327.             <xsl:if test="$positionval = 'absolute'">
  1328.                 <xsl:variable name="parentgroup" select="parent::v:group"/>
  1329.                 <xsl:variable name="origin" select="$parentgroup/@coordorigin"/>
  1330.                 <xsl:variable name="groupleft" select="substring-before($origin,',')"/>
  1331.                 <xsl:variable name="grouptop" select="substring-after($origin,',')"/>
  1332.                 <xsl:variable name="currsect" select="ancestor::wx:sect"/>
  1333.                 <xsl:variable name="currsectPr" select="$currsect/descendant::w:sectPr/w:pgMar"/>
  1334.                 <xsl:variable name="leftmar" select="$currsectPr/@w:left"/>
  1335.                 <xsl:variable name="topmar" select="$currsectPr/@w:top"/>
  1336.                 <!--<xsl:attribute name="text:anchor-type">page</xsl:attribute>-->
  1337.                 <xsl:attribute name="text:anchor-type">page</xsl:attribute>
  1338.                 <xsl:attribute name="svg:width"><xsl:value-of select="(number($widthval) div 1440)*2.54"/>cm</xsl:attribute>
  1339.                 <xsl:attribute name="svg:height"><xsl:value-of select="(number($heightval) div 1440)*2.54"/>cm</xsl:attribute>
  1340.                 <xsl:attribute name="svg:x"><xsl:value-of select="(number($topval + $topmar) div 1440)*2.54"/>cm</xsl:attribute>
  1341.                 <xsl:attribute name="svg:y"><xsl:value-of select="(number($leftval + $leftmar) div 1440)*2.54"/>cm</xsl:attribute>
  1342.                 <!--<xsl:attribute name="svg:y"><xsl:value-of select="((number($leftval + $leftmar) -$widthval) div 1440)*2.54"/>cm</xsl:attribute>-->
  1343.             </xsl:if>
  1344.         </xsl:element>
  1345.     </xsl:template>
  1346.     <xsl:template match="v:rect">
  1347.         <xsl:element name="draw:rect">
  1348.             <xsl:variable name="style" select="@style"/>
  1349.             <xsl:variable name="position" select="substring-after($style,'position:')"/>
  1350.             <xsl:variable name="positionval" select="substring-before($position,';')"/>
  1351.             <xsl:variable name="left" select="substring-after($style,'left:')"/>
  1352.             <xsl:variable name="leftval" select="substring-before($left,';')"/>
  1353.             <xsl:variable name="top" select="substring-after($style,'top:')"/>
  1354.             <xsl:variable name="topval" select="substring-before($top,';')"/>
  1355.             <xsl:variable name="width" select="substring-after($style,'width:')"/>
  1356.             <xsl:variable name="widthval" select="substring-before($width,';')"/>
  1357.             <xsl:variable name="height" select="substring-after($style,'height:')"/>
  1358.             <xsl:variable name="heightval" select="$height"/>
  1359.             <xsl:if test="$positionval = 'absolute'">
  1360.                 <xsl:variable name="parentgroup" select="parent::v:group"/>
  1361.                 <xsl:variable name="origin" select="$parentgroup/@coordorigin"/>
  1362.                 <xsl:variable name="groupleft" select="substring-before($origin,',')"/>
  1363.                 <xsl:variable name="grouptop" select="substring-after($origin,',')"/>
  1364.                 <xsl:variable name="currsect" select="ancestor::wx:sect"/>
  1365.                 <xsl:variable name="currsectPr" select="$currsect/descendant::w:sectPr/w:pgMar"/>
  1366.                 <xsl:variable name="leftmar" select="$currsectPr/@w:left"/>
  1367.                 <xsl:variable name="topmar" select="$currsectPr/@w:top"/>
  1368.                 <!--<xsl:attribute name="text:anchor-type">page</xsl:attribute>-->
  1369.                 <xsl:attribute name="text:anchor-type">page</xsl:attribute>
  1370.                 <xsl:attribute name="svg:width"><xsl:value-of select="(number($widthval) div 1440)*2.54"/>cm</xsl:attribute>
  1371.                 <xsl:attribute name="svg:height"><xsl:value-of select="(number($heightval) div 1440)*2.54"/>cm</xsl:attribute>
  1372.                 <xsl:attribute name="svg:x"><xsl:value-of select="(number($topval + $topmar) div 1440)*2.54"/>cm</xsl:attribute>
  1373.                 <xsl:attribute name="svg:y"><xsl:value-of select="(number($leftval + $leftmar) div 1440)*2.54"/>cm</xsl:attribute>
  1374.                 <!--<xsl:attribute name="svg:y"><xsl:value-of select="((number($leftval + $leftmar) -$widthval) div 1440)*2.54"/>cm</xsl:attribute>-->
  1375.             </xsl:if>
  1376.         </xsl:element>
  1377.     </xsl:template>
  1378.     <!-- 
  1379.     tables Handling 
  1380.  
  1381. -->
  1382.     <xsl:template match="w:tbl">
  1383.         <xsl:element name="table:table">
  1384.             <!--<xsl:if test="child::w:tblPr/w:tblStyle">
  1385.             <xsl:attribute name="table:style-name"><xsl:value-of select="child::w:tblPr/w:tblStyle/@w:val"/></xsl:attribute>
  1386.         </xsl:if>-->
  1387.             <xsl:apply-templates select="./*"/>
  1388.         </xsl:element>
  1389.     </xsl:template>
  1390.     <xsl:template match="w:tblPr">
  1391.         <xsl:attribute name="table:style-name">TTable<xsl:value-of select="count(preceding::w:tblPr)"/></xsl:attribute>
  1392.     </xsl:template>
  1393.     <xsl:template match="w:tblGrid">
  1394.         <!--<xsl:attribute name="table:number-columns-repeated">
  1395.             <xsl:value-of select="count(child::w:gridCol)"/>
  1396.         </xsl:attribute>-->
  1397.         <xsl:apply-templates/>
  1398.     </xsl:template>
  1399.     <xsl:template match="w:gridCol">
  1400.         <xsl:element name="table:table-column">
  1401.             <xsl:attribute name="table:style-name">TColumn<xsl:value-of select="count(preceding::w:gridCol)"/></xsl:attribute>
  1402.         </xsl:element>
  1403.     </xsl:template>
  1404.     <!--<w:tblGrid>
  1405.         <w:gridCol w:w="1771"/>
  1406.         <w:gridCol w:w="1771"/>
  1407.         <w:gridCol w:w="1771"/>
  1408.         <w:gridCol w:w="1771"/>
  1409.         <w:gridCol w:w="1772"/>
  1410.         </w:tblGrid>
  1411. -->
  1412.     <xsl:template match="w:tr">
  1413.         <xsl:element name="table:table-row">
  1414.             <xsl:apply-templates/>
  1415.         </xsl:element>
  1416.     </xsl:template>
  1417.     <xsl:template match="w:tc">
  1418.         <xsl:element name="table:table-cell">
  1419.             <xsl:attribute name="table:style-name">TCell<xsl:value-of select="count(preceding::w:tcPr)"/></xsl:attribute>
  1420.             <xsl:if test="child::w:tcPr/w:gridSpan">
  1421.                 <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="child::w:tcPr/w:gridSpan/@w:val"/></xsl:attribute>
  1422.             </xsl:if>
  1423.             <xsl:apply-templates/>
  1424.         </xsl:element>
  1425.     </xsl:template>
  1426.     <xsl:template match="w:tcBorders">
  1427.         <xsl:apply-templates/>
  1428.     </xsl:template>
  1429.     <xsl:template match="w:top">
  1430.         <xsl:choose>
  1431.             <xsl:when test="@w:val='nil' ">
  1432.                 <xsl:attribute name="fo:border-top">none</xsl:attribute>
  1433.             </xsl:when>
  1434.             <xsl:when test="@wx:bdrwidth and @w:color">
  1435.                 <xsl:attribute name="fo:border-top"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/><xsl:text>cm </xsl:text><!--<xsl:attribute name="fo:border-top"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/><xsl:text>cm </xsl:text>--><xsl:choose><xsl:when test="@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="@w:color"/></xsl:otherwise></xsl:choose></xsl:attribute>
  1436.             </xsl:when>
  1437.             <xsl:otherwise>
  1438.                 <xsl:if test="@wx:bdrwidth">
  1439.                     <xsl:attribute name="fo:border-top"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/>cm</xsl:attribute>
  1440.                     <!--<xsl:attribute name="fo:border-top"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/>cm</xsl:attribute>-->
  1441.                 </xsl:if>
  1442.             </xsl:otherwise>
  1443.         </xsl:choose>
  1444.     </xsl:template>
  1445.     <xsl:template match="w:bottom">
  1446.         <xsl:choose>
  1447.             <xsl:when test="@w:val='nil' ">
  1448.                 <xsl:attribute name="fo:border-bottom">none</xsl:attribute>
  1449.             </xsl:when>
  1450.             <xsl:when test="@wx:bdrwidth and @w:color">
  1451.                 <xsl:attribute name="fo:border-bottom"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/><xsl:text>cm </xsl:text><!--<xsl:attribute name="fo:border-bottom"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/><xsl:text>cm </xsl:text>--><xsl:choose><xsl:when test="@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="@w:color"/></xsl:otherwise></xsl:choose></xsl:attribute>
  1452.             </xsl:when>
  1453.             <xsl:otherwise>
  1454.                 <xsl:if test="@wx:bdrwidth">
  1455.                     <xsl:attribute name="fo:border-bottom"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/>cm</xsl:attribute>
  1456.                     <!--<xsl:attribute name="fo:border-bottom"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/>cm</xsl:attribute>-->
  1457.                 </xsl:if>
  1458.             </xsl:otherwise>
  1459.         </xsl:choose>
  1460.     </xsl:template>
  1461.     <xsl:template match="w:left">
  1462.         <xsl:choose>
  1463.             <xsl:when test="@w:val='nil' ">
  1464.                 <xsl:attribute name="fo:border-left">none</xsl:attribute>
  1465.             </xsl:when>
  1466.             <xsl:when test="@wx:bdrwidth and @w:color">
  1467.                 <xsl:attribute name="fo:border-left"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/><xsl:text>cm </xsl:text><!--<xsl:attribute name="fo:border-right"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/><xsl:text>cm </xsl:text>--><xsl:choose><xsl:when test="@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="@w:color"/></xsl:otherwise></xsl:choose></xsl:attribute>
  1468.             </xsl:when>
  1469.             <xsl:otherwise>
  1470.                 <xsl:if test="@wx:bdrwidth">
  1471.                     <xsl:attribute name="fo:border-left"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/>cm</xsl:attribute>
  1472.                     <!--<xsl:attribute name="fo:border-left"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/>cm</xsl:attribute>-->
  1473.                 </xsl:if>
  1474.             </xsl:otherwise>
  1475.         </xsl:choose>
  1476.     </xsl:template>
  1477.     <xsl:template match="w:right">
  1478.         <xsl:choose>
  1479.             <xsl:when test="@w:val='nil' ">
  1480.                 <xsl:attribute name="fo:border-right">none</xsl:attribute>
  1481.             </xsl:when>
  1482.             <xsl:when test="@wx:bdrwidth and @w:color">
  1483.                 <xsl:attribute name="fo:border-right"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/><xsl:text>cm </xsl:text><!--<xsl:attribute name="fo:border-right"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/><xsl:text>cm </xsl:text>--><xsl:choose><xsl:when test="@w:color ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid #</xsl:text><xsl:value-of select="@w:color"/></xsl:otherwise></xsl:choose></xsl:attribute>
  1484.             </xsl:when>
  1485.             <xsl:otherwise>
  1486.                 <xsl:if test="@wx:bdrwidth">
  1487.                     <xsl:attribute name="fo:border-right"><xsl:value-of select="(number(@wx:bdrwidth) div 1440 )*2.54"/>cm</xsl:attribute>
  1488.                     <!--<xsl:attribute name="fo:border-right"><xsl:value-of select="(number(@wx:bdrwidth) div 240 )*100"/>cm</xsl:attribute>-->
  1489.                 </xsl:if>
  1490.             </xsl:otherwise>
  1491.         </xsl:choose>
  1492.     </xsl:template>
  1493.     <xsl:template match="w:tblBorders">
  1494.         <xsl:apply-templates/>
  1495.     </xsl:template>
  1496.     <xsl:template match="w:tcBorders">
  1497.         <xsl:apply-templates/>
  1498.     </xsl:template>
  1499.     <xsl:template match="w:tblInd">
  1500.         <xsl:attribute name="fo:margin-left"><xsl:value-of select="(number(@w:w) div 1440)*2.54"/>cm</xsl:attribute>
  1501.     </xsl:template>
  1502.     <!-- Table borders
  1503.  
  1504.  <style:properties fo:vertical-align="top" fo:padding-left="0.191cm" fo:padding-right="0.191cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border-left="0.088cm solid #000000" fo:border-right="none" fo:border-top="0.088cm solid #000000" fo:border-bottom="0.088cm solid #000000"/>
  1505.  
  1506. <w:tblPr>
  1507.                     <w:tblStyle w:val="TableGrid"/>
  1508.                     <w:tblW w:w="0" w:type="auto"/>
  1509.                     <w:tblInd w:w="567" w:type="dxa"/>
  1510.                     <w:tblBorders>
  1511.                         <w:top w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  1512.                         <w:left w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  1513.                         <w:bottom w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  1514.                         <w:right w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  1515.                         <w:insideH w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  1516.                         <w:insideV w:val="single" w:sz="24" wx:bdrwidth="60" w:space="0" w:color="auto"/>
  1517.                     </w:tblBorders>
  1518.                     <w:tblLook w:val="000001E0"/>
  1519.                 </w:tblPr>
  1520.  
  1521.  
  1522. -->
  1523.     <!-- <style:style style:name="Tabelle7.B1" style:family="table-cell">
  1524.             <style:properties fo:vertical-align="top" fo:padding-left="0.191cm" fo:padding-right="0.191cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border-left="0.002cm solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.002cm solid #000000"/>
  1525.         </style:style>
  1526.  
  1527.     <w:tcPr>
  1528.                             <w:tcW w:w="1771" w:type="dxa"/>
  1529.                             <w:tcBorders>
  1530.                                 <w:top w:val="nil"/>
  1531.                                 <w:right w:val="nil"/>
  1532.                             </w:tcBorders>
  1533.  
  1534.  
  1535. -->
  1536.     <!--<xsl:template match="w:gridSpan">
  1537.     <xsl:attribute name=""></xsl:attribute>
  1538.     <xsl:apply-templates/>
  1539. </xsl:template>-->
  1540.     <!--Table, Cell and Row Properties  -->
  1541.     <xsl:template match="w:tcPr"/>
  1542.     <!--<style:properties style:width="10.008cm" fo:margin-left="3.791cm" fo:margin-right="3.791cm" table:align="margins"/>-->
  1543.     <!-- 
  1544.     list Handling 
  1545.  
  1546. -->
  1547.     <xsl:template name="genlist">
  1548.         <xsl:variable name="currlistid" select="child::w:pPr/w:listPr/w:ilfo/@w:val"/>
  1549.         <xsl:variable name="prevPara" select="preceding-sibling::w:p"/>
  1550.         <xsl:variable name="followingPara" select="following-sibling::w:p"/>
  1551.         <xsl:variable name="prevlistid" select="$prevPara/child::w:pPr/w:listPr/w:ilfo/@w:val"/>
  1552.         <xsl:variable name="currlistlvl" select="child::w:pPr/w:listPr/w:ilvl/@w:val"/>
  1553.         <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/>
  1554.         <xsl:element name="text:ordered-list">
  1555.             <xsl:attribute name="text:style-name">TList<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/></xsl:attribute>
  1556.             <xsl:choose>
  1557.                 <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = child::w:pPr/w:listPr/w:ilfo/@w:val">
  1558.                     <xsl:attribute name="text:continue-numbering">true</xsl:attribute>
  1559.                     <xsl:element name="text:list-item">
  1560.                         <xsl:call-template name="levels">
  1561.                             <xsl:with-param name="level" select="$currlistlvl"/>
  1562.                         </xsl:call-template>
  1563.                     </xsl:element>
  1564.                 </xsl:when>
  1565.                 <xsl:otherwise>
  1566.                     <xsl:element name="text:list-item">
  1567.                         <xsl:call-template name="levels">
  1568.                             <xsl:with-param name="level" select="$currlistlvl"/>
  1569.                         </xsl:call-template>
  1570.                     </xsl:element>
  1571.                 </xsl:otherwise>
  1572.             </xsl:choose>
  1573.         </xsl:element>
  1574.     </xsl:template>
  1575.     <xsl:template name="levels">
  1576.         <xsl:param name="level"/>
  1577.         <xsl:choose>
  1578.             <xsl:when test="$level = '0'">
  1579.                 <xsl:call-template name="commonPara"/>
  1580.             </xsl:when>
  1581.             <xsl:otherwise>
  1582.                 <xsl:element name="text:ordered-list">
  1583.                     <xsl:element name="text:list-item">
  1584.                         <xsl:call-template name="levels">
  1585.                             <xsl:with-param name="level" select="$level -1"/>
  1586.                         </xsl:call-template>
  1587.                     </xsl:element>
  1588.                 </xsl:element>
  1589.             </xsl:otherwise>
  1590.         </xsl:choose>
  1591.     </xsl:template>
  1592.     <!-- 
  1593.     Ms Field Handling
  1594. -->
  1595.     <xsl:template match="w:instrText"/>
  1596.     <xsl:template match="w:fldChar"/>
  1597. </xsl:stylesheet>
  1598.