XSLT bug, xslt removes html tags by it self

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 &nbsp; inside your XSLT it will result in error. Use &#160 ; 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..

Advertisements

2 Responses to XSLT bug, xslt removes html tags by it self

  1. 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.

    • maanehunden says:

      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:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: