开发者

How to display in xsl:value-of with a javascript return value function?

开发者 https://www.devze.com 2023-02-10 01:42 出处:网络
I\'d google for an开发者_JS百科swer but to no avail, there\'s example but don\'t work. I have an xsl but I need to include javascript functions and possible updating it on the fly. But I\'m stuck at

I'd google for an开发者_JS百科swer but to no avail, there's example but don't work.

I have an xsl but I need to include javascript functions and possible updating it on the fly. But I'm stuck at the very basic or displaying xsl:value-of with a javascript funciton that returns a value.

I'd just started on xslt for a few days and had tried msxsl and a few other solution, but I can't get it to work.

Below is my testing code, appreciate if anyone could help me out with solution.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:php="http://php.net/xsl"
                exclude-result-prefixes="php"
                xsl:extension-element-prefixes="php">

<xsl:template match="data">

<head>
<title>test woe</title>
<script type="text/javascript">
     function retValue()
     {
          var val = 1;
          return val;
     }
</script>
</head>

<body>
     <xsl:value-of select="retValue()"/>
</body>

</xsl:template> 


Even I had similar problem. This doesnt work anyways. You may be able to do it using msxsl. u will get example from net.

Instead what you can do is call an onload javascript function and assign the value there. something like d= document.getElementByID('div') ; d.innerHTML ="the value";

0

精彩评论

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