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.