开发者

document() method problem in xsl processing by javascript

开发者 https://www.devze.com 2023-02-17 02:42 出处:网络
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

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>

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>

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?

Thanks,

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


Bug 14101 - XSLTProcessor does not accept Nodes as parameter values

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.


Alejandro, to work document() in XSLT you need use the server-side of the transform plug-in

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号