将XSLT转换为xml不能在IE 10中运行 [英] Tramsforming XSLT to xml not working in IE 10

查看:81
本文介绍了将XSLT转换为xml不能在IE 10中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xslt到html的tramsformation在所有浏览器中都有效,除了在Windows 8的IE 10中。请建议。下面是我的xsl代码





 <?  xml     version   =  1.0    编码  = < span class =code-keyword> utf-8    >  
< xsl:stylesheet < span class =code-attribute> version = 1.0 xmlns:xsl = http://www.w3.org/1999/XSL/Transform\">
< xsl:output method =' html' version =' 1.0' 编码 =' UTF-8' 缩进 =' 是' / >
< xsl:template 匹配 = / >
< html >
< head >
< style 类型 = text / css >
.pagebreak {page-break-after:always;}
< / style >
< / head >

< body background = logo.JPG >


< h2 align = center < span class =code-keyword>>
< img src = transparent.JPG align = 中心 > < / img >
< / h2 >
< h2 align = center >
< font size
= 6 > CONFIGURATION SETTINGS < / font >
< / h2 >

<! - - 用户信息 - >
< h2 align = center < span class =code-keyword>>
< font size = 5 > 用户信息< / font >
< / h2 >

<! - 创建者 - >
< h2 align = center >
< font 大小 = 4.5 > 创建者< / font >
< / h2 >
< border = 1 align < span class =code-attribute> = 中心 >
< tr bgcolor = #9acd32 >
< th align = center > UserID < / th >
< th align = 中心 > 帐户类型< / th >

< / tr >
< xsl:for-each select = ConfigurationParameters / createdBy / Details >
< tr align = center < span class =code-keyword>>

< td >
< span class =code-keyword>< xsl:value-of 选择 = / >
< / td >

< td >
< xsl:value-of select = 单位 < span class =code-keyword> / >
< / td >

< / tr >
< / xsl:for-each >
< / table >
< / body >
< / html >
< / xsl:template >
< / xsl :stylesheet >

解决方案

我想你是令人困惑的术语。

XSLT是用XML编写的。 XSLT指示转换引擎将一些XML文件转换为其他格式(如HTML,XML,文本)。



检查数据是否全部存在:XSLT文件,要翻译的XML数据文件。



如果确实开发了XSLT文件,从您的开发环境中运行它们。如果你从某个地方拿到它们,请检查,例如在一些变压器工具的命令行上(如 http://www.microsoft.com/ en-us / download / details.aspx?id = 21714 [ ^ ])如果路径等设置正确。



如果是在一台PC上的问题转换有效,但另一方面没有,检查你的安全设置。



干杯

Andi


首先,原谅我的英语。

我在旧的代码项目中遇到了同样的问题。

问题是XML或XSL文档中的一些不兼容性和定义。 />

  function  loadXMLDoc(dname){
var req;
if typeof ActiveXObject!== ' undefined'){
req = new ActiveXObject(' Msxml2.XMLHTTP.3.0');
} 其他 如果 typeof XMLHttpRequest!= ' undefined'){
req = new XMLHttpRequest();
}
if (req){
req.open('' GET',dname, false );
if typeof XMLHttpRequest!= ' undefined'){
req.responseType = MSXML文档;
}
req.send();
return req.responseXML;
}
// 否则此处处理浏览器不支持ActiveXObject或XMLHttpRequest
}

function displayResult()
{
xml = loadXMLDoc( ./ src / xml / promociones.xml);
xsl = loadXMLDoc( ./ src / xsl / promociones.xsl);
// IE的代码
if typeof XMLHttpRequest!= ' undefined'){
try {
ex = xml.transformNode(xsl);


< blockquote>( #contentWrapper)。append(ex);
} catch (e){
// 现在ie10,它类似于Mozilla,Firefox,Opera,...
if document .implementation&& document .implementation.createDocument)
{
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml, document );
// 结果HTML是resultDocument


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 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>

解决方案

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


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.

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


这篇关于将XSLT转换为xml不能在IE 10中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