On 03/14/2016 07:25 PM, Jeff Hooker wrote:
I’ve got a load of users who author hardware register data in a
proprietary schema for which I have created an addon in XMLmind. They
also author the bulk of their documentation in DITA using XMLmind. They
have requested the ability to copy a table of register data from our
proprietary schema and paste it into DITA.
Doing the right-click, transform, copy to clipboard is easy at this
point,
This implies that you have written a process command + a macro command
which convert register data from your proprietary schema to say a DITA
table.
but convincing the DITA addon that the content should be
paste-able has eluded me. Is there a way I can re-define the origin of
the clipboard contents so that I can paste between schemas?
What's important is *how* you copy the generated table to the clipboard.
I suggest that after reading the generated table as a string
(http://www.xmlmind.com/xmleditor/_distrib/doc/commands/read.html), you use
<set variable="clipboard" plainString="true" expression="%_" />
See Macro commands, Reference,
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html
See Macro commands, Reference, Predefined variables,
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpath_vars.html
What follows is a simplification of what I think you do:
---
<command name="copyTable">
<macro trace="true">
<sequence>
<set variable="clipboard" plainString="true"
expression="<?xml version='1.0'?>
<simpletable>
<strow>
<stentry>AAA</stentry>
<stentry>BBB</stentry>
</strow>
<strow>
<stentry>CCC</stentry>
<stentry>DDD</stentry>
</strow>
</simpletable>" />
</sequence>
</macro>
</command>
<binding>
<keyPressed code="F5" />
<command name="copyTable" />
</binding>
---
In the above simplification, I used a literal simpletable.
Notes:
0) <macro trace="true"> and XXE started using xxe-c.bat to see the
messages printed on the console.
1) The string which is to be copied to the clipboard must start with
<?xml version="1.0"?>, otherwise it is considered to be plain text, not XML.
2) The string which is to be copied to the clipboard must contain
well-formed (e.g. no mistakes in namespaces), valid DITA.
3) After a <set variable="clipboard">, you'll immediately see the
Clipboard tool at the bottom/left of the main window updated.
However, as usual, for any of the Paste buttons to be enabled, the user
must be in a suitable editing context. For example, if the clipboard
contains a simpletable and the caret is inside the topic title, the
Paste buttons will all be disabled.
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support