fix a problem with signature validation due to incorrect cloning of referenced element

When cloning elements that are signed using XMLDSig there is a risk of pulling in namespace declarations from parent nodes. This alters the XML document in such a way that the digest changes, and hence the signature breaks.

By applying transform on the original data, we can circumvent this problem.