MODE-1853 - Reverted code introduced by MODE-1729 (commit 2e42871) which shows a similar problem to the class cast exception

This should not be merged.

However, with the change from this PR, running ```FederationIntegrationTest``` in AS7 (with an updated schematic jar in the dist) should show a similar problem to the one described in the JIRA issue.

The pull request basically contains a revert of one of my previous commits for MODE-1729. When I first encountered this exception, I thought this commit would fix it. However, it may be very well be that it only fixed a symptom, not the real problem. 

The code behind ```DocumentTransformer``` and related classes is not trivial, to say the least.