DocBook -> ePub with programlisting@width

Posts: 5

DocBook -> ePub with programlisting@width

Thu Jan 30, 2014 8:04 am

I have a set of valid DocBook 5 documents that use the programlisting element with the width attribute set. When I generate an ePub 2 document, it doesn't validate, because the transformation keeps that width attribute when transforming the programlisting element to a pre element, and the attribute width is not allowed on the HTML pre element.

I tried running the various DocBook HTML transformations on the same document and they all correctly deleted the width attribute in the transformation, so I'm not sure where the problem is. I have oXygen 15.2.

Any help would be welcome; I could delete the attribute from the source if I need to, but I'd rather get rid of it in the transformation step and keep the source the way it is.


Posts: 4144

Re: DocBook -> ePub with programlisting@width

Thu Jan 30, 2014 3:44 pm


The pre/@width attribute is also present in the output of both the DocBook HTML transformation and the DocBook XHTML one.

You need to modify an XSLT stylesheet for suppressing the width attribute in the output. Please comment out the code:

Code: Select all

<xsl:if test="@width != ''">
    <xsl:attribute name="width">
        <xsl:value-of select="@width"/>

in the file [Oxygen-install-dir]\frameworks\docbook\xsl\xhtml\verbatim.xsl.

The alternative is removing the width attribute from the XML source file, which you already discovered.

Posts: 5

Re: DocBook -> ePub with programlisting@width

Thu Jan 30, 2014 7:05 pm

Thanks Sorin.

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests