XPath and Predicates limits : please help me !


hi

 

please take these examples script execute windows  indesign cs4 :

 

short multiple xpath predicates

 

var dataxml = new xml("<cahier><titre><unitorg><fonction><lf>e</lf></fonction><fonction><lf>vg</lf></fonction></unitorg></titre></cahier>"); var test_xpath = "/*[1]/*[1]/*[1]/fonction[lf='e' or lf='a' or lf='ad' or lf='va' or lf='ea']";  result = dataxml.xpath(test_xpath); alert("result : "+result); 

 

result ok

 

<fonction><lf>e</lf></fonction> 

 

long multiple xpath predicates

i changed xpath (ad "or" conditions)

 

var dataxml = new xml("<cahier><titre><unitorg><fonction><lf>e</lf></fonction><fonction><lf>vg</lf></fonction></unitorg></titre></cahier>"); var test_xpath = "/*[1]/*[1]/*[1]/fonction[lf='e' or lf='a' or lf='ad' or lf='va' or lf='ea' or lf='gh' or lf='kj' or lf='rt' or lf='lk' or lf='ft' or lf='iu']";  result = dataxml.xpath(test_xpath); alert("result : "+result); 

 

error : [ ] not closed !  ???

long simple xpath predicates

i replaced *[1] node nomnative node in xpath

 

var dataxml = new xml("<cahier><titre><unitorg><fonction><lf>e</lf></fonction><fonction><lf>vg</lf></fonction></unitorg></titre></cahier>"); var test_xpath = "/cahier/titre/unitorg/fonction[lf='e' or lf='a' or lf='ad' or lf='va' or lf='ea' or lf='gh' or lf='kj' or lf='rt' or lf='lk' or lf='ft' or lf='iu']";  result = dataxml.xpath(test_xpath); alert("result : "+result); 

 

result ok

 

<fonction><lf>e</lf></fonction> 

 

conclusion , question ?

why ? don't understand... if can give me explanation !



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Object Fitting Keyboard Shortcuts Disfuntional

Markers not showing up after opening a saved project. Where did they go!?

After Effects error: (-1610153453)