xpath - count elements

alemaorance

New Member
I started to learn xpath at w3cschool. I am trying to evaluate:The number of players in the game?(so counting the screenname and the text() elements/attributes!)Here is my example xml:\[code\]<game> <info> <name>My Game</name> <description>A <i>very</i> interesting game.</description> <started>2012-03-01T18:00:00Z</started> <players number="2"> <screenname player="1">Alice</screenname> <screenname player="2">Bob</screenname> </players> <rounds>2</rounds> <winner player="2"/> </info></game>\[/code\]the xpath query I think is ok is:\[code\]//game/info/players[count(.//screenname/text())]\[/code\]but I only get "Result is a NodeSet containing 1 element" back(tool: http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm)Why?
 
Back
Top