Hello, I'm trying to write a macro command to remove all elements matching a given XPath expression using XXE 5.9.0.
This is the command definition in my customization file (0docbook5.xxe): <command name="db5.removeUnusedParts"> <macro repetable="true" undoable="true" label="Remove Unused Parts"> <sequence> <command name="xpathSearch" parameter="//*[@revisionflag='off']" /> <command name="delete" /> </sequence> </macro> </command> I assign it to a button on the UI <button toolTip="Remove Unused Parts" icon="../config/common/icons/up.png"> <command name="db5.removeUnusedParts" /> </button> The button shows up and it is enabled when I select an element in the document. Clicking the button removes only the first matching node from the XPath node-set result. So, a few questions: 1) How can I have the button always enabled as opposed to enabled only when selecting an element? The idea is to actually make this not a button, but a menu entry of the "DocBook" (XML) menu. 2) If xpathSearch returns a node-set, why isn't the delete command applied to all nodes in the node-set and it's only applied to the first matching node? How can I 'loop' through all nodes returned in the node-set applying the delete command on them? Will I have to forget about this macro command and write a custom Java command instead (Not that I do not know how to do it, I'm just trying to solve this with what XXE already has)? All of the examples I've found on the documentation apply commands to a single node, not to a node-set. I've searched the docs too and found no "loop-like" construct to write commands (I'm pretty sure there's good reasons for that... but I need one :-)) Thanks in advance for your answers. -- Fabián Mandelbaum IS Engineer
-- XMLmind XML Editor Support List xmleditor-support@xmlmind.com http://www.xmlmind.com/mailman/listinfo/xmleditor-support