Marc H. wrote:
We use our own XML dialect which is very similar to DITA.
How can we use the Paste-from-Word feature in our documents?
--> This is not difficult if you can write an XSLT 1.0 stylesheet. This
XSLT 1.0 stylesheet must transform simple, clean, valid, XHTML 1.0
Transitional to your XML dialect.
(At this stage of the "Paste from Word" process, a mind-boggling
machinery has already been used to clean-up the scary unfiltered HTML
pasted by MS-Word to the clipboard.)
--> If you look at attached copy of
<paste_from_word_install_dir>/dita/topic.incl, you'll see:
1) This configuration adds a menu item called "Paste from Word" to the
"Topic" menu. This menu item invokes the following command:
---
<command name="pasteFromWord">
<class>com.xmlmind.xmleditext.paste_from_word.PasteFromWord</class>
</command>
---
(The above snipped is found in included
<paste_from_word_install_dir>/common/common.incl)
2) The above command is parametrized as follows:
---
[after p]
[xmlns:dh=java:com.xmlmind.xmleditext.dita.DITAHelp]
-p tables.set-column-number yes
-p sections.max-level {if($pasting-root, '-1', '1')}
-t paste-from-word:xslt/mswordhtml/topic.xslt
-p transform.topic-type {if($pasting-root, local-name(/*), 'topic')}
-p transform.single-topic {if($pasting-root, 'no', 'yes')}
-p transform.root-topic-id '{dh:getTopicAncestor(.)/@id}'
---
* [after p] means: never paste blocks (e.g. a list or a table) inside
the ``text'' of a paragraph or list item. Always paste blocks after the
``text'' of a paragraph or list item.
This needed to prevent pasting a list or a table inside a paragraph
(which is allowed by DITA:
http://docs.oasis-open.org/dita/v1.2/os/spec/langref/p.html).
* Your XSLT 1.0 stylesheet must be specified as follows:
-t URL_of_my_XSLT_stylesheet
-(The XSLT 1.0 stylesheet used for DITA Topics is found in
<paste_from_word_install_dir>/xslt/mswordhtml/topic.xslt)
* Your XSLT 1.0 stylesheet can be passed parameters by the means of the
-p option.
* The value of such parameters may depend on the content of the XML
document where some data is to be pasted (AKA the "target document").
-p {XPath_1_expr} evaluates XPath 1.0 expression XPath_1_expr in the
context of this target document.
* We of course support all the XPath 1.0 functions documented here:
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpathfunc.html
including directly invoking Java static methods. This was needed for
DITA. com.xmlmind.xmleditext.dita.DITAHelp is a Java class containing
such XPath 1.0 helpers.
That's all I can do for you until "Paste from Word" is officially
documented.
<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration">
<include location="../common/common.incl" />
<!-- Menu ============================================================== -->
<!-- -p tables.set-column-number yes needed to generate CALS tables. -->
<menu label="-" insert="ifNotDefined(os.name*=Linux) _p">
<item label="Paste from _Word" icon="../common/paste_from_word.png"
command="pasteFromWord"
parameter="[after p]
[xmlns:dh=java:com.xmlmind.xmleditext.dita.DITAHelp]
-p tables.set-column-number yes
-p sections.max-level
{if($pasting-root, '-1', '1')}
-t paste-from-word:xslt/mswordhtml/topic.xslt
-p transform.topic-type
{if($pasting-root, local-name(/*), 'topic')}
-p transform.single-topic
{if($pasting-root, 'no', 'yes')}
-p transform.root-topic-id
'{dh:getTopicAncestor(.)/@id}'" />
<separator />
</menu>
</configuration>
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support