xslt cache lookup update.

This should reduce the scanning in most cases, which is only a minor speedup
but there was a race case which is now fixed. This race has led to one crash
report and may of led to a leak in another.