On 12/14/2012 04:05 PM, Philippe Nobili wrote:
Everything seems to be correct; excerpt of the macro trace below:
(starting from the value returned from "pick"):
<--search.parameter:command: execution result='nx'
-->search.parameter:command: checking...
xpathSearch "//*[@Name = 'nx']"
<--search.parameter:command: CANNOT EXECUTE
But the last Xpath search fails, although it seems to be a perfectly
valid search
(i.e. searching for all element whose @Name attribute is equals to 'nx').
The same Xpath expression ("//*[@Name = 'nx']") entered *as-is* in the
Avanced Tab of the element search dialog works fine.
Command xpathSearch evaluates specified XPath expression in the context
of selected node. Therefore if there is no selected node, xpathSearch
cannot be executed. Unless of course, you pass it option [implicitNode]
or option [implicitElement]. Both options should work fine because your
expression starts with '//'.
In summary:
xpathSearch [implicitNode] //*[@Name = 'nx']
should work fine.
---
PS: in a macro, it's more readable (in my opinion) and more efficient to
write:
<set variable="selectedElement"
expression="//*[@Name = 'nx']"/>
(Here, the default context is '/'.)
See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_reference.html
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support