Variables in XSLT represent values, not parts of expressions. It's not a macro language that works by textual substitution. If the value of $p is the string "english", then ./$p/code means ./"english"/code. You can't have a string literal in the middle of a path expression, and therefore you can't have a string-valued variable there either. In fact, it's worth remembering that there is no way in XSLT of constructing XPath expressions dynamically at run-time.
But if $p is a string, it should give you an error, not "no output".
Also, a leading "./" is always redundant.
Probably the expression you are looking for is
*[name() = $p]/code
Michael Kay
http://www.saxonica.com/