Next in thread → Next in month →

Re: [docbook-apps] Problems with including code samples using <xi:include>

From
"Cob Rtayton"
Date
2009-08-23T18:25:42+00:00
ID
06e101ca241f$16adde80$0a00a8c0@pazu
Thread
Re: [docbook-apps] Problems with including code samples using <xi:include>
This sounds like an issue of a DOS/Windows line 
ending (CR+LF) being interpreted as a Linux line ending (LF), leaving the CR in 
place as part of the text.   A hex dump of the program code might give 
you a clue. If so, there are utilities to convert the line endings.

 

I would have thought "ignore-if-before-linefeed" 
would work.

 

Bob Stayton
Sagehill Enterprises


 

 

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

  
From: 
  Mathias Schindler 

  
To: Bob Stayton ; DocBook Apps 

  
Sent: Thursday, August 20, 2009 12:34 
  AM

  
Subject: AW: [docbook-apps] Problems with 
  including code samples using <xi:include>

  

  

  I 
  think that XInclude inserts these &#xD; characters. I tried to set the 
  attribute “white-space-treatment” to “ignore-if-before-linefeed“ but it didn’t 
  help.
  Mathias
  
 

  

  

  
Von: Bob Stayton 
  [mailto:] 
Gesendet: Mittwoch, 19. August 2009 
  17:40
An: Mathias Schindler; DocBook Apps
Betreff: Re: 
  [docbook-apps] Problems with including code samples using 
  <xi:include>

  
 

  

  
Indeed, those &#xD; characters are the 
  cause.  Those are carriage return characters.  What you don't see in 
  your 'monospace.verbatim.properties' are the two properties contributed by the 
  'verbatim.properties' attribute-set in fo/param.xsl:

  

  
 

  

  
  <xsl:attribute 
  name="white-space-collapse">false</xsl:attribute>
  
  <xsl:attribute 
  name="white-space-treatment">preserve</xsl:attribute>

  

  
These preserve both the visible &#xD; carriage 
  return and the invisible line feed that ends each line, so you get two 
  line breaks, leaving a blank line.  Is there some reason the &#xD; 
  characters need to be there since the invisible line feeds are 
  retained?

  

  
 

  

  
Bob 
  Stayton
Sagehill Enterprises


  

  
 

  

  
 

  
    

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

    

    
From: Mathias 
    Schindler 

    

    
To: Bob 
    Stayton ; DocBook 
    Apps 

    

    
Sent: Wednesday, 
    August 19, 2009 7:00 AM

    

    
Subject: AW: 
    [docbook-apps] Problems with including code samples using 
    <xi:include>

    

    
 

    
Sorry 
    for my late response but I was on vacation and forgot about this email 
    L! 
    

    
 

    
I 
    use Saxon 9.1.0.2J to resolve the XIncludes.

    
 

    
I 
    think the programlisting stuff has something to do with this: http://services.renderx.com/lists/xep-support/4585.html 
    . 

    
 

    
The 
    document with the resolved XIncludes looks like this:

    
<programlisting 
    language="xml" linenumbering="unnumbered">

    
 &lt;?xml 
    version="1.0" encoding="UTF-8"?&gt;&#xD;

    
&lt;?oxygen 
    RNGSchema="schema/docbookxi.rng" 
    type="xml"?&gt;&#xD;

    
&lt;!DOCTYPE 
    book SYSTEM "schema/text.ent"&gt;&#xD;

    
&lt;chapter 
    xml:id="generalinformation" xmlns="http://docbook.org/ns/docbook"&#xD;

    
    
    xmlns:xi="http://www.w3.org/2001/XInclude" 
    xmlns:xlink="http://www.w3.org/1999/xlink"&gt;&#xD;

    
    
    &lt;title&gt;General 
    Information&lt;/title&gt;&#xD;

    
  
      &lt;indexterm 
    significance="normal"&gt;&#xD;

    
        
    &lt;primary&gt;DocBook&lt;/primary&gt;&#xD;

    
 

    
