Thread: [Refdb-users] FO stylesheet problem #2: docbook xml book converts to invalid FO
Status: Beta
                
                Brought to you by:
                
                    mhoenicka
                    
                
            | 
      
      
      From: David N. <dav...@bi...> - 2004-03-06 15:12:23
       | 
| Hi all, I've just attempted for the first time to produce pdf output from a docbook xml book (my previous efforts being with docbook xml _articles_). Here is the basic document, without any refdb features: ........................................................................................ <?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"> <book> <bookinfo> <title>Test of Reference Name</title> <author> <surname>Nebauer</surname> <firstname>David</firstname> </author> </bookinfo> <chapter id="bogus"> <title>Bogus Reference</title> <para>Here's a reference to [... citation here ...] involve the refdb machinery.</para> </chapter> </book> ........................................................................................ This document easily converts to a 5-page pdf document with saxon and fop. If I now add the bibliography entity declaration, a citation and the bibliography entity itself, I get the following document: ........................................................................................ <?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 bibliography SYSTEM "bookref.bib.xml"> ]> <book> <bookinfo> <title>Test of Reference Name</title> <author> <surname>Nebauer</surname> <firstname>David</firstname> </author> </bookinfo> <chapter id="bogus"> <title>Bogus Reference</title> <para>Here's a reference to <citation role="REFDB">lamport1994</citation> to involve the refdb machinery.</para> </chapter> &bibliography; </book> ........................................................................................ Using the refdbnd Makefile to convert to pdf produces a valid .bib file: ........................................................................................ <!-- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE bibliography PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> --> <bibliography role="refdb"> <title>Reference List</title> <bibliomixed id="IDlamport1994" role="BOOK"> <bibliomset role="intext" id="IDlamport1994X">(<bibliomset relation="author"><surname>Lamport</surname></bibliomset>, <pubdate role="primary">1994</pubdate>)</bibliomset> <bibliomset role="intextsq" id="IDlamport1994S">(<bibliomset relation="author"><surname>Lamport</surname></bibliomset>, <pubdate role="primary">1994</pubdate>)</bibliomset> <bibliomset role="authoronly" id="IDlamport1994A"><bibliomset relation="author"><surname>Lamport</surname></bibliomset></bibliomset> <bibliomset role="authoronlysq" id="IDlamport1994Q"><bibliomset relation="author"><surname>Lamport</surname></bibliomset></bibliomset> <bibliomset role="yearonly" id="IDlamport1994Y">(<pubdate role="primary">1994</pubdate>)</bibliomset> <bibliomset role="bibliography" id="IDlamport1994B"><bibliomset relation="book"><bibliomset relation="author"><surname>Lamport</surname> <firstname>L.</firstname></bibliomset>, </bibliomset><bibliomset relation="book"><pubdate role="primary">1994</pubdate>, </bibliomset><bibliomset relation="book"><title role="BOOK">LaTeX: A Document Preparation System</title> (</bibliomset><bibliomset relation="book"><publishername>Addison-Wesley</publishername>, </bibliomset><bibliomset relation="book"><address><city>Massachusetts</city></address>) </bibliomset></bibliomset></bibliomixed> <bibliomixed role="multixref"></bibliomixed></bibliography> ........................................................................................ It produces an FO file, but that file is not valid. Neither passivetex, fop or xep would convert it to pdf. passivetex became terminally confused and produced gibberish. Here are the error messages for fop and xep: FOP: ........................................................................................ [ERROR] file:/home/david/data/computing/docbook-xml/learn/bookref/bookref.fo:2:56273 master-reference '' for fo:page-sequence matches no simple-page-master or page-sequence-master ........................................................................................ XEP: ........................................................................................ (document [system-id file:/home/david/data/computing/docbook-xml/learn/bookref/bookref.fo] (validate [error] file:/home/david/data/computing/docbook-xml/learn/bookref/bookref.fo: line 2: Attribute 'master-name' cannot occur at element 'fo:page-sequence'. [error] file:/home/david/data/computing/docbook-xml/learn/bookref/bookref.fo: line 2: Attribute 'master-reference' is required for 'fo:page-sequence'. [validation total: 2 errors] Parse error: Invalid XSL FO source 'file:/home/david/data/computing/docbook-xml/learn/bookref/bookref.fo': 2 error(s) found during validation ......................................................................................... Both of them are complaining about the same error: an illegal attribute ('master-name') in element 'fo:page-sequence'. xep also thinks a required attribute ('master-reference') is missing from the same element. Here is the offending bit of the FO file. Look for the <fo:page-sequence id="id2562418" ...> element and see the master-name attribute. I have added some context to show that this element occurs in the FO file after the main text and before the reference list heading. You can also see the duplication of the text: "Reference List". ........................................................................................................ Here's a reference to <fo:basic-link internal-destination="IDlamport1994">(Lamport, 1994)</fo:basic-link> to involve the refdb machinery.</fo:block></fo:flow></fo:page-sequence><fo:page-sequence id="id2562418" hyphenate="true" master-name="back" language="en"> [... snip ...] <fo:block>Reference List</fo:block> [... snip ...]<fo:block>Reference List</fo:block> [... snip ...] <fo:block id="IDlamport1994" space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Lamport L., 1994, LaTeX: A Document Preparation System (Addison-Wesley, Massachusetts) </fo:block> ........................................................................................................ This error occurs with both saxon-xerces and xsltproc, which would seem to rule out an xslt processor-specific bug. Since the source file converts to html perfectly the problem appears to lie with the refdb fo stylesheets. Since docbook xml articles do not appear to produce the same error, it involves something specific to docbookx books -- or at least not affecting docbookx articles. Once again, however, I am insufficiently knowledgeable about xsl (and fo) to determine the cause of the problem. Does anybody have an idea what is happening here? Has anyone ever produced a pdf file from a docbook xml book using refdb? Regards, David. | 
| 
      
      
      From: Markus H. <mar...@mh...> - 2004-03-07 16:10:47
       | 
