On 2014-09-17 03:29, Hussein Shafie wrote:
--> If you need more than this basic function, please write (or
record... a macro-command and then bind it to a keystroke...
This macro-command
(http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro.html)
could consist in:
...
store value of attribute XXX in a variable YYY (<set> child element in
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html#set)
+
insertNode sameElementAfter
+
get value of variable YYY (<get> child element in
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html#get)
+
putAttribute XXX=YYY on newly inserted element
(http://www.xmlmind.com/xmleditor/_distrib/doc/commands/putAttribute.html)
Thanks--this worked. My code is
--------
<cfg:pass>
<cfg:match context="$implicitElement" pattern="ilr:langData"/>
</cfg:pass>
<get context="$implicitElement/@script" expression="string(.)"/>
<set variable="sScript" expression="%_" plainString="true" />
...other stuff...
<command name="insertNode" parameter="sameElementAfter"/>
<command name="selectNode"
parameter="descendant[implicitElement]
{http://umd.edu/Interlin}langData"/>
<get expression="$sScript"/>
<command name="putAttribute" parameter="[implicitElement] script
%_"/>
--------
I was a little surprised in that last step that I couldn't somehow use
$sScript directly, but had to instead do the <get...> <... %_> thing.
And that we need to encode the namespace in the selectNode command by
URI ({http://umd.edu/Interlin}), rather than using a prefix (ilr:) But
it works.
(The <ilr:langData> element is something we borrowed from Andy Black,
who's probably lurking on this mailing list.)
Mike Maxwell
University of Maryland
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support