I 
    think this entity(;&#xD;), causes the empty lines. I’m using XEP 
    4.16 to generate the PDF-Output and my “monospace.verbatim.properties“ 
    attribute-set is defined as follows:

    
    
    <xsl:attribute-set 
    name="monospace.verbatim.properties">

    
        
    <xsl:attribute 
    name="font-size">8pt</xsl:attribute>

    
        
    <xsl:attribute name="font-family">Courier 
    New</xsl:attribute>

    
        
    <xsl:attribute 
    name="hyphenation-character">\</xsl:attribute>

    
        
    <xsl:attribute 
    name="line-height">1.2</xsl:attribute>

    
        
    <xsl:attribute 
    name="border-style">solid</xsl:attribute>

    
        
    <xsl:attribute 
    name="border-color">#E6E5E5</xsl:attribute>

    
        
    <xsl:attribute 
    name="border-width">.5pt</xsl:attribute>

    
        
    <xsl:attribute 
    name="text-align">start</xsl:attribute>

    
        
    <xsl:attribute 
    name="wrap-option">wrap</xsl:attribute>

    
        
    <xsl:attribute 
    name="padding-left">0.10in</xsl:attribute>

    
        
    <xsl:attribute 
    name="padding-right">0.10in</xsl:attribute>

    
        
    <xsl:attribute 
    name="padding-bottom">0.10in</xsl:attribute>

    
        
    <xsl:attribute 
    name="padding-top">0.10in</xsl:attribute>

    
    
    </xsl:attribute-set>

    
 

    
Thanks 
    in advance.

    
 

    
Greetings, 
    Mathias

    
 

    

    

    
Von: Bob Stayton 
    [mailto:] 
Gesendet: Freitag, 31. Juli 2009 
    01:47
An: Mathias Schindler; DocBook Apps
Betreff: Re: 
    [docbook-apps] Problems with including code samples using 
    <xi:include>

    
 

    

    
Hi,

    

    
You didn't mention how you are resolving your 
    XIncludes.  In the libxml2 kit, you could use xmllint --xinclude to 
    generate a document with XIncludes resolved.  Then you could examine 
    the resolved content to see what the XInclude step is doing.

    

    
 

    

    
The page break stuff is particularly strange, as 
    para does not generally trigger a page break.

    

    
 

    

    
Bob 
    Stayton
Sagehill Enterprises


    

    
 

    

    
 

    
      

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

      

      
From: Mathias 
      Schindler 

      

      
To: DocBook 
      Apps 

      

      
Sent: 
      Wednesday, July 29, 2009 4:04 AM

      

      
Subject: 
      [docbook-apps] Problems with including code samples using 
      <xi:include>

      

      
 

      
Hello!

      
 

      
I have included a DocBook XML 
      file (encoded UTF-8) in a programlisting which in turn is placed in an 
      example:

      
 

      
    
      <section 
      xml:id="docbook">
        
      <title>What 
      is DocBook?</title>
        
      <para>DocBook 
      provides…</para>
        
      <para>DocBook has some 
      400 tags...</para>

      

        
      <example>
            
      <title>A 
      typical, simple DocBook document</title>
            
      <programlisting 
      language="xml">

      
   
       <xi:include 
      href="userintroduction.xml" 
      parse="text"><xi:fallback><phrase>userintroduction.xml 
      not found.</phrase><phrase 
      userlevel="internal"> 
      Please check for black holes!</phrase></xi:fallback></xi:include>

      
</programlisting>

      
         
      </example>

      
     
      </section>

      
In the PDF output (using XEP) 
      I have the following two problems:

      
 

      
*Problem 1: The code lines are 
      shown double-spaced instead of single (empty lines between the code lines) 
      and the syntax highlighting does not work. Note that when copy-pasting the 
      code into the DocBook document, both works fine.

      
 

      
*Problem 2: I get two page 
      breaks which I did not bargain for. The PDF is structured as 
      follows:

      
 

      
… blah the end of the last 
      section.

      
What is 
      DocBook?

      
DocBook 
      provides…

      
(half a page 
      empty)

      
(page 
      break)

      
DocBook has some 400 
      tags…

      
(90% of the page 
      empty)

      
(page 
      break)

      
Example: A typical, simple 
      DocBook document

      
…

      
 

      
I use XSLTHL for syntax 
      highlighting. If you need more information please tell 
      me.

      
 

      
Thank you in 
      advance!
Next in thread → Next in month →