Project | WXT | Basics | Download | Documentation | Samples

PI: importodf

The purpose of an importodf PI is to produce an XML-fragment from extracts from an Open Office document and replace the PI with this fragment.

NOTE: That the form of this PI may change. Specially the use of dpath, and the form of the dpath may be changed. It is present at an experimental stage.

<?_wxt importodf dpath="" location=""?>

This import is not complete in the sense that it handles all kinds of objects that may be placed in an Open Office document. WXT can identify: headings, text paragraphs, images, formulas (math), lists and tables.

WXT apply a strategy that backs up the latest successfull import, and use this if an import fails. The backup strategy does not consider changes in content, but if your dpath, se below, fails to identify any material at all, the backup is used. More about DPath .

This backup strategy cost processing time. You may change the strategy by parameters backup and usecopy, see below.

The parameters are:

dpath mandatory The content of any header(h1, h2,.., h6) in the wikipage. Content will be extracted until we meet a heading with same or higher significance. dpath (documentpath) has the form: h1/h2/h3. For instance /Report/summary will extract content in h3:summary "under" h2:report.
dpath may also have a predicate part.
/Report/summary[p] will collect only paragraphs in the selected part. See DPath .
xpath optional Defaults to //body.
Either dpath or xpath must be set. Ifdpath is set, xpath is ignored
location mandatory The location of the file we want to import from. In templates the location parameter is usually skipped. In this case all content files (odtimport) owned by the module in the script are searched for appropriate content unless you reduce the search with parameter id, see below.
usecopy optional Possible values are yes and no. yes will load the local backup without attempting to load the source. This will save time, but it does of course only have meaning if you have accessed and loaded the material at least once before. Default is no. This setting will be overridden by the option use-copy, see Options
id (optional) An id that match the id of the actual xmlimport in script. Has only meaning when this element has no location. One reason to use an id is processing time if you have many contentfiles to a module. Another reason may be that you have similar structures in different contentfiles and you want to be selective.

NOTE: WXT does not consider styles, most elements are copied "as is".

Examples:

<?_wxt importodf 
         location="doc1.odf" 
         dpath="/Illustrations"?>

will extract the header on level 2, Illustrations, and all material until the next heading at level 2, or level1.