Using the XML below, the XPath without contains matches 1 element, but one with contains matches 0 elements.
//pet[@type = "dog"][.//@name = "Acme Dog Food"]
//pet[@type = "dog"][contains(.//@name, "Acme Dog Food")]
I would expect both to match the pet[@name = "Fido"] element. Why is there a difference?
<documentRoot>
<!-- Test data -->
<?value="2"?>
<parent name="data" >
<child id="1" name="alpha" >Some Text</child>
<child id="2" name="beta" >
<grandchild id="2.1" name="beta-alpha" ></grandchild>
<grandchild id="2.2" name="beta-beta" ></grandchild>
</child>
<pet name="tigger" type="cat" >
<data>
<birthday month="sept" day="19" ></birthday>
<food name="Acme Cat Food" ></food>
</data>
</pet>
<pet name="Fido" type="dog" >
<description>
Large dog!
</description>
<data>
<birthday month="feb" day="3" ></birthday>
<food name="Acme Dog Food" ></food>
</data>
</pet>
<rogue name="is this real?" >
<data>
Hates dogs!
</data>
</rogue>
<child id="3" name="gamma" mark="yes" >
<!-- A comment -->
<description>
Likes all animals - especially dogs!
</description>
<grandchild id="3.1" name="gamma-alpha" >
</grandchild>
<grandchild id="3.2" name="gamma-beta" ></grandchild>
</child>
</parent>
</documentRoot>
Online XPath Tester: http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm