How to stop XSLT condensing explicit end tags
Posted August 17, 2009 in Writing-Development; Feed
The .NET Framework can be unintuitive but when tethered to Sitecore it becomes a strange and unpredictable beast (as I am sure you know if you work with it). One issue I have had is stopping the XSL renderings from creating invalid short tags when the output form is set to XML.
My previous solution to this was to use <![CDATA[]]> at these points to imply that the field has a value, even though it is an empty value. However after upgrading the .NET framework this no longer works. Instead we have to insert content to ensure the XML Writer does not use short tags.
The snippet <xsl:comment>*</xsl:comment>
works reasonably well and can be used to insert <!--*--> at these sections. Although it is not ideal, it is very useful for clearing div tags that should not have any renderable content.


Comments
Please e-mail all comments to mjac@mjac.co.uk and I will try to reply as promptly as possible. Any particularly interesting comments may be followed up in further articles or mentioned in this one.