Jump to content

IE8 doing it's own thing ... arrrgh!


attaboy

Recommended Posts

I have a XML file: <?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="letter2text.xsl"?><letter> <to>Mom</to> <from>Tom</from> <message>Happy Mother's Day</message> </letter> it uses this stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="text"/><xsl:template match="/letter"><xsl:apply-templates select="*"/></xsl:template><xsl:template match="to"><xsl:text>TO: </xsl:text><xsl:apply-templates/> <xsl:text></xsl:text></xsl:template><xsl:template match="from"><xsl:text>FROM: </xsl:text> <xsl:apply-templates/> <xsl:text></xsl:text></xsl:template> <xsl:template match="message"><xsl:text>MESSAGE: </xsl:text> <xsl:apply-templates/> <xsl:text></xsl:text></xsl:template></xsl:stylesheet> The output looks like this in all browsers except IE8TO: MomFROM: TomMESSAGE: Happy Mother's DayIE8 sees it as:TO: Mom FROM: Tom MESSAGE: Happy Mother's DayIE doesn't seem to be the sharpest knife in the drawer.Is there any way to indicate line break that even IE will understand?

Link to comment
Share on other sites

The problem is IE re-parses the XSLT output as HTML. What other browsers do instead is use the XSLT result directly.This behavior of IE is the cause of a few issues, and this is one of them.The only way to make IE understand is that you use <xsl:output method="html" />, and rewrite the rest of your XSLT accordingly, with <br/>'s and everything.

Link to comment
Share on other sites

Thanks for responding. After posting this I read a little further in my book and found what you just mentioned. IE always has to ruin the fun don't they. I wonder if anyone has come up with an IE voodoo doll for web developers/designers. btw is there a way to flag these posts as solved?

Edited by attaboy
Link to comment
Share on other sites

I believe you should be able to edit the title of the topic by editing your first post.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...