As lists & tables aren't supported in OO calc, fake it

This commit is contained in:
Nathan Gray 2011-08-09 20:41:16 +00:00
parent 1c2486e058
commit ff89732b24

View File

@ -216,18 +216,26 @@
<text:span text:style-name="Tunderline"><xsl:apply-templates/></text:span> <text:span text:style-name="Tunderline"><xsl:apply-templates/></text:span>
</xsl:template> </xsl:template>
<xsl:template match="ul"> <xsl:template match="ul[parent::office:text]">
<text:list text:style-name="LU"> <text:list text:style-name="LU">
<xsl:apply-templates/> <xsl:apply-templates/>
</text:list> </text:list>
</xsl:template> </xsl:template>
<xsl:template match="ol"> <xsl:template match="ol[parent::office:text]">
<text:list text:style-name="LO"> <text:list text:style-name="LO">
<xsl:apply-templates/> <xsl:apply-templates/>
</text:list> </text:list>
</xsl:template> </xsl:template>
<!-- You can't have lists in a table? Doesn't work in calc at least, so fake it-->
<xsl:template match="ul[ancestor::office:spreadsheet] | ol[ancestor::office:spreadsheet]" >
<text:p><xsl:apply-templates/></text:p>
</xsl:template>
<xsl:template match="ul[ancestor::office:spreadsheet]/li | ol[ancestor::office:spreadsheet]/li" >
<text:tab-stop />&#8226; <xsl:value-of select="normalize-space()" /><text:line-break />
</xsl:template>
<xsl:template match="li"> <xsl:template match="li">
<xsl:variable name="list_style"> <xsl:variable name="list_style">
<xsl:choose> <xsl:choose>
@ -240,13 +248,20 @@
</text:p></text:list-item> </text:p></text:list-item>
</xsl:template> </xsl:template>
<xsl:template match="table"> <xsl:template match="table[ancestor::office:text]">
<table:table table:name="Table{generate-id(.)}" table:style-name="TableX"> <table:table table:name="Table{generate-id(.)}" table:style-name="TableX">
<table:table-column table:style-name="TableX.A" table:number-columns-repeated="{count(tr[position() = 1]/td | tr[position() = 1]/th)}"/> <table:table-column table:style-name="TableX.A" table:number-columns-repeated="{count(tr[position() = 1]/td | tr[position() = 1]/th)}"/>
<xsl:apply-templates/> <xsl:apply-templates/>
</table:table> </table:table>
</xsl:template> </xsl:template>
<!-- You can't have tables in a table? Doesn't work in calc at least, so fake it-->
<xsl:template match="table[ancestor::office:spreadsheet]" >
<text:p>
<xsl:apply-templates/>
</text:p>
</xsl:template>
<xsl:template match="tr[th]"> <xsl:template match="tr[th]">
<table:table-header-rows><table:table-row> <table:table-header-rows><table:table-row>
<xsl:apply-templates/> <xsl:apply-templates/>
@ -270,6 +285,9 @@
<xsl:apply-templates/> <xsl:apply-templates/>
</table:table-row> </table:table-row>
</xsl:template> </xsl:template>
<xsl:template match="tr[ancestor::office:spreadsheet]" >
<xsl:apply-templates/><text:line-break />
</xsl:template>
<xsl:template match="a"> <xsl:template match="a">
<text:a xlink:href="{@href}"> <text:a xlink:href="{@href}">