XSLT bug, xslt removes html tags by it self
June 30, 2010 2 Comments
And this is a fact,.. I often use HTML when i make my renderings for Sitecore. If yore not care-full,.. you can end up with a site which is not W3C compliant or even worse if it messes up your design,..
So her’s the problem,. if you type something like this in your XSLT
<div class=”separator”></div>
XSLT will only render the start tag, like so
<div class=”separator” >
Bummer,..
the only solution for this is to place some kind of content inside your empty tag
like a white space,.. But be careful to put inside your XSLT it will result in error. Use   ; in stead (c:
happy coding
EDIT:
Another solution for this was proposed by Richard Willis, thanx body
change your <xsl:output method=”xml“> to <xsl:output method=”html“>
that will instruct the render to format your output like HTML, like we want to..
That is not true and.
However the exact output does depend on what method you put in your xsl:output element
If it’s xml, it will only put a single tag, but it will be closed i.e.
<div class=”separator” />
If the formatting is messed up that as above but with the closing / in.
If the method is html it will output the opening and closing tags.
Hi Ricahard
Welcome to my blog (c:
yup,..thats right my output was set to xsl:output method=”xml” i didn’t think about that at the time,.. i was anoint by the fact that it deleted my tags,.. grr
thanx for the tip, it’s a good one ,.. (c: