Variables declared within one template aren't accessible in another template - they are like local variables declared within a function or method in C or Java. If you want to pass values from one template to another, you need to pass them as parameters. You pass the parameter using <xsl:with-param> in the calling template, with a matching xsl:param in the called template to declare the parameter and receive the value.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference