Inloggen
 
 
 
 
    
IE stops rendering after an iframe (created by an XSL-transform)
Location: BlogsFerry Onderwater - Developer    
Posted by: Ferry Onderwater 7-11-2007 11:30
IE stops rendering after an iframe (created by an XSL-transform)
I wanted to render an iframe from an XSL-stylesheet. To do so I used the following code:

Code:
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="record">
    Test
    <iframe>
      <xsl:attribute name="width">100%</xsl:attribute>
      <xsl:attribute name="height">50%</xsl:attribute>
      <xsl:attribute name="src">try.htm</xsl:attribute>
    </iframe>
    Test2
  </xsl:template>

</xsl:stylesheet>


After the transform everything I expected after the Iframe wasn't shown in my browser, the Iframe itself showed up fine.
Looking at the source (View Source in IE) the code looked perfectly ok to me. But when browsing the DOM with the IE Developer Toolbar I discovered there was nothing after the Iframe.

I tried to simulate this behaviour in a plain HTML-file:

Code:
<html>
    <body>
        Test begin
        <iframe />
        Test eind
    </body>
</html>


The same problem: then 'Test eind' part isn't rendered. Googling the problem didn't lead me to a solution but fortunately a collegue was able to give me some working code.
First we overlooked the solution but then we discovered it: when using an iframe YOU MUST USE AN ENDTAG!!! So the code above slightly altered:

Code:
<html>
    <body>
        Test begin
        <iframe></iframe>
        Test eind
    </body>
</html>


works as a charm!

In the original XSL file I must therefor enter some text:

Code:
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="record">
    Test
    <iframe>
      <xsl:attribute name="width">100%</xsl:attribute>
      <xsl:attribute name="height">50%</xsl:attribute>
      <xsl:attribute name="src">try.htm</xsl:attribute>
      Your browser doesn't support frames.
    </iframe>

    Test2
  </xsl:template>

</xsl:stylesheet>


In this case I entered the text "Your browser doesn't support frames". Since this is no attribute but 'innertext' the endtag will be rendered.

The text I used is typically used with I-frames so browsers with no frame-support know what to show. Maybe this is the reason an iframe MUST have an endtag.
Copyright ©2007 Ferry Onderwater
Permalink |  Trackback

Comments (12)  
Re: IE stops rendering after an iframe (created by an XSL-transform)    By Ruben Anonymous on 4-3-2008 23:48
YOU FREEKING ROCK!!! Thanks a lot for this post man, I spent around 8hrs researching this and finally after reading your post I've solved the issue.

Re: IE stops rendering after an iframe (created by an XSL-transform)    By Shirlz on 18-3-2008 1:59
Thanks heaps for this! Just what I was looking for. It seems to be the same problem across all browsers... not just IE.

Re: IE stops rendering after an iframe (created by an XSL-transform)    By adam on 8-8-2008 18:30
awesome thanks

Re: IE stops rendering after an iframe (created by an XSL-transform)    By Stan on 25-8-2008 14:43
You also need to add text in between the iframe tags... it would not render for me unless i pout some text in there

Re: IE stops rendering after an iframe (created by an XSL-transform)    By saroj on 15-1-2009 13:02
Please give the solution.

Betr: IE stops rendering after an iframe (created by an XSL-transform)    By Ferry on 15-1-2009 13:23
Saroj,

The solution is mentioned in the code above but only when the remark of Stan is used.
Hence, you must use a) the starttage, b) some text and c) the endtag.
For example: <iframe>Your browser does not support frames</iframe>

Re: IE stops rendering after an iframe (created by an XSL-transform)    By mike on 3-3-2009 22:17
Thanks!!!

Re: IE stops rendering after an iframe (created by an XSL-transform)    By hacks on 16-4-2009 17:32
Yay!

Re: IE stops rendering after an iframe (created by an XSL-transform)    By maxxwizard on 6-7-2009 19:12
somehow... this works.

Re: IE stops rendering after an iframe (created by an XSL-transform)    By Aldelo on 29-12-2009 10:10
Thank you very much I search for this thing for very long time

Re: IE stops rendering after an iframe (created by an XSL-transform)    By Detlev Beutner on 16-6-2010 10:55
Great, thanks - and it's really not only IE which behaves so strange.

Re: IE stops rendering after an iframe (created by an XSL-transform)    By BrattoGallyx on 15-7-2010 16:03
Not only IE does that. Had HUGE problems with Chrome, and also some strange things with FF.

My solution is that I suspect ALL browsers. If something does not work, I always add a   (or in XSLT a  )

DOES MIRACLES!!

Cheers.

  
 
Weblogs
    
Archief
    
Zoeken
    
 
 
 
 
Copyright 2006-2009 by Arcencus
Privacy Statement | Terms Of Use