I am using the code below to strip white spaces from my genereated XML, but it is giving me the following error:

White space cannot be stripped from input documents that have already been loaded

I am using this code in an XSLT Mediator in SDL Tridion 2013.

<?XsltMediator extensionsTbbId="tcm:1-2-2048"  
<xsl:strip-space elements="*" />
<!-- below comes my XSLT code -->

Please help me, is something wrong with XSLT Transform in 2013 or I am doing some thing wrong?

2 Answers 2


It is clearly given here that http://msdn.microsoft.com/en-us/library/ms163430(v=vs.110).aspx.

This method does not support the xsl:strip-space element. If your compiled style sheet included the xsl:strip-space element, you must use the Transform overload which takes an XmlReader as the input argument.


White-space handling is tricky at the best of times in XSLT. In this case, it's not clear what you are actually trying to achieve, but maybe strip-space isn't what you need anyway.

I'd suggest that you check out this question on Stack Overflow. The answers by Dimitre Novachev and Michael Kay are both instructive (as are pretty much all the answers given by these two.)

Seeing as white-space in XSLT is known to be difficult, I'd suggest looking first in your XSLT for the problem, and only then in the mediator. It should be straight-forward enough to execute your transform in a suitable XSLT editor like Altova Xml Spy, and thereby exclude Tridion and the mediator from the problem domain.

Put briefly, in XSLT, an important distinction is whether the white space is in the source XML document, or in the XSLT itself.

More generally, I can't do better than to quote Dimitre in one of his comments:

"As for good XSLT learning sources, Michael Kay's books are the best. They seem big, but just read them thoroughly and you'll get very good grasp of the subject"

  • Thanks for reference... But my question was why above code is not working in XSLT 2013 Mediator giving error although it's working fine in Tridion 2011. Commented Dec 11, 2014 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.