通过javascript处理xsl中的document()方法问题 [英] document() method problem in xsl processing by javascript

查看:71
本文介绍了通过javascript处理xsl中的document()方法问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是当我使用javascript进行xslt处理时,WebKit无法处理xslt document()方法。当我在xml中包含xsl文件并从浏览器调用xml文件时,它可以工作。但是当我使用javascript来处理这个过程时,它会崩溃。我必须使用javascript将参数传递给xsl文件。所以我不能没有javascript。
这是html部分。

My problem is WebKit cannot handle xslt document() method when i use javascript to do xslt processing. When I include xsl file in xml and call xml file from browser it work. But when I use javascript to handle this process, it crashes. I have to use javascript to pass parameters to xsl file. So I cannot live without javascript. Here is html part.

<html>
<head>
    <script language="javascript" src="./js/jquerymin.js"></script>
    <script language="javascript" src="./js/jquery.transform.js"></script>
<script>

$(document).ready(function(){
    $("#example").transform({xml:"sample.xml", xsl:"sample.xsl", xslParams:{scan:'system',sub:'lan'}});
});
</script>
</head>
<body >
<div id="example" ></div>
</body>
</html>

这是基本的xsl文件,它以这种方式崩溃:

Here is basic xsl file which crashes with this approach:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:nsm="http://xxxxx.com/yyyyy/system"
                xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xsl:param name="scan" select="'system'"/>
<xsl:param name="sub" select="'lan'"/>

<xsl:output method="html"/>  

<xsl:template match="/">
        <xsl:variable name="xsdFile" select="document('sample.xsd')"/>
        <xsl:for-each select="$xsdFile">
               ssss
        </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

正如我说的那样,当我让javascript进行转换时它不起作用。但是当我调用xml文件时从浏览器开始工作。

As I said it does not work while I let javascript to do transformation.But when I call xml file from browser it works.

这是一个错误还是我错过了什么?

Is this a bug or I miss something here?

谢谢,

编辑: http://plugins.jquery.com/project / Transform 这是我使用的jquery插件。顺便说一句其他浏览器如firefox和opera可以完全处理两种方式

edit: http://plugins.jquery.com/project/Transform this is the jquery plugin I use. By the way other browsers such as firefox and opera can handle both ways quite perfect

推荐答案

错误14101 - XSLTProcessor不接受节点作为参数值

我一直在等待WebKit团队解决这个问题很长一段时间(自2007年中期以来一直开放)。

I've been waiting for the WebKit team to fix this bug for quite a while (it's been open since mid-2007).

如果有人知道如何加快请修复此请修复。

If somebody knows of a way to expedite this fix please chime in.

这篇关于通过javascript处理xsl中的document()方法问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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