Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 92406

evaluateXPathExpression bug

$
0
0

i'm trying to generate bookmark of first level element, to achieve that, i'm using evaluateXPathExpression, works perfectly for some files, for some other files.. it is fetching wrong order.., meant fetching based on the xmlElement(id) i hope, instead of XML position. My script is below.

 

var aDoc=app.activeDocument;
var sectionFirst="//body/*[not(self::titleGroup)]/*[starts-with(local-name(), 'title')]";

//namespace required to execute evaluateXPathExpression
  var rootElement = aDoc.xmlElements[0];  if( !rootElement.xmlAttributes.itemByName("xmlns:xml").isValid )  rootElement.xmlAttributes.add( "xmlns:xml", "http://www.w3.org/XML/1998/namespace" );  if(rootElement.xmlAttributes.item("xmlns").isValid )  rootElement.xmlAttributes.item("xmlns").remove();

var sectionFirstElements=rootElement.evaluateXPathExpression(sectionFirst);
for(var ele=0; ele < sectionFirstElements.length; ele++)
{  alert(sectionFirstElements[ele].id+" "+sectionFirstElements[ele].contents);
}

 

InDesign sample file is attached to verify (Dropbox - sample.indd). Does anyone across this issue. please enlighten me on this.


Viewing all articles
Browse latest Browse all 92406

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>