Page 1 of 1

DocBook -> ePub with programlisting@width

Posted: Thu Jan 30, 2014 8:04 am
by laurendw
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.

thanks,

Lauren

Re: DocBook -> ePub with programlisting@width

Posted: Thu Jan 30, 2014 3:44 pm
by sorin_ristache
Hello,

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"/>
</xsl:attribute>
</xsl:if>
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.


Regards,
Sorin

Re: DocBook -> ePub with programlisting@width

Posted: Thu Jan 30, 2014 7:05 pm
by laurendw
Thanks Sorin.