Filtering elements within XML

Just been looking at senocular’s XML tutorial.
It tells me I can filter through my xml using something like this, to
output the nodes with the attribute value of 1.

trace(grades.student.quiz.(@num == “1”));

However this is not quite what I’m after. Not all my xml nodes have the same attributes and so I need a way to
search or filter through my xml and get the nodes which have the @num attribute or which ever attribute I am looking for.

Im sure this is pretty basic stuff, but dont know the syntax I need to use.

Thanks in advance,

Julian