| David Nebauer writes: > Since the source file converts to html perfectly the problem appears to > lie with the refdb fo stylesheets. Since docbook xml articles do not > appear to produce the same error, it involves something specific to > docbookx books -- or at least not affecting docbookx articles. Once > again, however, I am insufficiently knowledgeable about xsl (and fo) to > determine the cause of the problem. > There's a few things we can do to address this problem. First of all, your hand-coded test document #1 does not contain a bibliography. I don't expect this to be the reason, but you should probably provide a hand-coded bibliography to test the stock DocBook stylesheet bibliography code. Second, you could attempt to process the document using the stock DocBook stylesheets. The result will be more than ugly, but this could help to isolate the problem. If the RefDB driver files are the culprit, the DocBook fo stylesheets should transform the document without errors, regardless of how nasty the output is going to look. Third, I suspect that a version mismatch might cause the problem. In contrast to the more or less static DSSSL stylesheets, the XSLT stylesheets have changed quite a bit since I implemented the RefDB driver files. It is quite likely that the templates that the driver files override have to be updated to a recent version of the stock DocBook stylesheets. I'll try to find some time next week to look into this. In general, the bibliography code in the fo stylesheets is a lot more complex than in the html stylesheets, as it has to take care of things like recto/verso, proper pagination and such. Therefore it is not surprising that it is easier to confuse than the html output. regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de | 
| 
      
      
      From: David N. <dav...@bi...> - 2004-03-08 00:09:23
       | 
| Hi Markus, <quote who="Markus Hoenicka"> > David Nebauer writes: > > Since the source file converts to html perfectly the problem appears > to lie with the refdb fo stylesheets. Since docbook xml articles do > not appear to produce the same error, it involves something specific > to docbookx books -- or at least not affecting docbookx articles. > Once again, however, I am insufficiently knowledgeable about xsl > (and fo) to determine the cause of the problem. > > Second, you could attempt to process the document using the stock > DocBook stylesheets. The result will be more than ugly, but this could > help to isolate the problem. If the RefDB driver files are the > culprit, the DocBook fo stylesheets should transform the document > without errors, regardless of how nasty the output is going to look. I didn't mention it in my message, but I did process the <filename>.xml, file produced by refdbxml, using the stock docbookx stylesheets. It transformed the document into valid FO and subsequently to valid PDF. Although it was, as you say, more than ugly. I guess that leaves us with the third option of a stylesheet version mismatch. It's so frustrating to have a workable toolchain just out of reach... I'll keep prodding away at the problem, but for now it's beyond my skill level to debug. Regards, David. | 
| 
      
      
      From: Markus H. <mar...@mh...> - 2004-03-08 21:39:51
       | 
| David Nebauer writes: > I guess that leaves us with the third option of a stylesheet version > mismatch. > I've tried this option and updated the stylesheet code to match the current DocBook-xsl verison 1.65.0. Seems to work alright now. I've checked in the updated version (1.5). I've also sent you a copy by private mail. Please try and see whether it fixes your problems as well. regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de | 
| 
      
      
      From: David N. <dav...@bi...> - 2004-03-09 07:58:00
       | 
| Hi Markus, >David Nebauer writes: > > I guess that leaves us with the third option of a stylesheet version > > mismatch. > > > >I've tried this option and updated the stylesheet code to match the >current DocBook-xsl verison 1.65.0. Seems to work alright now. I've >checked in the updated version (1.5). I've also sent you a copy by >private mail. Please try and see whether it fixes your problems as >well. > > That certainly fixed the problem of the docbookx book not printing, which refdb is now doing just fine. Amazingly, it also fixed the duplicate "Reference List" bug! At this point every one of my major concerns has been met, and very promptly too. Thanks for all your help. For what it's worth, I now have a fully functional XML to PDF/HTML toolchain with full bibliographic support. I don't know what inspired you to embark on the refdb project, or keeps you going, but long may it do so. Time to tackle CVS and download an up-to-date version with all the changes rolled in. Regards, David. |