Solved

XSL Not Applying to XML File in IE

Posted on 2008-10-21
6
1,824 Views
Last Modified: 2013-11-18
I have an XML file with the following header:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="incidenttemplate.xsl"?>

Within my incidenttemplate.xsl file, I have the following:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">

<html xmlns="http://www.w3.org/1999/xhtml"> etc...

When opening the XML file in Firefox/Opera, my XSL layout is applied to the file, but in IE 8 (no matter what compatibility mode it is in), it either just loads the file like a normal text document (as if the entire document is wrapped in <pre>), or shows me all the values of each of the XML tags without any line breaks.

Talk about odd? What am I missing? I need this to work in IE!

0
Comment
Question by:firstbankak
  • 3
  • 3
6 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 22774172
There are quiet a number of things that are handled differently between IE, FireFox and Opera.
I have created a test sample based on the parts you put in your post and it works in all three browsers. The issue is likely in the remainder of one of the two files... things to look at
- does your XML has a DOCTYPE?
- do you consistently put the xhtml namespace in the XSLT?

Also note that your file associations for the .xml extension might have been messed up by installing an XML IDE or something.
IE is very sensitive to that. The solution is passing a mimetype, but I am afraid that this is all localy

Maybe you should post both files completely, so I can see where it goes wrong
cheers
0
 

Author Comment

by:firstbankak
ID: 22791012
Actually, is there a way you could post your entire XML/XSLT that you created for testing? I cannot post mine as they are Cisco MARS reports about sensitive internal warnings. Maybe I can compare the differences?
0
 

Author Comment

by:firstbankak
ID: 22851872
Update:

I found that for some reason IE 8 Beta 2 does not apply XSLT's the same way that IE 7 does. In fact, I couldn't get it to work at all. (No matter what mode it was in)

Opening the same XML/XSLT combo in IE7 showed my formatting correctly.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22851889
well, I only tested with IE7, maybe that is the reason
(sorry for not answering earlier to your latest question, I simply missed it)
I will have a look at what happens in IE8
0
 

Author Comment

by:firstbankak
ID: 22853484
What is interesting is that i've troubleshooted more and found it's most likely something on this particular computer. I uninstalled IE8 and have now tried the same xml file in IE7, which works on other computers, but on mine still just outputs the XML as if surrounded by a <pre>....

No idea what is causing it, but oh well.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22853539
Did you install an XML IDE on this computer?
If you assosciate the .xml extension with an editor on windows,
you get all sorts of weird behaviour
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now