OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Unable to indent text in text output


Hi Matt,

On Thu, Mar 31, 2011 at 06:33, Matt Dew <marcoz@osource.org> wrote:
> Hi Aankhen,
>  Thanks for the reply.
>
> [snip]
>
> It merges the whitespace;  newline and the indent spaces.
>
> [snip]
>
> Here’s my xsl file:
> ------
> <?xml version='1.0' encoding="utf-8"?>
> <xsl:stylesheet
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>         xmlns:fo="http://www.w3.org/1999/XSL/Format"; version="1.0">
>
>         <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
>
> <xsl:template match="para[@role = 'box']">
> <xsl:text>
> </xsl:text>
> <xsl:apply-templates/>
>
> </xsl:template>
> ------

I don’t see any indentation here; there’s just a newline within the
‘xsl:text’ element.  BTW, you don’t need to declare the ‘fo’ namespace
unless you’re using it.

> Here's the resulting output:
> ------
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>
> Table of Contents
>
> 1. Requests
>
> Chapter 1. Requests
>
> BigReqEnable → maximum-request-length: CARD32
>
> This request enables extended-length protocol requests.
> ------
>
>
>
> If I play with the xsl file I can get:
> ------
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>
> Table of Contents
>
> 1. Requests
>
> Chapter 1. Requests
>
> BigReqEnable
>
> →
>
> maximum-request-length: CARD32
>
> This request enables extended-length protocol requests.
> ------
>
>
> But what I want is:
> ------
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>
> Table of Contents
>
> 1. Requests
>
> Chapter 1. Requests
>
>     BigReqEnable
>     →
>     maximum-request-length: CARD32
>
> This request enables extended-length protocol requests.
> ------
>
>
>
> I've tried xmlto, xsltproc & fop, xsltproc & w3m...
> I'm to the point now where I'm just confusing myself.
>
> Ideas?

Are you sure that this is a DocBook thing that you’re talking about?
It sounds to me like you’re referring to the way HTML collapses
whitespace: outside of the ‘pre’ element, any sequence of whitespace
characters is rendered as a single space, while any leading/trailing
whitespace is trimmed.[1] You have a few options for preserving
whitespace:

1. The ‘pre’ element, which will render all whitespace exactly as it
appears in the source.  It will also use a monospaced font and only
break lines where you break them in the source, so it’s not very
well-suited for your needs.
2. Non-breaking spaces (&nbsp; in HTML, &#160; or &#xA0; in any
SGML-derived language), which are never collapsed by the browser.
Something like “ &nbsp; &nbsp; &nbsp;” will be rendered as “      ”.
You could make every space a non-breaking space when you’re trying to
maintain a layout, but that would lead to unfortunate consequences
since, as the name indicates, line breaks are not allowed there.
3. CSS: set the ‘para.propagates.style’ parameter to ‘1’ so that the
resultant HTML paragraphs have ‘box’ for their class names, then add
whatever indentation or other styling you’d like to your CSS, such as:

    .box { margin-left: 0.5em; }

4. CSS: use ‘white-space: pre’.  You would set ‘para.propagates.style’
to ‘1’, as above, then in your CSS you’d do this:

    .box { white-space: pre; }

  And you’d add whatever indentation is necessary to the HTML itself.
This has the same problem with line breaks as the ‘pre’ element.

Of these, the third option is what you should really use.  I only
include the others for the sake of completeness.

Here’s hoping I’ve correctly understood what you’re asking. :-) I
would suggest that you include the resultant source code next time—or
maybe you did and your MUA indicated that it was actual HTML; if that
be the case, you can escape it using &lt; for <, &gt; for > and &amp;
for &.

Aankhen

[1]: http://library.stanford.edu/tools/tutorials/html2.0/whitespace.html


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]