A. Integrating the "Easy Profiling" add-on with document types other than DITA, DocBook and Ebook

Warning

Normal users are not supposed to do this. The intended audience for this appendix is consultants and local gurus.

What follows is a description of what has been done to integrate the "Easy Profiling" add-on with DocBook (v4). Integrating the "Easy Profiling" add-on with other document types should be very similar.

  1. File profiling_install_dir/docbook/template.profiles contains a document template for a ".profiles" file which is specific to DocBook.

    <profiles xmlns="http://www.xmlmind.com/xmleditor/schema/profiling"
              xmlns:prf="http://www.xmlmind.com/xmleditor/schema/profiling"
              class="com.xmlmind.xmleditext.profiling.docbook.DBProfileSet">
    
      <attributes>
        <attribute name="???">
          <value></value>
        </attribute>
      </attributes>
    
      <profile xml:id="???">
        <description xml:space="preserve"></description>
    
        <attribute name="???">
          <value></value>
        </attribute>
      </profile>
    
    </profiles>

    The only part of this document template which is specific to DocBook is attribute class="com.xmlmind.xmleditext.profiling.docbook.DBProfileSet".

    This attribute specifies that in the case of a DocBook document, abstract class com.xmlmind.xmleditext.profiling.ProfileSet is implemented by class com.xmlmind.xmleditext.profiling.docbook.DBProfileSet.

    Class DBProfileSet has been written in the Java™ programming language. It consists in just a few lines of declarative code because it extends abstract class com.xmlmind.xmleditext.profiling.XSLTProfileSet.

    public final class DBProfileSet extends XSLTProfileSet {
        ...
    
        @Override
        public char getDefaultSeparator() {
            return ';';
        }
    
        protected String[] getProfilingAttributeNames() {
            return PROFILING_ATTRIBUTE_NAMES;
        }
    
        protected String getParameterFormat() {
            return "profile.%s";
        }
    
        protected String getNameParameterFormat() {
            // A single custom profiling attribute is supported by the
            // DocBook XSLT stylesheets. Hence no "%d" in the format.
    
            return "profile.attribute";
        }
    
        protected String getValueParameterFormat() {
            return "profile.value";
        }
    }
  2. File profiling_install_dir/docbook/profiling.incl contains these additional configuration elements:

    <configuration xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
      xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration">
    
      <include location="profiling:common/common.incl" />1
    
      <template location="template.profiles"
                name="Conditional Processing Profiles" 
                category="DocBook" order="2000" />2
    
      <profiling>3
        <class>com.xmlmind.xmleditext.profiling.docbook.DBProfileSet</class>
      </profiling>
    
      <menu label="-" insert="after _Demote">4
        <separator />
        <menu label="Conditional Processin_g">
          <item label="_Select Profile..."
                command="setProfiling" />5
          <item label="S_et Profiling Attributes..."
                command="setProfilingAttributes" />6
        </menu>
      </menu>
    
    </configuration>

    1

    File common.incl declares the online help of the "Easy Profiling" add-on by the means of the help configuration element. It also declares how the "Easy Profiling" add-on is localized by the means of the translation configuration element.

    2

    This template configuration element adds document template template.profiles (see above) to the dialog box displayed by FileNew.

    3

    This profiling configuration element specifies that the conditional processing (also called profiling) is to be implemented by class com.xmlmind.xmleditext.profiling.docbook.DBProfileSet in the case of DocBook documents. See Section 1, “The profiling configuration element”.

    4

    This menu configuration element inserts in the DocBook menu, after the Demote menu item, submenu "Conditional Processing".

    5

    First entry in the "Conditional Processing" is "Select Profile" and invokes command setProfiling. See Section 2.1, “Command setProfiling.

    6

    Second entry in the "Conditional Processing" is "Set Profiling Attributes" and invokes command setProfilingAttributes. See Section 2.2, “Command setProfilingAttributes.

  3. The above file is referenced in the stock DocBook configuration (XXE_install_dir/addon/config/docbook/docbook.xxe) as follows:

    <!-- Do not report an error if the "Easy Profiling" add-on 
         has not been installed. -->
    <include location="---1profiling:docbook/profiling.incl2" />

    1

    The "---" prefix before an URL instructs XXE to silently skip the inclusion when the URL cannot be successfully resolved.

    2

    URL profiling:docbook/profling.incl resolves to profiling_install_dir/docbook/profiling.incl because XML catalog profiling_install_dir/catalog.xml contains the following rule:

    <rewriteURI uriStartString="profiling:" rewritePrefix="." />
  4. File profiling_install_dir/common/profiling.imp contains the following declaration:

    @extension "com.xmlmind.xmleditext.profiling.StyleSheetExtension";

    The above CSS stylesheet extension allows the automatic addition of styles to elements having profiling attributes. It can also automatically add styles to elements matching the selected profile and/or to elements matching any “unselected” profile.

  5. The above file is referenced in the stock DocBook CSS stylesheet (XXE_install_dir/addon/config/docbook/css/docbook.css) as follows:

    /* Do not report an error if the "Easy Profiling" add-on 
       has not been installed. */
    @import url(---profiling:common/profiling.imp);