On 10/24/2012 05:37 PM, Stefan Seefeld wrote:

I'm editing a large document containing many MathML elements. At some
point quite recently the conversion to pdf, using the fop plugin,
started failing, with the error message
"java.lang.IndexOutOfBoundsException: Index: 0, Size: 0"

Unfortunately, the log itself only seems to contain FOP WARNING
messages, so I can't trace down (or even debug) the issue.

I understand that you don't support fop itself. But would it be possible
to make the error logs a little more accessible and complete ?

Yes, this is already somewhat possible. However the method used to turn on the ``debug mode'' is not very convenient. See below.

See also "Status messages" -- http://www.xmlmind.com/xmleditor/_distrib/doc/help/statusTool.html




In addition to just displaying the full log on demand, it would be great
if I could configure xxe to preserve the output in a file so I can later
look at it.

You'll have a detailed stack trace + XXE will not delete the temporary directory used to execute the document conversion (containing the __doc.fo XSL-FO output file) if you add attribute debug="true" to the <process> element used to perform the conversion.

For example, after adding attribute debug="true" to '<command name="db5.toPSFile"><process>', I get this on my Linux box:

---
$ ls /tmp/xxe6303580014879759837/
__doc.fo  __doc.pdf  __doc.xml  images/  raw/  resources/
---

Assuming that your document is a DocBook 5 one, please replace XXE_install_dir/addon/config/docbook5/xslMenu.incl by the one attached to this email.




On a somewhat related note: Is it possible from within xxe to "comment
out" a particular XML element in the current document ? That's at
present my technique for trying to narrow down what part of the document
triggers the error, given that I don't have any other feedback.


