xpath: recherche un nœud ayant un attribut donné dont la valeur contient une chaîne

StackOverflow https://stackoverflow.com/questions/614797

  •  03-07-2019
  •  | 
  •  

Question

Existe-t-il un moyen xpath de rechercher un nœud ayant un attribut donné dont la valeur contient une chaîne donnée?

Par exemple, j'ai un document XML et je veux trouver un noeud où l'attribut adresse contient la chaîne Downing , afin de pouvoir trouver le noeud suivant:

<person name="blair" address="10 Downing St. London"/>
Était-ce utile?

La solution

select="//*[contains(@address,'Downing')]"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top