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

posted in: Uncategorized | 0

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

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

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: