I’m trying to construct XQuery that will return the count of the number attributes found that have a value of x.
This is part of SQL query and these counts will fill one of the columns returned (that part I can figure out, it’s the actual XQuery to get the count I haven’t figured out yet.)
For example, if I have <element elementattribute=1>...</element>, how would I count all the @elementattributes that equal 1 for a given chunk of XML?
you can use an asterisk wildcard for the element name:
count(//*[@elementattribute=’1′])
Hope that helps…