[英]Error while calling Javascript from XSL file
Am trying to call javascript from within my XSL file, but it is not working.. 我正在尝试从XSL文件中调用javascript,但无法正常工作。
Wanted to know: 1. Is there any problem with my XSL file... (see below) 2. Is there any system configuration to be done before running XSL with Javascript? 想知道:1.我的XSL文件是否有问题...(见下文)2. 在使用Javascript运行XSL之前是否需要进行任何系统配置?
IE 9.0 is being used for testing of this prototype XSL. IE 9.0正在用于测试该原型XSL。
Here is the content of XSL file : 这是XSL文件的内容:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:result="http://www.example.com/results"
extension-element-prefixes="result" >
<xsl:output method="html" indent="yes"/>
<lxslt:component prefix="result" functions="myParse">
<lxslt:script lang="javascript">
function myParse()
{
return "just testing....";
}
</lxslt:script>
</lxslt:component>
<xsl:template match="/">
<xsl:for-each select="comment/MyObject">
<xsl:variable name="temp" select="@objectInformation" />
<xsl:variable name="temp2">
<xsl:value-of>
<script type="text/javascript">
result:myParse()
</script>
</xsl:value-of>
</xsl:variable>
<xsl:value-of select="string($temp2)"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I believe the syntax for calling your function in this case would be: 我相信在这种情况下调用函数的语法为:
<xsl:value-of select="result:myParse()" />
Or you could just do this in this case: 或者您可以在这种情况下执行以下操作:
<xsl:variable name="temp2" select="result:myParse()" />
And are you sure that the namespace in this case shouldn't be http://xml.apache.org/xalan ? 并且您确定在这种情况下,名称空间不应为http://xml.apache.org/xalan吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.