There is no interaction between XSLT and Javascript in the result HTML of your XSLT. If you want to construct an HTML element with an onclick handler then you simply need to construct what you would normally write, so assuming you would want a HTML element
Code:
<a href="#" onclick="view('customValue')">View Link</a>
to construct that code with XSLT you can use
Code:
<a href="#" onclick="view('{$customKey}')">View Link</a>