Web Analytics Made Easy -
StatCounter Calling a Javascript Function from within XSLT - CodingForum

Announcement

Collapse
No announcement yet.

Calling a Javascript Function from within XSLT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling a Javascript Function from within XSLT

    Hi All,

    I'm trying to call a javascript function from within xslt. I can get it to return a string but it does not return an xml style object/node/element. Any suggestions on how to do this would be much appreciated. Here is an example of what I am trying to do:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:user="retstr" version="1.0">
    <xslutput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

    <msxsl:script language="JScript" implements-prefix="user"><![CDATA[


    function retstr() {

    return "<TEST>mytest</TEST>";
    }


    ]]>
    </msxsl:script>

    <xsl:template match="/">
    <xsl:call-template name="bdexp"/>
    </xsl:template>

    <xsl:template name="bdexp">

    <xsl:variable name="myvar" select="user:retstr()"/>
    <xsl:copy-of select="$myvar"/>
    </xsl:template>

    </xsl:stylesheet>
    Thanks in advance!
    Last edited by bimaldave; Oct 12, 2006, 03:16 PM.
Working...
X