DocBook files to TXT

krosenkranz
Posts: 2

DocBook files to TXT

Sat Jun 28, 2014 12:33 am

Hey there,

I have some simple content (no tables, no figures) in DocBook that I currently transform to PDF.

Now, I have a requirement to transform to a plain text file, as well.

Any pointers for doing this in Oxygen 16 using transformation scenarios?

(I've found a few comments about doing this, but mostly very old comments.)

Thanks!
sorin_ristache
Posts: 4144

Re: DocBook files to TXT

Mon Jun 30, 2014 10:49 am

Hello,

You could copy all visible content in Author mode (Ctrl+A in Author mode for Select All and Ctrl+C for Copy), create a new file of TEXT type (Ctrl+N, type "text" in the New dialog) and paste the copied content in the TEXT file (Ctrl+V for Paste). This copy and paste operation will remove all XML tags and keep only the text content of the DocBook XML document.

I think this is almost the same as running the following XSLT stylesheet over the DocBook XML document:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="text()[string-length(normalize-space()) = 0]">
        <xsl:text>
</xsl:text>
    </xsl:template>
   
    <xsl:template match="@*"/>
</xsl:stylesheet>



Regards,
Sorin
krosenkranz
Posts: 2

Re: DocBook files to TXT

Mon Jun 30, 2014 6:55 pm

Thank you, Sorin!

Nice and simple, and does exactly what I want.

Kurt

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests