Home Forums General XMetaL Discussion Why is XMetaL unable to locate a text node? Reply To: Why is XMetaL unable to locate a text node?

Derek Read

Reply to: Why is XMetaL unable to locate a text node?

The XPath “tests” for comment(), processing-instruction(), and node() will work but not text(), which is not supported in versions up to and including 6.0:

//XMetaL Script Language JScript:
var doc = ActiveDocument;
var ndsText    = doc.getNodesByXPath("//text()");
var ndsPI      = doc.getNodesByXPath("//processing-instruction()");
var ndsComment  = doc.getNodesByXPath("//comment()");
var ndsNode    = doc.getNodesByXPath("//node()");
var msg = "";
msg += "Text:"      + ndsText.length;
msg += "nPI:"      + ndsPI.length;
msg += "nComment:" + ndsComment.length;
msg += "nNode:"    + ndsNode.length;
Application.Alert(msg);

What specifically are you trying to do?
It sounds like you need to find text node # 123 (I'm not sure where that number comes from) and move the selection to that position in the document.

I think this problem may need to be tackled using an entirely different strategy than the one you are trying, but knowing exactly what you are attempting to do, and perhaps how you are creating the value 123, may help.

Reply

Products
Downloads
Support