Dorothy H. wrote:
HI, I have a customer who has made a customization of DocBook, to remove
the software-related elements and add some specific content structure
for their business. I want to make a customization of XML Mind for them.
Would it be the best strategy to copy all the files of the DocBook
configuration and save them all with new names, then edit them to make
the customized config?

I have some experience with config files for other systems but I am new
to XML Mind.


--> Please start by carefully reading this tutorial:

Chapter 2. Writing a configuration file for XXE
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/config_file.html

This is really needed to understand an number of concepts, and also to learn how a custom configuration can be successfully deployed.



--> It's strongly recommended to *never* *copy* files and instead to *include* files from the stock DocBook configuration. Now let me explain how this is done.

What follows is the topmost configuration file for the stock DocBook 5 document type, <XXE_install_dir>/addon/config/docbook5/docbook5.xxe:

---
<configuration name="DocBook v5+" standard
   mimeType="application/x-docbook-5+xml"
  icon="xxe-config:common/mime_types/docbook.png"
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:db="http://docbook.org/ns/docbook";
  xmlns:svg="http://www.w3.org/2000/svg";
  xmlns:xi="http://www.w3.org/2001/XInclude";
  xmlns:xlink="http://www.w3.org/1999/xlink";
  xmlns:html="http://www.w3.org/1999/xhtml";>

  <include location="docbook5_support.incl" />
  <include location="docbook5_common.incl" />

  <detect>
    <and>

<rootElementNamespace>http://docbook.org/ns/docbook</rootElementNamespace>
      <not><rootElementLocalName>assembly</rootElementLocalName></not>
      <or>
        <rootElementAttribute localName="version"
                              namespace="" value="5.0" />
        <not><rootElementAttribute localName="version"
                                   namespace="" /></not>
      </or>
    </and>
  </detect>

  <relaxng location="rng/V5.0/docbook.rng" />
  <schematron location="rng/V5.0/docbook.sch" />

  <template name="Book" location="template/V5.0/book.xml"
            category="DocBook v5+/5.0" />
  ...

</configuration>
---


In a *separate* *directory*:

1) Create a .xxe file including the above one. Let's call it mydb5.xxe:

---
<configuration name="My DocBook 5"
   mimeType="application/x-docbook-5+xml"
  icon="xxe-config:common/mime_types/docbook.png"
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:db="http://docbook.org/ns/docbook";
  xmlns:svg="http://www.w3.org/2000/svg";
  xmlns:xi="http://www.w3.org/2001/XInclude";
  xmlns:xlink="http://www.w3.org/1999/xlink";
  xmlns:html="http://www.w3.org/1999/xhtml";>

  <include location="docbook5-config:docbook5_support.incl" />
  <include location="docbook5-config:docbook5_common.incl" />

  <detect>
    <and>

<rootElementNamespace>http://docbook.org/ns/docbook</rootElementNamespace>
      <rootElementAttribute localName="version"
                            namespace="" value="5.0; my" />
    </and>
  </detect>

  <relaxng location="mydocbook.rng" />

  ...

</configuration>
---

Notice:

- The use of a different configuration name: "My DocBook 5".

- The inclusion of stock docbook5_support.incl and docbook5_common.incl.

This is done by using a "docbook5-config:" prefix. This XML catalog trick will make this work wherever the stock DocBook 5 configuration has been installed.

- The use of a different <detect> rule based on a different version attribute ("5.0; my") found on the root element of your document templates. (This is the normal way of doing this with DocBook 5.)

- The use of a different schema: "mydocbook.rng".

2) You'll want to create one or more custom document templates and declare them as follows in mydb5.xxe:

---
  <template name="Book" location="book.xml" />
---

Note that the root element of all your document templates must have a version attribute equal to "5.0; my".

3) You'll want to style the extra elements. This is done in CSS stylesheet mydocbook5.css as follows:

---
@import url(docbook5-config:css/docbook5.css);

  ...Your Custom
     CSS rules here...
---

Notice how the stock DocBook 5 CSS is imported. Same "docbook5-config:" prefix.

The custom CSS stylesheet must be declared in mydb5.xxe as follows:

---
  <css name="My DocBook" location="mydocbook5.css" />
  <css name="DocBook"  />
  <css name="Table of contents"/>
  <css name="Document structure"/>
  <css name="Show info about included elements"/>
---

The first css element declares your custom stylesheet. The following css elements ``undeclares'' the stock CSS stylesheets.




---
PS: If you have a customized DocBook 4 DTD rather than a DocBook schema, all the concepts are very similar. Simply do not forget to add to your configuration directory an XML catalog pointing to a local copy of your DTD.

--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to