Sorry, but this is currently not possible. I suggest to copy your document elsewhere and to remove elements from the copy. (This is what I do when I have the same problems with FOP.)
<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";>

  <!-- ====== First step used by most process commands defined here ====== -->

  <command name="db5.convertStep1">
    <process>
      <mkdir dir="resources" />
      <mkdir dir="raw" />

      <copyDocument to="__doc.xml">
        <!-- =================================================================
             Support for DocBook 5 imagedata/svg:svg, imagedata/mml:math
             and *equation/mml:math.
        ================================================================= -->
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:svg="http://www.w3.org/2000/svg";
                     xpath="//db5:imagedata/svg:svg" toDir="raw">
          <cfg:attribute name="fileref" 
                         value="resources/{$url.rootName}.png" />
        </cfg:extract>
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:mml="http://www.w3.org/1998/Math/MathML";
                     xpath="//db5:imagedata/mml:math" toDir="raw">
          <cfg:attribute name="fileref" 
                         value="resources/{$url.rootName}.png" />
        </cfg:extract>
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:mml="http://www.w3.org/1998/Math/MathML";
                     xpath="//db5:equation/mml:math |
                            //db5:informalequation/mml:math |
                            //db5:inlineequation/mml:math" toDir="raw">
          <db5:imagedata fileref="resources/{$url.rootName}.png" />
        </cfg:extract>

        <resources match="^[a-zA-Z][a-zA-Z0-9.+-]*:/.+" />

        <resources include="text" match=".+" 
                   resolve="true" />

        <resources include="image" match=".+\.(png|jpg|jpeg|gif)" 
                   copyTo="resources" />
        <resources include="image" match="(?:.+/)?(.+)\.(\w+)"
                   copyTo="raw" referenceAs="resources/$1.png" />

        <resources exclude="text image" match=".+" 
                   copyTo="resources" />
      </copyDocument>

      <convertImage from="raw" to="resources" format="png" />

      <mkdir dir="images/callouts" />
      <copyProcessResources resources="@xsl/images/png_images.list"
                            to="images" />
      <copyProcessResources resources="@xsl/images/callouts/png_callouts.list" 
                            to="images/callouts" />
    </process>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toHTML">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toHTML docbook_file_or_URL \
  -u output_dir_filename_or_URL

  Convert DocBook document docbook_file_or_URL to multi-page HTML.
  Create the HTML pages in directory output_dir_filename_or_URL.

  Example:
  convertdoc db5.toHTML doc.xml -u out/
        </usage>
      </info>

      <subProcess name="db5.convertStep1" />

      <copyProcessResources resources="xsl/css/html.css" to="html.css" 
                            name="css">
        <info>
          <alternateResources name="db5.toHTML.alternateCSS" />
        </info>
      </copyProcessResources>

      <transform stylesheet="xsl/html/chunk.xsl" 
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to multi-page HTML</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/html/profile-chunk.xsl" 
                               label="Generate HTML; profiling stylesheet" />
          <alternateStylesheet location="xsl/xhtml/chunk.xsl" 
                               label="Generate XHTML" />
          <alternateStylesheet location="xsl/xhtml/profile-chunk.xsl"
                               label="Generate XHTML; profiling stylesheet" />
          <alternateStylesheets name="db5.toHTML.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="base.dir">%W%S</parameter>
        <parameter name="chunk.first.sections">1</parameter>
        <parameter name="chunk.section.depth">1</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>
        <parameter name="html.stylesheet">html.css</parameter>

	<parameterGroup name="db5.toHTML.transformParameters" />
      </transform>
 
      <!-- The real HTML file is index.html -->
      <delete files="__doc.*" />

      <upload base="%0/">
        <copyFiles files="*.*" toDir="." />
        <copyFiles files="resources/*" toDir="resources" />
        <copyFiles files="images/*" toDir="images" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToHTML">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveDirectoryURL" />
	<command name="db5.toHTML" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toHTML1">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toHTML1 docbook_file_or_URL \
  -u html_file_or_URL

  Convert DocBook document docbook_file_or_URL to single HTML page 
  html_file_or_URL.

  Example:
  convertdoc db5.toHTML1 doc.xml -u out/doc.html
        </usage>
      </info>

      <subProcess name="db5.convertStep1" />

      <copyProcessResources resources="xsl/css/html.css" to="html.css"
                            name="css">
        <info>
          <alternateResources name="db5.toHTML1.alternateCSS" />
        </info>
      </copyProcessResources>

      <transform stylesheet="xsl/html/docbook.xsl" 
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to single-page HTML</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/html/profile-docbook.xsl" 
                               label="Generate HTML; profiling stylesheet" />
          <alternateStylesheet location="xsl/xhtml/docbook.xsl" 
                               label="Generate XHTML" />
          <alternateStylesheet location="xsl/xhtml/profile-docbook.xsl"
                               label="Generate XHTML; profiling stylesheet" />
          <alternateStylesheets name="db5.toHTML1.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>
        <parameter name="html.stylesheet">html.css</parameter>

	<parameterGroup name="db5.toHTML1.transformParameters" />
      </transform>
 
      <upload base="%0">
        <copyFile file="__doc.html" to="%0" />
        <copyFiles files="*.css" toDir="." />
        <copyFiles files="resources/*" toDir="resources" />
        <copyFiles files="images/*" toDir="images" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToHTML1">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveFileURLWithExtension=html" />
	<command name="db5.toHTML1" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toWebHelp">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toWebHelp docbook_file_or_URL \
  -u output_dir_filename_or_URL

  Convert DocBook document docbook_file_or_URL to a Web Help application
  running in the browser. Create the Web Help files in directory 
  output_dir_filename_or_URL.

  Example:
  convertdoc db5.toWebHelp doc.xml -u out/
        </usage>
      </info>

      <subProcess name="db5.convertStep1" />

      <copyProcessResources resources="xsl/css/webhelp.css"
                            to="webhelp.css" name="css">
        <info>
          <alternateResources name="db5.toWebHelp.alternateCSS" />
        </info>
      </copyProcessResources>

      <transform stylesheet="xsl/webhelp/webhelp.xsl" 
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to Web Help</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/webhelp/profile-webhelp.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toWebHelp.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="base.dir">%W%S</parameter>
        <parameter name="chunk.first.sections">1</parameter>
        <parameter name="chunk.section.depth">3</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>

        <parameter name="html.stylesheet">webhelp.css</parameter>

	<parameterGroup name="db5.toWebHelp.transformParameters" />
      </transform>
 
      <!-- Not useful (and cannot be parsed by whc). -->
      <delete files="__doc.*" />

      <invoke method="com.xmlmind.xmleditext.whc.CompileWebHelp.compile">
        <!-- The parameters of the Web Help Compiler (e.g. wh-jquery-theme) 
             are specified in the above transform element and not here.
             That's why we need the name of the process command 
             in order to access the above transform element. -->
        <argument>db5.toWebHelp</argument>
      </invoke>

      <upload base="%0/">
        <copyFiles files="*.html" toDir="." />
        <copyFiles files="*.css" toDir="." />
        <copyFiles files="resources/*" toDir="resources" />
        <copyFiles files="images/*" toDir="images" />
        <copyFiles files="_wh/*" toDir="_wh" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToWebHelp">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveDirectoryURL" />
	<command name="db5.toWebHelp" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toHTMLHelp">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toHTMLHelp docbook_file_or_URL \
  -u chm_file_or_URL

  Convert DocBook document docbook_file_or_URL to HTML Help file
  chm_file_or_URL.

  This process command requires helper application "hhc.exe" (part of
  Microsoft's HTML Help Workshop) to be associated to files having a "hhp"
  extension. Therefore, this process command only works on Windows.

  Example:
  convertdoc db5.toHTMLHelp doc.xml -u out/doc.chm
        </usage>
      </info>

      <subProcess name="db5.convertStep1" />

      <copyProcessResources resources="xsl/css/htmlhelp.css"
                            to="htmlhelp.css" name="css">
        <info>
          <alternateResources name="db5.toHTMLHelp.alternateCSS" />
        </info>
      </copyProcessResources>

      <transform stylesheet="xsl/htmlhelp/htmlhelp.xsl" 
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to HTML Help</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/htmlhelp/profile-htmlhelp.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toHTMLHelp.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="base.dir">%W%S</parameter>
        <parameter name="manifest.in.base.dir">1</parameter>
        <parameter name="chunk.first.sections">1</parameter>
        <parameter name="chunk.section.depth">1</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>

        <parameter name="html.stylesheet">htmlhelp.css</parameter>

	<parameterGroup name="db5.toHTMLHelp.transformParameters" />
      </transform>
 
      <!-- Not useful. -->
      <delete files="__doc.*" />

      <!-- "C:\Program Files\HTML Help Workshop\hhc.exe" is the 
           HTML Help compiler.
           hhc.exe exit code is 1 even when the compilation is successful.
           Its exit code should be 0. That's why, without "|| exit 0", 
           the process command thinks hhc.exe has failed. -->

      <shell command="helper(.hhp) htmlhelp.hhp || exit 0"
             platform="Windows" />

      <upload base="%0">
        <copyFile file="htmlhelp.chm" to="%0" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToHTMLHelp">
    <macro>
      <sequence>
        <!-- path.separator==';' only on Windows. -->
        <test expression="system-property('path.separator') = ';'" />

	<command name="selectConvertedFile" 
	         parameter="saveFileURLWithExtension=chm" />
	<command name="db5.toHTMLHelp" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toJavaHelpStep1">
    <process>
      <subProcess name="db5.convertStep1" />

      <copyProcessResources resources="xsl/css/javahelp.css" 
                            to="javahelp.css" name="css">
        <info>
          <alternateResources name="db5.toJavaHelp.alternateCSS" />
        </info>
      </copyProcessResources>

      <transform stylesheet="xsl/javahelp/javahelp.xsl"
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to Java Help</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/javahelp/profile-javahelp.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toJavaHelp.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="base.dir">%W%S</parameter>
        <parameter name="chunk.first.sections">1</parameter>
        <parameter name="chunk.section.depth">2</parameter>
        <parameter name="generate.toc"> </parameter>
        <parameter name="callout.graphics">1</parameter>
        <parameter name="html.stylesheet">javahelp.css</parameter>

	<parameterGroup name="db5.toJavaHelp.transformParameters" />
      </transform>
 
      <!-- The real file is not __doc.html -->
      <delete files="__doc.*" />

      <shell command="helper(application/x-java-help-index) ." />
    </process>
  </command>

  <command name="db5.toJavaHelp">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toJavaHelp docbook_file_or_URL \
  -u jar_file_or_URL

  Convert DocBook document docbook_file_or_URL to JavaHelp Jar file
  jar_file_or_URL.

  This process command requires helper application "jhindexer" (part of
  the distribution of JavaHelp) to be associated to files having a 
  "application/x-java-help-index" MIME type.

  Example:
  convertdoc db5.toJavaHelp doc.xml -u out/doc.jar
  ("doc.jar" will contain Java resource "/jhelpset.hs".)

  See also db5.toJavaHelpWithPrefix.
        </usage>
      </info>

      <subProcess name="db5.toJavaHelpStep1" />

      <jar archive="__help_jar__">
        <add files="*.*" />
        <add files="resources/*" />
        <add files="images/*" />
        <add files="JavaHelpSearch/*" />
      </jar>

      <upload base="%0">
        <copyFile file="__help_jar__" to="%0" />
      </upload>
    </process>
  </command>

  <command name="db5.toJavaHelpWithPrefix">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toJavaHelpWithPrefix docbook_file_or_URL \
  -u jar_file_or_URL -s helpset_parent_folder 

  Convert DocBook document docbook_file_or_URL to JavaHelp Jar file
  jar_file_or_URL.

  Unlike db5.toJavaHelp, this process command allows to specify
  the parent folder of "jhelpset.hs". This feature is useful when 
  the host Java application needs to merge several HelpSets.

  This process command requires helper application "jhindexer" (part of
  the distribution of JavaHelp) to be associated to files having a 
  "application/x-java-help-index" MIME type.

  Example:
  convertdoc db5.toJavaHelpWithPrefix doc_fr.xml -u out/doc_fr.jar -s fr
  ("doc_fr.jar" will contain Java resource "/fr/jhelpset.hs".)
        </usage>
      </info>

      <subProcess name="db5.toJavaHelpStep1" />

      <mkdir dir="%1" />
      <copy files="*.*" to="%1" />
      <copy recurse="true" files="resources" to="%1" />
      <copy recurse="true" files="images" to="%1" />
      <copy recurse="true" files="JavaHelpSearch" to="%1" />

      <jar archive="__help_jar__">
        <add files="%1/*" />
      </jar>

      <upload base="%0">
        <copyFile file="__help_jar__" to="%0" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToJavaHelp">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveFileURLWithExtension=jar" />
	<command name="db5.toJavaHelp" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toEclipseHelp">
    <process>
      <info>
        <usage>
convertdoc -p eclipse.plugin.name help_title \
  -p eclipse.plugin.id help_id \
  -p eclipse.plugin.provider help_publisher \
  [other_options] db5.toEclipseHelp docbook_file_or_URL \
  -u output_dir_filename_or_URL

  Convert DocBook document docbook_file_or_URL to Eclipse Help.
  Create the Eclipse Help files in directory output_dir_filename_or_URL.

  Example:
  convertdoc -p eclipse.plugin.name "User Guide" \
    -p eclipse.plugin.id "com.acme.widget.UserGuide" \
    -p eclipse.plugin.provider "ACME Corp." \
    db5.toEclipseHelp doc.xml -u out/
        </usage>
      </info>

      <subProcess name="db5.convertStep1" />

      <copyProcessResources resources="xsl/css/eclipsehelp.css"
                            to="eclipsehelp.css" name="css">
        <info>
          <alternateResources name="db5.toEclipseHelp.alternateCSS" />
        </info>
      </copyProcessResources>

      <transform stylesheet="xsl/eclipse/eclipse.xsl" 
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to Eclipse Help</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/eclipse/profile-eclipse.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toEclipseHelp.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="base.dir">%W%S</parameter>
        <parameter name="manifest.in.base.dir">1</parameter>
        <parameter name="chunk.first.sections">1</parameter>
        <parameter name="chunk.section.depth">3</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>

        <parameter name="html.stylesheet">eclipsehelp.css</parameter>
        <parameter name="eclipse.plugin.name"
          >REDEFINE THIS: title of this help</parameter>
        <parameter name="eclipse.plugin.id"
          >REDEFINE THIS: unique id of this plugin</parameter>
        <parameter name="eclipse.plugin.provider"
          >REDEFINE THIS: author, company or organization</parameter>

	<parameterGroup name="db5.toEclipseHelp.transformParameters" />
      </transform>
 
      <!-- Not useful. -->
      <delete files="__doc.*" />

      <upload base="%0/">
        <copyFiles files="*.*" toDir="." />
        <copyFiles files="resources/*" toDir="resources" />
        <copyFiles files="images/*" toDir="images" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToEclipseHelp">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveDirectoryURL" />
	<command name="db5.toEclipseHelp" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toEpub">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toEpub docbook_file_or_URL \
  -u epub_file_or_URL

  Convert DocBook document docbook_file_or_URL to EPUB file epub_file_or_URL.

  Example:
  convertdoc db5.toEpub doc.xml -u out/doc.epub
        </usage>
      </info>

      <mkdir dir="raw" />
      <mkdir dir="images" />
      <mkdir dir="META-INF" />

      <copyDocument to="__doc.xml">
        <!-- =================================================================
             Support for DocBook 5 imagedata/svg:svg, imagedata/mml:math
             and *equation/mml:math.
        ================================================================= -->
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:svg="http://www.w3.org/2000/svg";
                     xpath="//db5:imagedata/svg:svg" toDir="raw" >
          <cfg:attribute name="fileref" 
                         value="images/{$url.rootName}.png" />
        </cfg:extract>
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:mml="http://www.w3.org/1998/Math/MathML";
                     xpath="//db5:imagedata/mml:math" toDir="raw" >
          <cfg:attribute name="fileref" 
                         value="images/{$url.rootName}.png" />
        </cfg:extract>
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:mml="http://www.w3.org/1998/Math/MathML";
                     xpath="//db5:equation/mml:math |
                            //db5:informalequation/mml:math |
                            //db5:inlineequation/mml:math" toDir="raw" >
          <db5:imagedata fileref="images/{$url.rootName}.png" />
        </cfg:extract>

        <resources match="^[a-zA-Z][a-zA-Z0-9.+-]*:/.+" />

        <resources include="text" match=".+" 
                   resolve="true" />

        <resources include="image" match=".+\.(png|jpg|jpeg|gif)" 
                   copyTo="images" />
        <resources include="image" match="(?:.+/)?(.+)\.(\w+)"
                   copyTo="raw" referenceAs="images/$1.png" />

        <resources exclude="text image" match=".+" 
                   copyTo="images" />
      </copyDocument>

      <convertImage from="raw" to="images" format="png" />

      <mkdir dir="images/callouts" />
      <copyProcessResources resources="@xsl/images/png_images.list"
                            to="images" />
      <copyProcessResources resources="@xsl/images/callouts/png_callouts.list" 
                            to="images/callouts" />

      <copyProcessResources resources="xsl/css/epub.css"
                            to="epub.css" name="css">
        <info>
          <alternateResources name="db5.toEpub.alternateCSS" />
        </info>
      </copyProcessResources>
      <copyProcessResources resources="xsl/epub/mimetype"
                            to="mimetype" />
      <copyProcessResources resources="xsl/epub/META-INF/container.xml"
                            to="META-INF/container.xml" />

      <transform stylesheet="xsl/epub/epub.xsl" 
                 file="__doc.xml" to="__doc.html">
        <info>
          <label>Convert to Epub</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/html/%{parameter.name|html.stylesheet}.html</documentation>
          <alternateStylesheet location="xsl/epub/profile-epub.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toEpub.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="base.dir">%W%S</parameter>
        <parameter name="chunk.first.sections">1</parameter>
        <parameter name="chunk.section.depth">3</parameter>
        <parameter name="callout.graphics">1</parameter>
        <parameter name="html.stylesheet">epub.css</parameter>
        <!-- Absolute or relative URI of the cover image of the EPUB file.
             A relative URI is relative to the current working directory.
             Must be a PNG or JPEG image at most 1000x1000px large. -->
        <parameter name="epub.cover.image"></parameter>

	<parameterGroup name="db5.toEpub.transformParameters" />
      </transform>
 
      <!-- Not useful. -->
      <delete files="__doc.*" />

      <zip archive="epub.zip">
        <add files="mimetype" store="true" />
        <add files="META-INF/*" />
        <add files="cover.*" />
        <add files="*.html" />
        <add files="*.css" />
        <add files="images/*" />
        <add files="content.opf" />
        <add files="toc.ncx" />
      </zip>

      <upload base="%0">
        <copyFile file="epub.zip" to="%0" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToEpub">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveFileURLWithExtension=epub" />
	<command name="db5.toEpub" parameter='"%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toRTF">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toRTF docbook_file_or_URL \
  -s rtf -s encoding -u rtf_file_or_URL

  Convert DocBook document docbook_file_or_URL to RTF file rtf_file_or_URL.

  Encoding is one of: ASCII, Cp1250 (Windows Eastern European), 
  Cp1251 (Windows Cyrillic) and Cp1252 (Windows Latin-1).

  Example:
  convertdoc db5.toRTF doc.xml -s rtf -s Cp1252 -u out/doc.rtf

convertdoc [options] db5.toRTF docbook_file_or_URL \
  -s wml -s encoding -u wml_file_or_URL

  Convert DocBook document docbook_file_or_URL to WordprocessingML file 
  wml_file_or_URL.

  Encoding is any encoding supported by Java.

  Example:
  convertdoc db5.toRTF doc.xml -s wml -s UTF-8 -u out/doc.word.xml

convertdoc [options] db5.toRTF docbook_file_or_URL \
  -s docx -s encoding -u docx_file_or_URL

  Convert DocBook document docbook_file_or_URL to Office Open XML file 
  docx_file_or_URL.

  Encoding is one of: UTF-8, UTF-16.

  Example:
  convertdoc db5.toRTF doc.xml -s docx -s UTF-8 -u out/doc.docx

convertdoc [options] db5.toRTF docbook_file_or_URL \
  -s odt -s encoding -u odt_file_or_URL

  Convert DocBook document docbook_file_or_URL to OpenDocument file 
  odt_file_or_URL.

  Encoding is any encoding supported by Java.

  Example:
  convertdoc db5.toRTF doc.xml -s odt -s UTF-8 -u out/doc.odt
        </usage>
      </info>

      <mkdir dir="resources" />
      <mkdir dir="raw" />

      <copyDocument to="__doc.xml">
        <!-- =================================================================
          Workaround a bug in DocBook XSL style sheets 1.73.2
          that affects imagedata/svg:svg, imagedata/mml:math
          but not *equation/mml:math.
        ================================================================= -->
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:svg="http://www.w3.org/2000/svg";
                     xpath="//db5:imagedata/svg:svg" toDir="resources" >
          <cfg:attribute name="fileref" value="{$url}" />
        </cfg:extract>
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:mml="http://www.w3.org/1998/Math/MathML";
                     xpath="//db5:imagedata/mml:math" toDir="resources" >
          <cfg:attribute name="fileref" value="{$url}" />
        </cfg:extract>

        <resources match="^[a-zA-Z][a-zA-Z0-9.+-]*:/.+" />

        <resources include="text" match=".+" 
                   resolve="true" />

        <resources include="image" 
                   match=".+\.(png|jpg|jpeg|gif|bmp|wmf|emf|mml|svg)" 
                   copyTo="resources" />
        <resources include="image" match="(?:.+/)?(.+)\.(\w+)"
                   copyTo="raw" referenceAs="resources/$1.png" />

        <resources exclude="text image" match=".+" 
                   copyTo="resources" />
      </copyDocument>

      <convertImage from="raw" to="resources" format="png" />

      <mkdir dir="images/callouts" />
      <copyProcessResources resources="@xsl/images/svg_images.list"
                            to="images" />
      <copyProcessResources resources="@xsl/images/callouts/svg_callouts.list" 
                            to="images/callouts" />

      <transform stylesheet="xsl/fo/docbook.xsl" 
                 file="__doc.xml" to="__doc.fo">
        <info>
          <label>Convert to RTF, WordprocessingML, OOXML, OpenDocument</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/fo/%{parameter.name|paper.type}.html</documentation>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/fo/%{attribute-set.name|formal.object.properties}.html</documentation>
          <alternateStylesheet location="xsl/fo/profile-docbook.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toRTF.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="paper.type">A4</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>
        <parameter name="shade.verbatim">1</parameter>
        <parameter name="ulink.show">0</parameter>
        <parameter name="variablelist.as.blocks">1</parameter>

	<parameterGroup name="db5.toRTF.transformParameters" />
      </transform>

      <processFO processor="XFC" file="__doc.fo" to="__doc.%0">
        <parameter name="outputFormat">%0</parameter>
        <parameter name="outputEncoding">%1</parameter>
        <parameter name="imageResolution">120</parameter>
        <parameter name="prescaleImages">false</parameter>
	<parameterGroup name="db5.toRTF.XFCParameters" />
      </processFO>

      <upload base="%2">
        <copyFile file="__doc.%0" to="%2" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToRTF">
    <macro>
      <sequence>
	<command name="selectConvertedFile" 
	         parameter="saveFileURLWithExtension=%2" />
	<command name="db5.toRTF" parameter='"%0" "%1" "%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toPS">
    <process>
      <mkdir dir="resources" />
      <mkdir dir="raw" />

      <copyDocument to="__doc.xml">
        <!-- =================================================================
          Workaround a bug in DocBook XSL style sheets 1.73.2
          that affects imagedata/svg:svg, imagedata/mml:math
          but not *equation/mml:math.
        ================================================================= -->
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:svg="http://www.w3.org/2000/svg";
                     xpath="//db5:imagedata/svg:svg" toDir="resources" >
          <cfg:attribute name="fileref" value="{$url}" />
        </cfg:extract>
        <cfg:extract xmlns=""
                     xmlns:db5="http://docbook.org/ns/docbook";
                     xmlns:mml="http://www.w3.org/1998/Math/MathML";
                     xpath="//db5:imagedata/mml:math" toDir="resources" >
          <cfg:attribute name="fileref" value="{$url}" />
        </cfg:extract>

        <resources match="^[a-zA-Z][a-zA-Z0-9.+-]*:/.+" />

        <resources include="text" match=".+" 
                   resolve="true" />

        <resources include="image" 
                   match="(?:.+/)?(.+)\.(png|jpg|jpeg|gif|mml|svg|svgz%1)" 
                   copyTo="resources" referenceAs="resources/$1.$2" />
        <resources include="image" match="(?:.+/)?(.+)\.tex"
                   copyTo="raw" referenceAs="resources/$1.%0" />
        <resources include="image" match="(?:.+/)?(.+)\.(\w+)"
                   copyTo="raw" referenceAs="resources/$1.png" />

        <resources exclude="text image" match=".+" 
                   copyTo="resources" />
      </copyDocument>

      <convertImage from="raw" to="resources" format="%0 png" />

      <mkdir dir="images/callouts" />
      <copyProcessResources resources="@xsl/images/svg_images.list"
                            to="images" />
      <copyProcessResources resources="@xsl/images/callouts/svg_callouts.list" 
                            to="images/callouts" />

      <transform stylesheet="xsl/fo/docbook.xsl"
                 file="__doc.xml" to="__doc.fo">
        <info>
          <label>Convert to PDF, PostScript</label>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/fo/%{parameter.name|paper.type}.html</documentation>
          <documentation>http://docbook.sourceforge.net/release/xsl/current/doc/fo/%{attribute-set.name|formal.object.properties}.html</documentation>
          <alternateStylesheet location="xsl/fo/profile-docbook.xsl" 
                               label="Profiling stylesheet" />
          <alternateStylesheets name="db5.toPS.alternateXSLT" />
        </info>

        <parameter name="use.extensions">1</parameter>
	<!-- Cannot work and generates a lot of error messages. -->
	<parameter name="graphicsize.extension">0</parameter>
        <parameter name="paper.type">A4</parameter>
        <parameter name="toc.section.depth">3</parameter>
        <parameter name="section.autolabel">1</parameter>
        <parameter name="callout.graphics">1</parameter>
        <parameter name="shade.verbatim">1</parameter>
        <parameter name="ulink.show">0</parameter>
        <parameter name="variablelist.as.blocks">1</parameter>

	<parameterGroup name="db5.toPS.transformParameters" />
      </transform>

      <processFO processor="XEP" file="__doc.fo" to="__doc.%0">
        <parameter name="OUTPUT_FORMAT">%0</parameter>
        <!-- Workaround XEP bug: renderx #22766 -->
        <parameter name="VALIDATE">false</parameter>
        <parameter name="PS.LANGUAGE_LEVEL">2</parameter>
	<parameterGroup name="db5.toPS.XEPParameters" />

	<!-- If XEP plug-in has not been installed, try FOP plug-in. -->
	<processFO processor="FOP" file="__doc.fo" to="__doc.%0">
	  <parameter name="renderer">%0</parameter>
	  <parameter name="strict-validation">false</parameter>
	  <parameterGroup name="db5.toPS.FOPParameters" />
	</processFO>
      </processFO>
    </process>
  </command>

  <command name="db5.toPSFile">
    <process debug="true">
      <info>
        <usage>
convertdoc [options] db5.toPSFile docbook_file_or_URL \
  -s pdf -s "|pdf" -u pdf_file_or_URL

  Convert DocBook document docbook_file_or_URL to PDF file pdf_file_or_URL.

  Example:
  convertdoc db5.toPSFile doc.xml -s pdf -s "|pdf" -u out/doc.pdf

convertdoc db5.toPSFile docbook_file_or_URL \
  -s ps -s "|eps|ps" -u ps_file_or_URL

  Convert DocBook document docbook_file_or_URL to PostScript file
  ps_file_or_URL.

  Example:
  convertdoc db5.toPSFile doc.xml -s ps -s "|eps|ps" -u out/doc.ps
        </usage>
      </info>

      <subProcess name="db5.toPS" parameter='"%0" "%1"' />

      <upload base="%2">
        <copyFile file="__doc.%0" to="%2" />
      </upload>
    </process>
  </command>

  <command name="db5.convertToPS">
    <macro>
      <sequence>
	<command name="selectConvertedFile"
	         parameter="saveFileURLWithExtension=%0" />
	<command name="db5.toPSFile" parameter='"%0" "%1" "%_"' />
        <command name="preview" parameter="[lastConverted]" />
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <command name="db5.toPSPrinter">
    <process>
      <info>
        <usage>
convertdoc [options] db5.toPSPrinter docbook_file_or_URL \
  -s ps -s "|eps|ps" -s ps_printer_name

  Convert DocBook document docbook_file_or_URL to PostScript then
  send the generated file to PostScript printer named ps_printer_name.

  Example:
  convertdoc db5.toPSPrinter doc.xml -s ps -s "|eps|ps" -s iR5000
        </usage>
      </info>

      <subProcess name="db5.toPS" parameter='"%0" "%1"' />

      <print file="__doc.%0" printer="%2" />
    </process>
  </command>

  <command name="db5.printPS">
    <macro>
      <sequence>
	<command name="selectPrinter" parameter="%0" />
	<command name="db5.toPSPrinter" parameter='"%0" "%1" "%_"'/>
      </sequence>
    </macro>
  </command>

  <!-- =================================================================== -->

  <menu label="_DocBook" insert="after ##last">
    <separator />
    <menu label="_Convert Document">
      <item label="Convert to _HTML..."
            command="db5.convertToHTML" />
      <item label="Convert to HTML [_one page]..." 
            command="db5.convertToHTML1" />
      <separator />
      <item label="Convert to W_eb Help..."
            command="db5.convertToWebHelp" />
      <separator />
      <item label="Convert to HTM_L Help..."
            command="db5.convertToHTMLHelp" />
      <separator />
      <item label="Convert to _Java Help..."
            command="db5.convertToJavaHelp" />
      <separator />
      <item label="Convert to E_clipse Help..."
            command="db5.convertToEclipseHelp" />
      <separator />
      <item label="Convert to Epu_b..."
            command="db5.convertToEpub" />
      <separator />
      <item label="Convert to _RTF (Word 2000+)..."
            command="db5.convertToRTF" 
	    parameter="rtf Cp1252 rtf" />
      <separator />
      <item label="Convert to _WordprocessingML (Word 2003+)..."
            command="db5.convertToRTF" 
	    parameter="wml UTF-8 wml" />
      <separator />
      <item label="Convert to Office Open _XML (Word 2007+)..."
            command="db5.convertToRTF" 
	    parameter="docx UTF-8 docx" />
      <separator />
      <item label="Convert to Open_Document (OpenOffice.org 2+)..."
            command="db5.convertToRTF" 
	    parameter="odt UTF-8 odt" />
      <separator />
      <item label="Print Post_Script..."
            command="db5.printPS"
            parameter="ps |eps|ps" />
      <separator />
      <item label="Convert to _PDF..."
            command="db5.convertToPS" 
            parameter="pdf |pdf" />
    </menu>
  </menu>

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

Reply via email to