xpath: recherche un nœud ayant un attribut donné dont la valeur contient une chaîne
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"/>
La solution
select="//*[contains(@address,'Downing')]"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow