# Migrating HTML to DITA with Java command

## Running example

1. Start the command window.
2. Navigate to the directory of the migration tool.
3. (Optional) If the input HTML file contains namespace, you can remove it by hand, or running the command below:
   enter the following command when using Saxon:

       java com.icl.saxon.StyleSheet mytask.htm preprocess.xsl > mytask.htm

   enter the following command when using Xalan:

       java org.apache.xalan.xslt.Process -in mytask.htm -xsl preprocess.xsl -out mytask.htm

4. Use Saxon or Xalan directory to run the migration, on the command line,
   enter the following command when using Saxon:

       java com.icl.saxon.StyleSheet mytask.htm h2d.xsl infotype=task > mytask.dita

   enter the following command when using Xalan:

       java org.apache.xalan.xslt.Process -in mytask.htm -xsl h2d.xsl -out mytask.dita -param infortype task

You can also add other parameters to this properties file. See the following table for details.

Note: The output directory of the generated DITA file should exist, since the XSLT processor can't create it automatically.

## Supported parameters

The following table lists the supported parameters that you can set with the java command.

Table 1. Table of supported parameters
Parameter | Description | Required
--- | --- | ---
infotype | The infotype of generated DITA files. Topic, concept, task, and reference are valid values. Default is topic. | No.
dita-extension | The extension for links that go to other DITA topics. ".dita" and ".xml" are valid values. Default is ".dita". Note: The extension of the generated DITA file can't specified by this parameter, it only can be specified along with the output filename. | No.
FILENAME | It is used to determine the main topic's ID. Note: The FILENAME should ends with '.htm' or '.html'. Invalid ID characters, including all numbers, will be replaced with letters. | No.
default-lang | The default language of output DITA files. Default is "en-us". Note: For supported language, please refer to `strings.xml` under the directory `${ditaot_dir}/xsl/common`. | No.

Parent topic: Migrating HTML to DITA