Вопрос

I tried googling, but couldn't find any xslt file to transform ODF content xml to plain text. Maybe somebody knows if it exists?

Update:

The stylesheet I am searching for is intended to be used primarily with ODT content.xml. Here's example input: img.rg.ru/pril/article/61/45/53/UDO04.2012.odt (content.xml can be extracted with unzip). XSLT version is 1.0.

Это было полезно?

Решение

This XSLT 1.0 style-sheet ...

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:for-each select="//text:p">
    <xsl:value-of select="concat(.,'&#x0A;')" />
  </xsl:for-each>  
</xsl:template>

</xsl:stylesheet>

... when applied to the content.xml file from unziping your .odt file will yield the text equivalent of your ODF document.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top