Can I set a variable to the result of an xpath?

Take a look at these Macros and see if they can help you write your macro: