map.dtd not found during preprocess

128 views
Skip to first unread message

AJ Côté

unread,
Nov 23, 2019, 3:47:29 AM11/23/19
to DITA-OT Users
I made ANT target to handle a ditamap (read and write content into a new ditamap), but it stops with an error under a very specific condition.

When the original ditamap does not have the <!DOCTYPE map  PUBLIC '-//OASIS//DTD DITA Map//EN'  'map.dtd'> declaration, everything runs perfect, but when it is there, my ANT target stops: it resolves badly the dtd filepath. /home/folderpath_to_the_ditamap/map.dtd (No such file or directory)

The file path should be: /home/folderpath_to_ditaot/plugins/org.dita.specialization.dita11/map.dtd

I tried many things following comments I found in the web, but none of them works. I understand that I should add an instruction to find that map.dtd, but I didn't find anything that work.
I searched in the other plugins how they set the catalog or definition files, but I didn't found what I need.

Someone knows which parameter or ANT variable I could set to help the resolver?

The error message I get:
mynameplugin.preprocessing:
     
[xslt] Processing /home/folderpath_to_the_ditamap/A_Ditamap_Name.ditamap to /home/folderpath_to_the_ditamap/temp_A_Ditamap_Name.ditamap
     
[xslt] Loading stylesheet /home/folderpath_to_ditaot/plugins/org.myname.mynameplugin/xsl/map_topichead_title.xsl
     
[xslt] : Error! I/O error reported by XML parser processing file:/home/folderpath_to_the_ditamap/A_Ditamap_Name.ditamap: /home/folderpath_to_the_ditamap/map.dtd (No such file or directory) Cause: java.io.FileNotFoundException: /home/folderpath_to_the_ditamap/map.dtd (No such file or directory)
     
[xslt] Failed to process /home/folderpath_to_the_ditamap/A Ditamap Name.ditamap
Error: net.sf.saxon.trans.XPathException: I/O error reported by XML parser processing file:/home/folderpath_to_the_ditamap/A_Ditamap_Name.ditamap: /home/folderpath_to_the_ditamap/map.dtd (No such file or directory)

Toshihiko Makita

unread,
Nov 23, 2019, 6:10:00 AM11/23/19
to DITA-OT Users
If you want to add your original map processing XSLT task, try to specify XML catalog as nested element:

    <xmlcatalog>
        <catalogpath path="${dita.dir}/catalog-dita.xml"/>
    </xmlcatalog>

Regards,
-- 
/*--------------------------------------------------
 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/ 

2019年11月23日土曜日 17時47分29秒 UTC+9 AJ Côté:

AJ Côté

unread,
Nov 23, 2019, 8:49:34 AM11/23/19
to DITA-OT Users
Thanks Toshihiko,
Unfortunately, I got the same error.

Here all <xslt> calls I tried (and got the same error):

----
        <xslt in="${args.input}"
              out="${args.inputmap}"
              style="${dita.plugin.myplugin.dir}/xsl/map_topichead_title.xsl">
            <xmlcatalog refid="dita.catalog"/>
         </xslt>
----
        <xslt in="${args.input}"
              out="${args.inputmap}"
              style="${dita.plugin.myplugin.dir}/xsl/map_topichead_title.xsl">

            <xmlcatalog>
                <catalogpath path="${dita.dir}/catalog-dita.xml"/>
            </xmlcatalog>
        </xslt>
----
        <xslt in="${args.input}"
              out="${args.inputmap}"
              style="${dita.plugin.myplugin.dir}/xsl/map_topichead_title.xsl">
            <xmlcatalog>
                <catalogpath path="${dita.plugin.org.dita.base.dir}/catalog-dita.xml"/>
            </xmlcatalog>
        </xslt>
----


Maybe these infos could help?
     [echo] * DITA-OT version = 3.4.0
     [echo] * XML parser = Xerces
     [echo] * XSLT processor = Saxon
     [echo] * collator = ICU

Toshihiko Makita

unread,
Nov 23, 2019, 9:03:19 AM11/23/19
to DITA-OT Users
Hi,

> Unfortunately, I got the same error.

It would be better to attach your build.xml and plugin.xml files here.

Regards,

2019年11月23日土曜日 22時49分34秒 UTC+9 AJ Côté:

Joe Williams

unread,
Nov 23, 2019, 9:42:59 AM11/23/19
to Toshihiko Makita, DITA-OT Users
I think this is because Ant isn't finding the resolver, which is in the lib directory of the OT (please correct this is I'm wrong, someone). I have repeatedly run into this when I decide not to use the "dita" command, which sets all the environment variables, including the one that sees the resolver. 
One fix is the use the "dita" command to start the build process.
Another is to add the ant property "lib=path/to/dita-ot/lib" when you start ant. 
Finally, this has worked for me, also:

    <target name="myTarget">
        <xmlcatalog id="ditaCatalog">
            <catalogpath>
                <fileset dir="${dita.dir}" includes="**/catalog.xml"/>
                <fileset dir="${dita.dir}" includes="**/catalog-dita.xml"/>
            </catalogpath>
        </xmlcatalog>
        <xslt in="${args.input.dir}/${args.input}" style="${resources}/myXsl.xsl"
            out="${resources}/myOutFile.html">
            <xmlcatalog refid="ditaCatalog"/>
        </xslt>
    </target>
