It's not a good idea to post three unrelated questions on the same forum thread. It just gets everyone confused.
You do say you're a novice, but you don't say what you have read and what you have tried, so it's very hard to see where you are stuck and what it is that you haven't yet understood. To be honest, your posts give the impression that you haven't yet done much reading or study of the language. I would recommend that your first step in learning any new language should be to spend four hours with a good book; after that, you can start asking questions about the things you haven't understood.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference