Re: Visualize whitespace and tab

Frank Steimke <[email protected]> Tue, 23 Jul 2019 22:49:43 +0200
Newsgroups gmane.text.docbook.misc
Message-ID <[email protected]>
Hi Mario,

you can write a simple customization layer for the stylesheets that 
transforms DocBook into FO. Your stylesheet imports the fo/docbook.xsl 
stylesheet and overwrites the template for text-nodes in the 
literallayout element, so that every space character will be translated 
to the character that you would like to see. For DocBook 5.x and the 
current Stylesheets its something like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:d="http://docbook.org/ns/docbook" version="1.0">
     <xsl:import 
href="http://cdn.docbook.org/release/xsl/current/fo/docbook.xsl"/>

     <xsl:template match="d:literallayout/text()">
         <xsl:value-of select="translate(., '&#32;','&#x2423;')"/>
     </xsl:template>

</xsl:stylesheet>

This is only for space characters in the literallayout element, and 
maybe U+2423 is not the space symbol you are looking for, but you get 
the idea.

If it don't seem to work check the catalog files use the absolute or 
relative path to the fo/docbook.xsl Stylesheet on your system.

Sincerely, Frank Steimke

Am 23.07.2019 um 20:00 schrieb Mario Klebsch:
> Hello,
>
> I want to write some examples about possible use of whitespace in source code. So I am looking for a way to visualize the use of tab and whitespace in source code listing.
>
> Editors like Word or Notepad can display tabs as little arrows and spaces as little grey dots. I know, I can figure out the unicode code point of these characters, but I would prefer to use tab and space in <literallayout> and have fop displaying the arrow or the dot automagically.
>
> I hope somebody has an idea how this can be achieved,
>
> Thanks in advance,
>
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>