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


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

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

Subject: Re: [docbook] Embedding XML schema into DocBook document

Thanks Jirka. I'm not sure I exactly follow all your code (e.g. I can't see
where you're inserting <br> and &nbsp;), but I added it to my customization
layer. It removed the <pre> tags and replaced them with <p
class="programlisting"> and added &nbsp; and <br> within it. I changed the
p.programlisting setting in the css to "white-space: nowrap" as you suggest,
but that doesn't seem to be right. Per the CSS2.1 spec
(http://www.w3.org/TR/CSS21/text.html#white-space-prop) nowrap: "collapses
whitespace as for 'normal', but suppresses line breaks within text."

I don't want to collapse the whitespace, as then everything is left
justified and I lose my indentation in the schema. However, even using this
setting it doesn't wrap, and I'm guessing that's because by definition
nowrap surpresses line breaks. It seems like I'd still need to use pre-wrap
to make this work because I want to preserve whitespace and have the
application decide where to put the newlines. Pre-wrap "prevents user agents
from collapsing sequences of whitespace. Lines are broken at newlines in the
source, at occurrences of "\A" in generated content, and as necessary to
fill line boxes," but I can't since it's not supported.

So you would think another solution would be to write a template that fills
in the *indentation* of the lines in the programlisting with &nbsp; (which
for some reason this template does not do) and use white-space: normal which
"directs user agents to collapse sequences of whitespace, and break lines as
necessary to fill line boxes." Right now, however, the problem is that
&nbsp; has been inserted in *all* my spaces, even in the middle of long
lines & sentances...since its a non-breaking space, it doesn't wrap! So even
"p.programlising {white-space = normal}" won't work until the spaces between
words are changed to normal spaces and &nbsp; is added to the areas that
create the indentation.

Any ideas on a way to add the &nbsp; only to the beginning of the lines
where the indentation is? I posted the output using my new customization
layer (with .white-space set to normal) here:
http://dream.berkeley.edu/EventCalendar/testmystyles.html The schema I'm
having problems formatting is in Appendix A of the document, and the css I'm
using is can be viewed at the same level:
----- Original Message ----- 
From: "Jirka Kosek" <jirka@kosek.cz>
To: "Allison Bloodworth" <abloodworth@berkeley.edu>
Cc: <docbook@lists.oasis-open.org>
Sent: Thursday, October 07, 2004 1:02 PM
Subject: Re: [docbook] Embedding XML schema into DocBook document

Allison Bloodworth wrote:

> in XML Mind was the fact that although their param.xsl stylesheet had the
> monospace.verbatim.properties attribute-set, it didn't have the
> attribute at all...I had added it. Whereas in the new (ver 1.66.1) DocBook
> stylesheets, it already had the wrap-option attribute; I just changed the
> value to "wrap". When I did the transform in saxon and fop using the old
> Mind stylesheets where I had added the attribute, the programlistings
> wrap.

The reason for this behaviour is that in older versions of the
stylesheets wrap property was hardwired into stylesheets and it was not
possible to override it by attribute set.

> 1) Does changing the wrap-option on this attribute-set only affect
> "programlisting"?

It affect all monospaced verbatim elements -- namely screen and may be
few others that I can't name from the top of my head.

> 2) Is there a way to fix this problem in the html? I tried adding the
> declaration to docbook-xsl-1.66.1/html/param.xsl, but got a stylesheet
> compile error that said "No attribute-set exists named

HTML stylesheets translate programlisting into <pre> element. You can
use CSS to control appearance of HTML elements. If you have browser with
CSS 2.1 support you can use

.programlisting { white-space: pre-wrap }

AFAIK none browser support this. Instead you can try:

.programlisting { white-space: nowrap }

and modify stylesheets to substitute spaces in programlisting by &nbsp;
and line-breaks by <br>. Try add following template into your
customization layer:

<xsl:template match="programlisting">
   <xsl:param name="suppress-numbers" select="'0'"/>
   <xsl:variable name="id">
     <xsl:call-template name="object.id"/>

   <xsl:call-template name="anchor"/>

   <xsl:variable name="rtf">

   <xsl:variable name="content">
     <p class="programlisting">
       <xsl:call-template name="make-verbatim">
          <xsl:with-param name="rtf" select="$rtf"/>

     <xsl:when test="$shade.verbatim != 0">
       <table xsl:use-attribute-sets="shade.verbatim.style">
             <xsl:copy-of select="$content"/>
       <xsl:copy-of select="$content"/>

   Jirka Kosek     e-mail: jirka@kosek.cz     http://www.kosek.cz
   Profesionální školení a poradenství v oblasti technologií XML.
      Podívejte se na náš nově spuštěný web http://DocBook.cz
        Podrobný přehled školení http://xmlguru.cz/skoleni/

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