Hi,
Can anyone suggest me how i can delete empty tags in my InDesign cs4 files. Like this
(1) <para></para>
(2) <emphasis></emphasis>
Both tags have no any matter between these tags. Any script you have please help me.
Thank you so much adv.
Regard
snegig
Hi snegig, Try the below script and check.
var xpath ="//*";
var root = app.activeDocument.xmlElements[0];
var node = null;
try {
var proc = app.xmlRuleProcessors.add([xpath]);
var match = proc.startProcessingRuleSet(root);
while(match!=undefined) {
node = match.element;
match = proc.findNextMatch();
content=node.contents;
if(node)
app.select(node);
var myText = app.selection[0];
var content=myText.contents;
if(content.search(/^[\s\r\n]+$/)!=-1){
myText.untag();
}
}//End of While
} //End of Try
catch(ex){
alert(ex);
}
finally {
proc.endProcessingRuleSet();
proc.remove();
}
Thanks,
Green4ever
North America
Europe, Middle East and Africa
Asia Pacific