docbook-apps

  • 1.  Re: [docbook-apps] make.clean.html and Firefox handling of white-space: pre ?

    Posted 02-10-2012 17:35
    Hi Mark,
    That solution could work but the general case makes it a bit complicated.

    A programlisting can have inlines, so the solution has to be able to process text
    inside those inlines as well. I think a template that matches on text node
    descendants of programlisting could work:

    <xsl:template match="text()[ancestor::programlisting]">

    Making the substitutions in the text in XSLT 1.0 requires using a recursive template
    to step through each text node. The risk with recursive processing is getting too
    deeply nested in the recursions so that the XSLT processor gives ups. I think Saxon 6
    breaks at about 300 nested recusions. A long programlisting with many spaces and
    newlines could easily exceed that. I've solved that problem in the past by doing two
    levels of recursion, processing the content in, say, 50 line chunks.

    I don't know that we would put this in the stylesheet distribution because it's so
    complicated. It might be easier to just add a note (perhaps Javascript triggered by
    the Firefox user agent string) that if the user wants to cut and paste that they
    should use a browser other than Firefox. 8^)

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net





  • 2.  RE: [docbook-apps] make.clean.html and Firefox handling of white-space: pre ?

    Posted 02-13-2012 03:29
    Bob Stayton [mailto:bobs@sagehill.net] wrote:

    > Making the substitutions in the text in XSLT 1.0 requires using a
    > recursive template
    > to step through each text node. The risk with recursive processing is
    > getting too
    > deeply nested in the recursions so that the XSLT processor gives ups.
    > I think Saxon 6
    > breaks at about 300 nested recusions. A long programlisting with many
    > spaces and
    > newlines could easily exceed that. I've solved that problem in the
    > past by doing two
    > levels of recursion, processing the content in, say, 50 line chunks.


    Tail recursion offers a way arounnd the memory limit. I think that it is implemented in Saxon 6 as well as later versions. See the bottom entry on this page:

    http://dev.saxonica.com/blog/mike/2006/08/#000123


    *************************
    Rob Cavicchio
    rob.cavicchio@emc.com

    Principal Technical Writer & Information Architect
    Information Intelligence Group
    EMC Corporation

    The opinions expressed here are my personal opinions. Content published here is not read or approved in advance by EMC and does not necessarily reflect the views and opinions of EMC.





  • 3.  Re: [docbook-apps] make.clean.html and Firefox handling of white-space: pre ?

    Posted 02-28-2012 09:59
    Hello again,

    Just wanted to follow up in case anyone else finds this workaround useful (or can point out problems).

    JQuery was already in use for other reasons. So I added more JavaScript to the content in the HTML output. When the document loads, Firefox wraps the
    and
    with a
     element:




    This seems to work, though I've only tested it for the version of Firefox on my laptop so far.

    Regards,
    Mark

    On Feb 10, 2012, at 6:35 PM, Bob Stayton wrote:

    > Hi Mark,
    > That solution could work but the general case makes it a bit complicated.
    >
    > A programlisting can have inlines, so the solution has to be able to process text inside those inlines as well. I think a template that matches on text node descendants of programlisting could work:
    >
    > <xsl:template match="text()[ancestor::programlisting]">
    >
    > Making the substitutions in the text in XSLT 1.0 requires using a recursive template to step through each text node. The risk with recursive processing is getting too deeply nested in the recursions so that the XSLT processor gives ups. I think Saxon 6 breaks at about 300 nested recusions. A long programlisting with many spaces and newlines could easily exceed that. I've solved that problem in the past by doing two levels of recursion, processing the content in, say, 50 line chunks.
    >
    > I don't know that we would put this in the stylesheet distribution because it's so complicated. It might be easier to just add a note (perhaps Javascript triggered by the Firefox user agent string) that if the user wants to cut and paste that they should use a browser other than Firefox. 8^)
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    >
    >