There's nothing in standard XSLT that will give you the line number of a node in the source tree (it's not part of the data model). There's an extension in Saxon (saxon:line-number()) that works provided that you say you want line numbers maintained when you build the source tree. I don't know of similar extensions in other products.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference