Click here to Skip to main content
15,916,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Tramsformation of xslt to html is working in all browser except in IE 10 of windows 8.Please suggest.Below is my xsl code


XML
<?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' version='1.0' encoding='UTF-8' indent='yes'/>
  <xsl:template match="/">
    <html>
      <head>
          <style type="text/css">
          .pagebreak {page-break-after: always;}
        </style>
      </head>

      <body background = "logo.JPG">


        <h2 align="center">
          <img src = "transparent.JPG" align = "center"></img>
        </h2>
        <h2 align="center">
          <font size ="6">CONFIGURATION SETTINGS</font>
        </h2>

        <!--User Information-->
        <h2 align="center">
          <font size ="5">USER INFORMATION</font>
        </h2>

        <!--Created By-->
        <h2 align="center">
          <font size ="4.5">CREATED BY</font>
        </h2>
        <table border="1" align = "Center">
          <tr bgcolor="#9acd32">
                   <th align="center"> UserID </th>
            <th align="center">  Account Type  </th>

          </tr>
          <xsl:for-each select="ConfigurationParameters/createdBy/Details">
            <tr align="center">

              <td>
                <xsl:value-of select="Value"/>
              </td>

              <td>
                <xsl:value-of select="Unit"/>
              </td>

            </tr>
          </xsl:for-each>
        </table>
        </body>
      </html>
  </xsl:template>
</xsl:stylesheet>
Posted
Updated 6-Oct-13 23:15pm
v3
Comments
ArunRajendra 30-Sep-13 0:24am    
you need to psot your xml and xslt. How do expect us know what / why its not working.
ArunRajendra 7-Oct-13 0:58am    
also post your xml.

I think you are confusing terms here.
XSLT is written in XML. XSLT instructs the transformation engine to convert some XML File(s) into some other format (like HTML, XML, text).

Check your data if they are all there: XSLT file(s), XML data file(s) to translate.

If you did develop the XSLT file(s), run them from your development environment. If you got them from somewhere, check e.g. on the command line with some transformer tool (like http://www.microsoft.com/en-us/download/details.aspx?id=21714[^]) if the paths etc. are correctly set.

If it is a matter that on one PC the transformation works but on another not, check your security settings.

Cheers
Andi
 
Share this answer
 
v2
First of all, pardon my english.
I had the same problem on my old code project.
The problem it's few incompatibilities and definitions from XML or XSL documents.
JavaScript
function loadXMLDoc(dname){
    var req;
    if (typeof ActiveXObject !== 'undefined') {
	req = new ActiveXObject('Msxml2.XMLHTTP.3.0');
    }else if (typeof XMLHttpRequest != 'undefined'){			
	req = new XMLHttpRequest();			
    }
    if (req) {
	req.open('GET', dname, false);
	if (typeof XMLHttpRequest != 'undefined'){
        	req.responseType = "msxml-document"; 
	}				
	req.send();
	return req.responseXML;
    }
    // else handle case here that browser does not support ActiveXObject nor XMLHttpRequest
}   	

function displayResult()
{
    xml=loadXMLDoc("./src/xml/promociones.xml");		
    xsl=loadXMLDoc("./src/xsl/promociones.xsl");
    //code for IE
    if (typeof XMLHttpRequest != 'undefined'){
	try{
        	ex=xml.transformNode(xsl);
		$("#contentWrapper").append(ex);
	}catch(e){
		//NOW for ie10, it's similar to Mozilla, Firefox, Opera,...
		if (document.implementation && document.implementation.createDocument)
		{
			xsltProcessor=new XSLTProcessor();
			xsltProcessor.importStylesheet(xsl);
			resultDocument = xsltProcessor.transformToFragment(xml,document);  
                        //the result HTML it's resultDocument
                        $("#contentWrapper").append(resultDocument);
		}
	}
    }
    // code for Mozilla, Firefox, Opera, etc.
    else if (document.implementation && document.implementation.createDocument)
    {
	xsltProcessor=new XSLTProcessor();
	xsltProcessor.importStylesheet(xsl);
	resultDocument = xsltProcessor.transformToFragment(xml,document);  					
	$("#contentWrapper").append(resultDocument);
    }
}

I'm using jQuery but, the resultDocument var it's a HTML document returned after xsl processor, so you have a html code itself.

It's necessary to add a call to displayResult function after DOM document it's ready like this:
JavaScript
$(document).ready(function(){			
    displayResult();
});

The code is working on this site:
http://www.restauracion.elcorteingles.es/interior.html[^]
I hope it's helpful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900