XML file:
 
<?xml version='1.0'?>
<bookstore>
      <book genre="autobiography">
            <title>
                The Autobiography of Benjamin Franklin
            </title>
            <author>
                  <first-name>Benjamin</first-name>
                  <last-name>Franklin</last-name>
            </author>
            <price>8.99</price>
      </book>
      <book genre="autobiography">
            <title>The Confidence Man</title>
            <author>
                  <first-name>Herman</first-name>
                  <last-name>Melville</last-name>
            </author>
            <price>11.99</price>
      </book>
      <book genre="autobiography">
            <title>The Confidence Man</title>
            <author>
                  <first-name>Herman</first-name>
                  <last-name>Melville</last-name>
            </author>
            <price>11.99</price>
      </book>
</bookstore>
   

XPath Expression:
(add "fn:" before function. for example: "fn:count(item)" )
/bookstore/book[title=following-sibling::book/title]


Result: