DocBook -> ePub with programlisting@width

laurendw
Posts: 5
Joined: Sat Apr 06, 2013 1:10 am

DocBook -> ePub with programlisting@width

Post by laurendw » 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.

thanks,

Lauren

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: DocBook -> ePub with programlisting@width

Post by sorin_ristache » Thu Jan 30, 2014 3:44 pm

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

laurendw
Posts: 5
Joined: Sat Apr 06, 2013 1:10 am

Re: DocBook -> ePub with programlisting@width

Post by laurendw » Thu Jan 30, 2014 7:05 pm

Thanks Sorin.

Post Reply