/classes/class/lesson/@id returns the attribute nodes. You can then extract the values of the attribute nodes in your calling application, using getNodeValue() or whatever the DOM method is called.
XPath 1.0 doesn't have a data type for a set of strings, so you can't write an XPath 1.0 expression that returns a set of strings. In XPath 2.0 you can write
/classes/class/lesson/@id/string()
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference