Next in thread → Next in month →

Re: [docbook-apps] Problems generating well formatted TOC (2)

From
"Cob Rtayton"
Date
2008-01-29T17:35:52+00:00
ID
1ABCD9726FCA4B6DA5DB67DDCB82C0A8@sheeta
Thread
Re: [docbook-apps] Problems generating well formatted TOC (2)
Hi Isabel,

I would say the defect is in the XML Editor.  
A line break and space indent after the opening tag of <title> is a text 
node.  Any element whose content model includes plain text (such as title) 
must have all of its text nodes respected by the editor.  That said, the 
editor should also not be *inserting* text nodes for such elements through the 
pretty printing process.  Such line breaks and indents by the pretty 
printer should only be done in elements whose content model consists 
of only other elements, where the added white space between elements is not 
significant.  Since Serna is a schema-aware editor, it should know about 
that.  I would raise this issue with tech support at Syntext.

 

Asking the stylesheet to remove the leading and 
trailing white space text nodes can be done, but it isn't  as trivial as 
you might think.  The stylesheet has to examine the first node of title to 
determine if it is a text node. If it contains only white space characters, then 
don't output it.  If there is are white space characters and then some text 
instead of <phrase>, then the stylesheet has to handle the text node as a 
string and trim off leading white space from the text node and output the 
rest.

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Isabel Hofherr 

  
To:  
  

  
Sent: Tuesday, January 29, 2008 4:49 
  AM

  
Subject: [docbook-apps] Problems 
  generating well formatted TOC (2)

  

  

  
Hi,

  
 

  
Meanwhile I have 
  realized why there is a larger indent. 

  
It is caused by a 
  line break in the XML-file between title- and phrase-tag, which look like 
  this:

  
<chapter>

  
  
  <title>

  
     
  <phrase condition="x">Product 
  X</phrase>

  
     
  <phrase condition="y">Product 
  Y</phrase>

  
     
  <phrase condition="z">Product 
  Z</phrase>

  
</title>

  
  
  <section>…………… etc

  
 

  
If I delete the line 
  breaks…

  
<chapter>

  
  
  <title><phrase condition="x">Product X</phrase><phrase 
  condition="y">Product Y</phrase><phrase condition="z">Product 
  Z</phrase></title>

  
  
  <section>…………….etc

  
…the TOC in the 
  output looks perfect!

  
 

  
Now my 
  question:

  
Is this defect 
  probably caused by the XML-Editor I’m using (Syntext Serna) or by the docbook 
  stylesheet file?

  
I think line breaks 
  in the source code should be ignored…

  
 

  
 

  
Thank 
  you,

  
 

  
Isabel

  
 

  
 

  

  
  

  
Von: Isabel 
  Hofherr [mailto:] 
Gesendet: Montag, 28. Januar 2008 13:25
An: 
  
Betreff: [docbook-apps] problems 
  generating well formatted TOC

  
 

  
Hi ,

  
 

  
There are several identical 
  documentations only differing by chapter titles or section titles. 
  

  
What I did is inserting in the 
  title tag of the chapter (resp. section) different phrases (with the according 
  title) controlled by conditions.

  
All worked well, that means the 
  output files look good. But the only exception is the 
  TOC.

  
There is a larger indent of the 
  page numbers just exactly on the titles controlled by the phrases. It looks 
  something like this:

  
Training 
  ...................................................................................................... 
  1

  
New Features 
  ........................................................................................... 
  1

  
XXX 
  .......................................................................................................... 
  1

  
XXX 
  .......................................................................................................... 
  1

  
XXX 
  .......................................................................................................... 
  2

  
XXX 
  .......................................................................................................... 
  3

  
 

  
Does anybody have an idea how to avoid this 
  indent?

  
Thanks!

  
 

  
Isabel 
  Hofherr
Next in thread → Next in month →