Unable to cast object of type 'MS.Internal.Xml.Cache.XPathDocumentNavigator' to type 'System.Xml.IHasXmlNode'
The reason for this is that in one of the XSLT maps there was some custom c# code that made a cast. The cast involved the XPathDocumentNavigator class from the System.Xml.XPath namespace. The XSLT engine loaded the version in MS.Internal.Xml.Cache first.
To fix this issue I just made sure the references to XPathDocumentNavigator were fully qualified.
The lesson learned was that it always pays to fully qualify your references to classes in embedded .net code in XSLT.