Message has been deleted

AJ Côté

unread,
Nov 23, 2019, 12:00:22 PM11/23/19
to DITA-OT Users
Thanks Joe, adding the <catalogpath> declaration resolved my problem. Thanks again !

One fix is the use the "dita" command to start the build process.
In my case, I already execute the whole stuff by calling the dita executable (ditaot/bin/dita.bat).

Joe Williams

unread,
Nov 23, 2019, 3:01:32 PM11/23/19
to AJ Côté, DITA-OT Users
Glad to help and glad it worked! CORRECTION: "-lib" is an option, not a property, so it would be like "ant -lib=path/to/ot/lib/directory -Dargs,input=etc"

Radu Coravu

unread,
Nov 25, 2019, 12:38:24 AM11/25/19
to Joe Williams, AJ Côté, DITA-OT Users
Hi,

The ANT catalog resolver has problems when having multiple indirection (XML catalogs referring to other catalogs and so on), this DITA OT issue is related with this thread:


This is probably why giving the ANT "xslt" task references to all the XML catalogs works.

But another way to do this is to stop using ANT's "xslt" task and use instead the DITA OT's specific "xslt" task, something like:

<target name="test">
<pipeline>
   <xslt
     basedir="${dita.temp.dir}"
     destdir="${dita.temp.dir}.1"
     includesfile="${dita.temp.dir}/${fullditatopicfile}"
     style="${dita.plugin.com.oxygenxml.webhelp.classic.dir}/xsl/review/review-pis-to-elements.xsl"
     reloadstylesheet="${webhelp.reload.stylesheet}">
     
     <excludesfile name="${dita.temp.dir}/${resourceonlyfile}" if:set="resourceonlyfile"></excludesfile>
     <includesfile name="${dita.temp.dir}/${chunkedtopicfile}" if:set="chunkedtopicfile"></includesfile>
     <param name="x" expression="${y}"></param>
     <xmlcatalog refid="dita.catalog"></xmlcatalog>      
     <mapper type="identity"/>
   </xslt>
</pipeline>    

Once you use the "xslt" task with that wrapper "pipeline" element, you will actually use a DITA OT specific implementation of the "xslt" task which has similar arguments with the original one and which should use the Xerces catalog resolver, bypassing the ANT resolver problem.

Regards,
Radu

On Sat, Nov 23, 2019 at 10:01 PM Joe Williams <jdwinf...@gmail.com> wrote:
Glad to help and glad it worked! CORRECTION: "-lib" is an option, not a property, so it would be like "ant -lib=path/to/ot/lib/directory -Dargs,input=etc"

--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dita-ot-users/CAOuKr%3D7wx3sr2mxrgv5ws7io20CtXfZPVKCKK-HeRHGcy9dgzw%40mail.gmail.com.

AJ Côté

unread,
Nov 25, 2019, 4:05:37 AM11/25/19
to DITA-OT Users
Hi Radu, thanks for your suggestion.

But another way to do this is to stop using ANT's "xslt" task and use instead the DITA OT's specific "xslt" task
Before writing my post, I already tried that wrapper call (the <pipeline> element, as I saw in DITA-OT documentation). The resolver error continues to occur, but I also got something else: the "gen-list" target is executed while my preprocess step (i.e. previous step) still failed.

Now that I could resolve the resolver problem, I wrapped the xslt call with the pipeline element. However, I still need the xmlcatalog/catalogpath declaration.

Reply all
Reply to author
Forward
0 new messages