[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] Re: DocBook Stylesheets for ASCII conversion?
Btw., here's my version of that. It currently relies on a saxon extension to perform a second pass on the output and cleanup a problem with extra lines after bullets and numbers in lists. 1. Use Saxon to run html2txt.xsl (cleanup.xsl must be in the same directory) on the docbook file. 2. Run "links -dump filename.html | tr -d '\000' > filename.txt" (or links -dump filename.html | tr -d '\000' | unix2dos > filename.txt if you expect people to use notepad to open the file.) The main annoyance left is with programlistings. If you have a programlisting in a listitem, the programlisting is flush left even tho the listitem is indented. I don't do anything with formatting of inlines and can't remember what happens with ulinks, but maybe this can help you get stared. David =============================================================== html2txt.xsl =============================================================== <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" version="1.0"> <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.60.1/xhtml/docbook.xsl"/> <xsl:output method="xml" encoding="us-ascii" saxon:next-in-chain="cleanup.xsl"/> <xsl:param name="appendix.autolabel" select="1"/> <xsl:param name="chapter.autolabel" select="1"/> <xsl:param name="part.autolabel" select="1"/> <xsl:param name="preface.autolabel" select="1"/> <xsl:param name="section.autolabel" select="1"/> <xsl:param name="admon.graphics" select="0"/> <xsl:param name="callout.graphics" select="'0'"/> <xsl:template match="index|figure|informalfigure|mediaobject" priority="1000"></xsl:template> <xsl:param name="generate.toc"> appendix toc article toc book toc chapter toc part toc preface toc qandadiv toc qandaset toc reference toc section toc set toc </xsl:param> </xsl:stylesheet> =============================================================== cleanup.xsl: =============================================================== <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output encoding="us-ascii" method="xml" indent="yes"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="xhtml:li/xhtml:p[1]"> <xsl:apply-templates select="node()"/> </xsl:template> </xsl:stylesheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]