docbook-apps

  • 1.  White space in fo question

    Posted 09-05-2007 22:10
    I've been playing around with the various white space attributes
    trying, with no success so far, to achieve the following with fo:

    Given the following input text (I've replace the space character
    with '^' to make things clearer):

    <para>
    ^^^^Now^is^the^time.^^Here^is^the^place.^^
    ^^^^There^is^the^problem.^^Way^out^there
    ^^^^is^the^solution.
    <para>

    I'd like to get the following output using a monospace font (Courier):

    Now^is^the^time.^^Here^is
    the^place.^^There^is^the
    problem.^^Way^out^there^is
    the^solution.

    Note that the two spaces between each sentence have been preserved,
    the text has been wrapped, and the indentation in the source has been
    ignored.

    By setting the attribute "white-space-collapse" to false in the
    "root.properties" attribute set, I get everything I need, except
    the spaces used to indent the source aren't ignored, which gives
    output that looks like:

    Now^is^the^time.^^Here^is
    the^place.^^^^^^There^is^the
    problem.^^Way^out^there^^^^^is
    the^solution.

    I've tried various values of white-space-treatment to no avail,
    including ignore-if-after-linefeed, which on paper would seem
    to be the right choice.

    I've tried this with FOP 0.93 and XEP 4.4 with the same results,
    so I think the fop processor is irrelevant. And, I'm using saxon8
    with the 1.73.1 stylesheets.

    Any ideas?

    Thanks,
    Dick Hamilton

    P.S. I know, with proportional fonts, no one puts two spaces
    after a sentence any more, but I'm using Courier and need that
    typewriter effect:).





  • 2.  Re: [docbook-apps] White space in fo question

    Posted 09-06-2007 06:53
    Dick Hamilton wrote:
    > I've been playing around with the various white space attributes
    > trying, with no success so far, to achieve the following with fo:
    >
    > Given the following input text (I've replace the space character
    > with '^' to make things clearer):
    >
    > <para>
    > ^^^^Now^is^the^time.^^Here^is^the^place.^^
    > ^^^^There^is^the^problem.^^Way^out^there
    > ^^^^is^the^solution.
    > <para>
    >
    > I'd like to get the following output using a monospace font (Courier):
    >
    > Now^is^the^time.^^Here^is
    > the^place.^^There^is^the
    > problem.^^Way^out^there^is
    > the^solution.
    >
    > Note that the two spaces between each sentence have been preserved,
    > the text has been wrapped, and the indentation in the source has been
    > ignored.

    For once CSS has this feature!
    Guessing you mean in earlier processing?

    1. http://www.dpawson.co.uk/xsl/rev2/regex2.html#d17364e181
    Convert to isolated lines.
    Normalize each line
    Replace .^ with .^^ within each line.
    (or perhaps one of the other 'spaces', probably   easiest)
    Merge together.






    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 3.  RE: [docbook-apps] White space in fo question

    Posted 09-06-2007 15:08
    Dave,

    Thanks; yes, I have been using XSL 1.0 in this case, though
    the code you pointed me to using XSL 2.0 is a neat example.

    But, actually, I may have been unclear in my description
    of what I'm trying to do. I'm trying to take a docbook
    document and use the docbook fo stylesheets and fop to
    generate a pdf, not text, that has the characteristics
    described below (re-reading my post, I can see that's
    not clear).

    Since I'm willing to have the author insert the two spaces
    between sentences, I think the main question is whether
    there is a combination of parameters/attributes that would
    preserve all spaces except those at the beginning of the
    line in wrapped contexts (like para).

    Thanks very much,
    Dick

    >


  • 4.  Re: [docbook-apps] White space in fo question

    Posted 09-06-2007 16:01
    Dick Hamilton wrote:

    > But, actually, I may have been unclear in my description
    > of what I'm trying to do. I'm trying to take a docbook
    > document and use the docbook fo stylesheets and fop to
    > generate a pdf, not text, that has the characteristics
    > described below (re-reading my post, I can see that's
    > not clear).

    I gathered the end product was pdf... just that the
    processing is needed first? Either one or many para elements.
    The rest can go through on the identity transform, unchanged?



    >
    > Since I'm willing to have the author insert the two spaces
    > between sentences, I think the main question is whether
    > there is a combination of parameters/attributes that would
    > preserve all spaces except those at the beginning of the
    > line in wrapped contexts (like para).

    No, but I wouldn't expect it to be a param issue?
    It's a minor tweak on the way through to print (IMHO).

    source->xslt2->docbook Source ->stylesheets->fop->pdf



    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 5.  RE: [docbook-apps] White space in fo question

    Posted 09-07-2007 17:35
    Dave,
    >
    > >
    > > Since I'm willing to have the author insert the two spaces
    > > between sentences, I think the main question is whether
    > > there is a combination of parameters/attributes that would
    > > preserve all spaces except those at the beginning of the
    > > line in wrapped contexts (like para).
    >
    > No, but I wouldn't expect it to be a param issue?
    > It's a minor tweak on the way through to print (IMHO).
    >
    > source->xslt2->docbook Source ->stylesheets->fop->pdf
    >
    Well, being naturally lazy, I was hoping it would be a simple
    param issue, but I guess I'll need to do a little more work:-).

    Thanks for the help,
    Dick