Get (text) in XPath

It seems you want the first text node in that div:

div[@class="coordsAgence"]/text()[1]

should do it.

Note that this assumes that there is actually no whitespace between those comments inside <div class="coordsAgence">; otherwise that whitespace will constitute additional text nodes that you'll have to account for.


Get the first text node following the first h2 in the div with class "coordsAgence":

div[@class='coordsAgence']/h2[1]/following-sibling::text()[1]

Note that this first expression returns the first text node after the first h2 even when some other node appears between the two. If you want to return the text only when it's the node that immediately follows the first h2, then try something like this:

div[@class='coordsAgence']/h2[1][following-sibling::node()[1][self::text()]]/following-sibling::text()[1]