XPath – how to find all elements where an attribute starts-with a text value

BronwenWeeGo.jpgToday i had to filter an xml document based on the start value of an attribute and it took me ages to work it out as before i’d always done exact matches.  Plus couldn’t find any egs where they used anything bar =.  So if i have a xml schema like


<books>
	<book name="Bronwens adventure"></book>
	<book name="Bronwen vacations"></book>
</books>

and i have a XMLDocument with this in it.  If i want to find all the book’s whose name starts with “Bronwen” I can do a xpath query as follows:


doc.SelectNodes("//book[starts-with(@name,'Bronwen');