Back to start
Back to "Save a Topic Map"

Convert an XTM File to JTMA Format

XTM files can be used with JTMA if they are first converted to the JTML javascript format.  This can be done using a pair of XSLT stylesheets.  The first converts to an intermediate XML format that is more convenient for transforming to the JTML format.  The second converts the intermediate format to JTMA.

The stylesheets are located in the "stylesheets" directory.  Open a command line or shell winfow, then change to the stylesheets directory.  Run the stylesheets using your XSLT processor in a manner similar to this following, which  uses the Saxon processor:

  1. saxon sourcefile.xtm xtm2jtma.xsl > sourcefile.xml
  2. saxon sourcefile.xml js_load_data_2.xsl >sourcefile.js.html
The ".html" part of the filename tells the processor that this is an HTML file (which contains javascript) - this is necessary so that the browser can use the right character encoding.  The ".js" part of the filename - it is only a suggestion - is suggested to remind you that the file really contains the javascript version of the topic map.

Occasionally, there will be an extra or unpaired apostrophe in occurrence data.  The stylesheet tries to escape or match all apostrophes, but once in a while one slips through.  If this happens, the map will not load correctly (and the browser debugger will tell you so).  You would have to correct this by hand in the .js.html file.

After creating the JTMA version of the topic map, copy it into the "maps" directory.  You can load it by typing or pasting the file name into the "load" text box in the browser's left-hand panel.  You can also add new topics, occurrences, etc., to a map loaded this way, and then save the modified map as described in the page called "Save a Topic Map".