DocBook XSL: Wrapping <programlisting> and <screen> in <pre>

DocBook duck logo Today I started looking at using a DocBook XSL customization to wrap <programlisting> and <screen> in <pre>.

What took an inordinate amount of time was not finding <xsl:apply-imports />, but instead realizing I needed to take the namespace into account. Currently this is using the 1.76.1 stylesheets.

<xsl:stylesheet ... xmlns:d="" exclude-result-prefixes="d"
... >
 <xsl:template match="d:programlisting">
  <pre><xsl:apply-imports /></pre>

Without the d: prefix, I was scratching my head and mumbling under my breath. With the prefix, it just works.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s