Page 1 of 1

Getting olink working in DocBook 5

Posted: Thu Sep 22, 2016 9:32 pm
by dsrawlins
Hi,

I have an evaluation copy of XML Author and I'm trying to get olink working but I'm getting the error "F [Saxon6.5.5] A DOCTYPE is not allowed in content." in target.db.

Here are the custom parameters in my xsl:

Code: Select all


bibliography.collection						'${cfdu}/jabref.xml'
bibliography.numbered '1'
collect.xref.targets 'yes'
html.ext 'xhtml'
section.autolabel '1'
section.label.includes.component.label '1'
target.database.document '${cfdu}/olinkdb.xml'
targets.filename '${pd}/target.db'
Here is the target.db (which is generated automatically):

Code: Select all


<!DOCTYPE div
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<div element="book" href="#manual" number="" targetptr="manual">
<ttl>Manual</ttl>
<xreftext>Manual</xreftext>
<div element="chapter" href="#secondCh" number="1" targetptr="secondCh">
<ttl>Second</ttl>
<xreftext>Chapter 1, <em xmlns="http://www.w3.org/1999/xhtml">Second</em></xreftext>
</div>
<div element="bibliography" href="#bib" number="" targetptr="bib">
<ttl>Bibliography</ttl>
<xreftext>Bibliography</xreftext>
<obj element="bibliomixed" href="#Duan2016" number="" targetptr="Duan2016">
<ttl>???TITLE???</ttl>
<xreftext>1</xreftext>
</obj>
<obj element="bibliomixed" href="#Pierce2016" number="" targetptr="Pierce2016">
<ttl>???TITLE???</ttl>
<xreftext>2</xreftext>
</obj>
</div>
</div>
Here is olinkdb.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE targetset SYSTEM "file:/C:/Program%20Files/Oxygen%20XML%20Author%2018/frameworks/docbook/xsl/common/targetdatabase.dtd" [
<!ENTITY manualTargets SYSTEM "file:/S:/Examples/WordReplacement/DocBook/target.db">
]>
<targetset>
<targetsetinfo> Description of this target database document. </targetsetinfo>
<!-- Site map for generating relative paths between documents -->
<sitemap>
<dir name="out">
<dir name="xhtml">
<document targetdoc="manual" baseuri="manual.xhtml">&manualTargets;</document>
</dir>
</dir>
</sitemap>
</targetset>
Here is my main document, manual.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="manual">
<info>
<title>Manual</title>
<author>
<orgname>Musculoskeletal Research Laboratories</orgname>
<address>
<street>50 S. Central Campus Drive</street>
<city>Salt Lake City</city>
<state>Utah</state>
<postcode>84112</postcode>
</address>
</author>
</info>
<!--<xi:include href="first.xml"/>-->
<xi:include href="second.xml"/>
<xi:include href="bib.xml"/>
</book>
Here is the included document, second.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0" xml:id="secondCh">
<title>Second</title>
<para>Here is a citation reference <olink targetdoc="bib" targetptr="Duan2016"/></para>
</chapter>
And here is the bibliography, bib.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<bibliography xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="bib">
<bibliomixed xml:id="Duan2016"></bibliomixed>
<bibliomixed xml:id="Pierce2016"></bibliomixed>
</bibliography>

Re: Getting olink working in DocBook 5

Posted: Fri Sep 23, 2016 10:20 am
by radu_pisoi
Hi,

I think the problem is the DOCTYPE declaration specified in the 'target.db' file. That prevented a target database from using a system entity reference to pull in the target.db files.

Please see the Docbook issue:
https://sourceforge.net/p/docbook/bugs/1217/

Could you try to remove the DOCTYPE declaration from the 'target.db' file and try the transformation again?

Re: Getting olink working in DocBook 5

Posted: Fri Sep 23, 2016 8:50 pm
by dsrawlins
I changed from xhtml to html and that got rid of the DOCTYPE in target.db. Here's my new target.db:

Code: Select all


<div element="book" href="#manual2" number="" targetptr="manual2"><ttl/><xreftext/>
<div element="chapter" href="#d5e2" number="1">
<ttl>First Chapter</ttl>
<xreftext>Chapter 1, <i>First Chapter</i></xreftext>
<div element="sect1" href="#d5e4" number="1.1">
<ttl>First Section</ttl>
<xreftext>Section 1.1, “First Section”</xreftext>
</div>
</div>
<div element="bibliography" href="#bib2" number="" targetptr="bib2">
<ttl>Bibliography</ttl>
<xreftext>Bibliography</xreftext>
<obj element="bibliomixed" href="#Duan2016" number="" targetptr="Duan2016">
<ttl>???TITLE???</ttl>
<xreftext>1</xreftext>
</obj>
<obj element="bibliomixed" href="#Pierce2016" number="" targetptr="Pierce2016">
<ttl>???TITLE???</ttl>
<xreftext>2</xreftext>
</obj>
</div>
</div>
Why does it have the <ttl/><xreftext/> after the first div tag? The olinkdb.xml file is also throwing the error that "Element type 'i' must be declared." for this file.

Here is the olinkdb.xml file:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE targetset SYSTEM "file:/C:/Program%20Files/Oxygen%20XML%20Author%2018/frameworks/docbook/xsl/common/targetdatabase.dtd" [
<!ENTITY manual2Targets SYSTEM "target.db">
]>
<targetset>
<targetsetinfo> Description of this target database document. </targetsetinfo>
<!-- Site map for generating relative paths between documents -->
<sitemap>
<dir name="out">
<dir name="xhtml">
<document targetdoc="manual2" baseuri="manual.xhtml">&manual2Targets;</document>
</dir>
</dir>
</sitemap>
</targetset>
These documents will be worked on by several collaborators on different operating systems so I'm wondering if the targetdatabase.dtd is available online? If not, is there a way to specify a user variable for the path to the dtd?

Here is the updated manual2.xml file:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbookxi.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="manual2">
<chapter>
<title>First Chapter</title>
<sect1>
<title>First Section</title>
<para>Here's a link <olink targetdoc="bib2" targetptr="Duan2016"/></para>
</sect1>
</chapter>
<xi:include href="bib2.xml"/>
</book>
And here is the bib2.xml file:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<bibliography xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="bib2">
<bibliomixed xml:id="Duan2016"></bibliomixed>
<bibliomixed xml:id="Pierce2016"></bibliomixed>
</bibliography>
I'm now getting the error: "[Saxon6.5.5] Error: unresolved olink: targetdoc/targetptr = 'bib2/Duan2016'" for the olink in manual2.xml.

Re: Getting olink working in DocBook 5

Posted: Mon Sep 26, 2016 8:50 pm
by dsrawlins
I added a second included document, chapter2.xml, and figured out the olink targetdoc needs to be "manual2" instead of "bib2". That solved the olink problem.

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0" xml:id="secondCh">
<title>Second Chapter</title>
<para>And here's another link <olink targetdoc="manual2" targetptr="Pierce2016"/></para>
</chapter>