bovlb 0 Newbie Poster

I'm trying to use XPath/XQuery to identify HTML elements. In particular, I want to be able to match elements where the "class" attribute contains a specific token. As I understand it, "class" is now defined as NMTOKENS, which means it should be treated as list-valued. So does that mean that I can use:

div[@class="print"]

to match:

<div class="foo print bar">

or should I use:

div[contains(@class, "print")]

and be confident that it should not match:

<div class="foo noprint bar">

Thanks for your help.

Cross-posted at the Wikipedia Reference Desk: http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Computing#XPath:_Equality_match_on_list-valued_attribute