1

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.

Pupkov-Zadnij
  • 1,342
  • 2
  • 11
  • 21
  • ODF covers a large number of file formats. Can you narrow it down? Word Processing? Spread-sheet? Math formulae? – Sean B. Durkin Sep 11 '12 at 13:43
  • Link or list the schema; list a simple example input document; the expected text output from this document; and identify your XSLT version (1.0 or 2.0?). Then we can make something for you. – Sean B. Durkin Sep 11 '12 at 13:46
  • @SeanB.Durkin I mean Word-Processing. 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. – Pupkov-Zadnij Sep 11 '12 at 13:53

1 Answers1

1

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.

Sean B. Durkin
  • 12,659
  • 1
  • 36
  • 65