I would like to select a path to element that contains @ inside
Use:
//*[contains(., '@')]
It seems to me that what you actually wanted is to select elements that have a text-node child that contains "@". If this is so, use:
//*[contains(text(), '@')]
XSLT - based verification:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select=
"//*[contains(text(), '@')] "/>
</xsl:template>
</xsl:stylesheet>
when this transformation is applied on the following XML document:
<html>
<body>
<a href="xxx.com">xxx.com</a>
<span>someone@xxx.com</span>
</body>
</html>
the XPath expression is evaluated and the selected nodes are copied to the output:
<span>someone@xxx.com</span>