This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] textobject/textdata for external program code


On Thu, Jun 12, 2003 at 04:38:23PM +0100, Rob.Exley@equifax.com wrote:
> I am currently writing a technical spec using DocBook XML 4.2 and
> publishing using Cocoon 2.0.4 with Saxon 6.5.2 and docbook-xsl-1.61.2.
> 
> I have been experiencing problems including external DTD files (and xml
> documents) within an appendix of the document and have finally succeeded by
> using a textdata element within a textobject nested in a programlisting
> element. However I seem to have encountered two problems specifically with
> this:
> 
> I have been forced to use the fileref attribute of the textdata object and
> hard-code the path to the external document. I would ideally have liked to
> us an entityref and then define all my external entities at the top of the
> document. This however seem to give me blank output for both html and pdf
> output. The following was my original document snippet
> 
> <?xml version="1.0"?>
> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
> "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"; [
> <!ENTITY generic-request.dtd SYSTEM
> "/home/r_exley/tmp/code/xml/generic-request.dtd">
> ]>
> .
> .
> .
> <section>
>   <title>generic-request.dtd</title>
>   <programlisting>
>     <textobject>
>       <textdata entityref="generic-request.dtd" />
>     </textobject>
>   </programlisting>
> </section>
> .
> .
> .
> 
> I have since replaced the textdata element in the above with
> 
>       <textdata fileref="/home/r_exley/tmp/code/xml/generic-request.dtd" />
> 
> and this gives me the expected output. My assumption for using the
> entityref approach was that I could extend this to make advantage of
> catalogs.

The entity pointed to by an entityref must have an NDATA type
as declared in the DTD. DocBook declares linespecific
for this, so change your entity declaration to:

<!ENTITY generic-request.dtd SYSTEM
"/home/r_exley/tmp/code/xml/generic-request.dtd" NDATA linespecific>

Then the entityref should work.  The validation process
should have pointed out this problem.

<
> 
> Also in the pdf output resulting from this, the first line for each
> included text file is indented, this is somewhat strange and throws the
> formatting out (and looks ugly). This only occurs in the pdf output, the
> html output is fine.

Inside a programlisting element, all white space is preserved,
including that before and after your textobject.  So change
it to:

   <programlisting><textobject>
        <textdata entityref="generic-request.dtd" />
      </textobject></programlisting>

The whitespace inside textobject should be ignored, though.

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]