xml - Get text from an element using its attribute in a XPath expression? -


here's xml code:

    <perfil>         <person idp="p1">             <studied refides="es3"/>     .     .     .      <schools>         <school ides="es3">             <name>name of school</name>         </school> 

in beginning of document have reference made school, , in end have name of school proper id. in xpath expression, have mention what's in beginning (e.g. perfil/person/studied[@refides]), , want show name of school. thing that, when use expression on example, shows id of school. if end /text(), shows no results.

this xpath expression select string value of name of school @ides attribute value of es3:

string(//school[@ides='es3']/name) 

in case of provided xml (assuming it's complete, well-formed, , no other school elements same es3 attribute value), select:

name of school 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -