On 11/06/2018 06:30 PM, Rollo, Joseph wrote:

I would like to host an XMLmind servlet that allows users to convert
word documents into DITA maps using the UI. However, I would also like
the servlet UI to generate topics with meaningful file names using the
following parameter: *-p edit.ids.generate-section-ids yes*



Is there any way to enable this option for the servlet’s UI?

The HTML form (the servlet’s UI) contained in the servlet archive (w2x.war) is just a very simple demo. It's not for production use.

The servlet has no stock UI per se, because it's so simple to create a custom UI.

For example, our "Convert DOCX to DITA maps and topics" page (http://www.xmlmind.com/w2x/docx_to_dita.html) uses a different form to invoke the servlet:

---
<form class="convert-form"
      action="http://www.xmlmind.com:8080/w2x/convert";
      enctype="multipart/form-data" method="post" target="_blank">
  <input name="_charset_" type="hidden" />
  <input name="interactive" type="hidden" value="true" />

  <table border="0" class="form-layout">
    <tr style="vertical-align: top;">
      <td><span class="form-label">DOCX input file:</span></td>

      <td>
<input accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
               name="docx" size="70" type="file" />
      </td>
    </tr>

    <tr>
      <td><span class="form-label">Output format:</span></td>

      <td><select name="conv">
          <optgroup label="DITA map+topics">
            <option value="bookmap">bookmap</option>
            <option value="map">map</option>
          </optgroup>

          <optgroup label="DITA topic">
            <option value="topic">Topic</option>
            <option value="concept">Concept</option>
            <option value="reference">Reference</option>
            <option value="strict_task">Strict Task</option>
          </optgroup>
        </select></td>
    </tr>

    <tr>
      <td align="center" colspan="2">
        <input type="submit" value="Convert" />
      </td>
    </tr>
  </table>
</form>
---

If you need to pass "-p edit.ids.generate-section-ids yes" to the conversion, then simply add a hidden "params" <input> to the <form>, that is,

---
<input name="params" type="hidden"
       value="-p edit.ids.generate-section-ids yes" />
---

This gives something starting with:

---
<form class="convert-form"
      action="http://www.xmlmind.com:8080/w2x/convert";
      enctype="multipart/form-data" method="post" target="_blank">
  <input name="_charset_" type="hidden" />
  <input name="interactive" type="hidden" value="true" />
  <input name="params" type="hidden"
         value="-p edit.ids.generate-section-ids yes" />

  <table border="0" class="form-layout">
  ...
 ---

Field "params" may contain as many w2x command-line options as you want.

Field "params" (and also "docx", "conv") is documented here: http://www.xmlmind.com/w2x/_distrib/doc/manual/manual.html#w2x_servlet_api






I would
rather not fall back to the REST API since the servlet’s UI is otherwise
perfect for our needs.

Understood. However, you'll have to create your own HTML <form> as we did it for our "Convert DOCX to DITA maps and topics" page and add an <input name="params" type="hidden" value="..."> to this form.




--
XMLmind Word To XML Support List
w2x-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/w2x-support

Reply via email to