javascript - get region from xml file using xpath -


i have 1 xml file content of region, state, city name

<childrens>     <child_1 entity_id="1" value="region">         <child_2 entity_id="2" value="asia">             <child_3 entity_id="3" value="gujarat">                 <child_4 entity_id="4" value="ahemdabad" />             </child_3>         </child_2>     </child_1> </childrens> 

i try region name if entered city name match in xml file.

here 1 variable there value in ahemdabad (city name)

here xpath:-

value = 'ahemdabad';             var xpath = '//*[@value= "' + value+'"]' +                              '/../../@entity_id'; 

when try city name direct xpath string work.

            var xpath = '//*[@value= "ahemdabad"]' +                              '/../../@entity_id'; 

its not return me .
please me solve xpath problem.
thanks.

guess problem declaration syntax. when using xpath in xquery declare variable let $var1 = "ahemdabad"

and in case xslt used declaration made like

value

and declared variable addressed in necessary location. can please explain how using it?


Comments