Monthly Archives: September 2009

IE Conditional Tag with XSLT

Another hack in the life of UI developer, dont know for how long we have to take this burden.

Well, you are here because you are using XSLT and have noticed that IE conditional tag or comment is not showing up in output of XSLT transformation. What could be the reason?

Reason is that XSLT transformation does not output comments given in XSL sheets to HTML stream. So how to use IE conditional tags when you really need them.

The answer is tag + CDATA (Unparsed Character Data) tag. Following is the example showing correct way of doing it:

before (not working):

after (working perfectly):
something speical for Internet Explorer

In the example above we are using tag to output to HTML stream and using CDATA type to outupt rest of the code inside the comment tags. So one little hack and desired output presented.

JavaScript Error: Expected Identifier in IE

If you are getting ‘Expected Identifier’ JavaScript error on IE this means you have some conflict with Mr. Gates :)

Okay to the point, this can happen due to two reasons (as per my knowledge, let me know if you know something else):

1. Some typing mistake in your code

var myVar = {
function1: function() { // some code },
variable1: ‘Some value’,
variable2: ‘Another value’,

Notice the extra comma after the last variable defined just before } braces, Firefox will ignore this but IE will not. Lets move to second reason.

2. You have used reserved keyword in your code mostly as variable name Just yesterday, I got this error on IE due to some old written JS code. First I tried to find the code mistake but after looking at the code with a sharp eye I found that some reserved words were used. Following is the code I corrected

obj.class = ‘up’; ///this works in Firefox
obj.className = ‘up’; ///this is the correct implementation

var onloadstat = 0; //works in FF but in IE its a reserved keyword same as ‘class’

At the end, if you get the ‘Expected Identifier’ JS error in IE first look for these mistakes. You will be able to fix the error quickly.

About my blog

This blog will have contents for my own reference so that I don’t have to do Google search again ;)

I will also be happy if someone is taking benefits from my knowledge. If you like the blog, don’t forget to leave a comment :)

 Scroll to top