Docbook stylesheet customication layer

Having trouble installing Oxygen? Got a bug to report? Post it all here.
val

Docbook stylesheet customication layer

Post by val »

I am completely new to Oxygen and still pretty new to xml/docbook so please bare with me. I'm trying to work with a document that I've processed manually on a Linux box in the past. I'm using Oxygen on Windows as a test.

I have two questions:

1) My book is split into several chapters whose xml is in separate files. These are then defined as Entities in the "book" xml document and imported as such. When I attempt to validate the top level document, I receive the error - "More pseudo attributes are expected." referencing the <?xml version='1.0' ?> line in the first imported file. How do I fix this?

2) I have a style sheet customization layer that's split into subsections in the usual way "/common, /fo, /html". The .xsl files in the fo and html directories "import" the docbook stylesheet, "include" the .xsl file in /common and finally make their own specifications. The "import" statement contains an absolute reference to the standard rpm-installed-place for stylesheets on my Linux box. How do I modify this statement to refer to the Oxygen provided docbook stylesheets? Is there a better way to do this, so I don't end up with different sets of stylesheets for different processing platforms?

Any help at all would be greatly appreciated.

Thanks so much,

Val
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

1) The files imported in your main "book" document represent external parsed entities. According to the XML 1.0 Recommendation

http://www.w3.org/TR/2004/REC-xml-20040 ... c-TextDecl

each of the entities should begin with a text declaration that includes an "encoding" pseudo-attribute, like:

<?xml version='1.0' encoding='UTF-8'?>

<oXygen/> uses the Xerces parser which requires this pseudo-attribute. So you have to add an encoding pseudo-attribute to the text declaration of each of the imported files.

2) You can place your customization layer in the <oXygen/> installation directory (Windows default is C:\Program Files\Oxygen3.1\, Linux default is /home/your_user_name/Oxygen3.1/) and use relative paths in the include and import instructions. For example if you need common/titles.xsl in your customization layer you can place the customization layer in the <oXygen/> installation directory and set the href attribute to "docbook/xsl/common/titles.xsl":

<xsl:include href="docbook/xsl/common/titles.xsl"/>

Now you can copy the customization layer to other computer, in the <oXygen/> installation directory, and it will work without any modification.

Regards,
Sorin
catterall
Posts: 63
Joined: Sat Jan 24, 2004 12:10 am
Location: Oaxaca, Mexico
Contact:

Post by catterall »

Val

Instead of using entities, I now use xi:includes - much more flexible. These work fine with Oxygen 3.1, and can be nested to any depth - <book> includes <part>s, which include <chapter>s, which include <section>s - all in separate files. I also use <formalpara> to get a final sub-division within a <section> file

I use:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"/Applications/Utilities/oxygen/3.1/oxygen/docbook/dtd/docbookx.dtd"
[
<!ENTITY % local_adds SYSTEM "local_adds.dtd" >
%local_adds;
]>
<book id=" ...etc...

where the file local_adds.dtd contains (along with other stuff):

<!ELEMENT xi:include (xi:fallback?) >
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
xpointer CDATA #IMPLIED
encoding CDATA #IMPLIED
accept CDATA #IMPLIED
accept-charset CDATA #IMPLIED
accept-language CDATA #IMPLIED >
<!ELEMENT xi:fallback ANY >
<!ATTLIST xi:fallback
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" >
<!ENTITY % local.preface.class "| xi:include" >
<!ENTITY % local.part.class "| xi:include" >
<!ENTITY % local.chapter.class "| xi:include" >
<!ENTITY % local.divcomponent.mix "| xi:include" >
<!ENTITY % local.para.char.mix "| xi:include" >
<!ENTITY % local.info.class "| xi:include" >
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'" >

(Don't forget the 'pipe' symbols!)

You also need to switch on the use of xi:incluse in the Oxygen config.

Ron
catterall
Posts: 63
Joined: Sat Jan 24, 2004 12:10 am
Location: Oaxaca, Mexico
Contact:

Post by catterall »

Sorry, forgot this - the xi:include "call" inside <book> looks like this:

<xi:include href="part_1.xml" xmlns:xi="http://www.w3.org/2001/XInclude" >
<xi:fallback>
<para>
<emphasis>
MISSING INCLUDE FILE AT LOCATION - part_1.xml
</emphasis>
</para>
</xi:fallback>
</xi:include>

part_1.xml can then do:

<xi:include
href="chapter_1.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" >
<xi:fallback>
<para>
<emphasis>
MISSING INCLUDE FILE AT LOCATION Part_1, Chapter_1 - chapter_1.xml
</emphasis>
</para>
</xi:fallback>
</xi:include>

etc.....

ron
Post Reply