Copy link to clipboard
Copied
how to select previous node indesign javascript
Copy link to clipboard
Copied
Can you add more details as to what is the node that you are reffering to. Add in some code snippet that you have written and is not working as expected, or give some screenshots of the document if you don't even know where to start with your code. Just a terse statement is not going to help us in helping you
-Manan
Copy link to clipboard
Copied
select previous abstract node
Copy link to clipboard
Copied
var myDoc = app.documents[0];
var xPath = "//kwd-group"
var root = myDoc.xmlElements[0];
var node = null;
var proc = app.xmlRuleProcessors.add([xPath]);
var match = proc.startProcessingRuleSet(root);
while (match != undefined) {
node = match.element;
match = proc.findNextMatch();
if (node != null && node != undefined) {
graphicLink=node.previousNode;
}
}
how to select abstract element.
Copy link to clipboard
Copied
you can access previous siblings or child by using
var myDoc = app.documents[0];
var xPath = "//kwd-group"
var root = myDoc.xmlElements[0];
var node = null;
var proc = app.xmlRuleProcessors.add([xPath]);
var match = proc.startProcessingRuleSet(root);
while (match != undefined) {
node = match.element;
match = proc.findNextMatch();
if (node != null && node != undefined) {
node.parent.xmlElements[node.index-1]/////////////this will give previous Node
}
}
Copy link to clipboard
Copied
if node.index is equal to zero then?
Definetely your code will meet an exception.
Correct?
Best
Sunil
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more