String-value shouldn't work recursively for elements and document nodes, as the result is nonsensical then. Also, string-value should be implemented for CDATA nodes. Patch forthcoming.
Created attachment 13527 [details] proposed fix
Comment on attachment 13527 [details] proposed fix r=me
Committed revision 20055.