[xsl] Runng Script in Server-Side XSL causes Runtime Error

Subject: [xsl] Runng Script in Server-Side XSL causes Runtime Error
From: "Jibran Bisharat" <jibran@xxxxxxxxxxxxxx>
Date: Wed, 14 Nov 2001 13:03:29 -0700
The Situation:
    I have a function called sZeroFillTo(sStringToFill,nDigits) declared
below.  I need to fill zeros on months/days/years that aren't
    zero filled (very simple).
The Problem:
    *********************ERROR RETURNED**********************
    Microsoft JScript runtime error Wrong number of arguments or invalid
    assignment line = 4, col = 3 (line is offset from the start of the
script block).
    Error returned from property or method call.

    I have tried with and without the CDATA section, still errors...

    I can get the function to work if i return immediatetly with what im
passed in sStringToFill as follows:
    function sZeroFillTo(sStringToFill,nDigits)

        return sStringToFill;

Does anyone know what i am doing wrong???? thanks

*****************XSL SNIPITS**********************************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

 <msxsl:script language="JScript" implements-prefix="test"><![CDATA[
  function sZeroFillTo(sStringToFill,nDigits)
   var sReturn=new String(sStringToFill);
    while (sReturn.length < nDigits)
   return sReturn;
<xsl:for-each select="record">
    <xsl:variable name="sDOB">
     <xsl:if test="dob/month!=''">
      <xsl:value-of select="test:sZeroFillTo(dob/month,2)" />
      <xsl:value-of select="'/'"/>
     <xsl:if test="dob/day!=''">
      <xsl:value-of select="test:sZeroFillTo(dob/day,2)" />
      <xsl:value-of select="'/'"/>
     <xsl:if test="dob/year!=''">
      <xsl:value-of select="test:sZeroFillTo(dob/year,4)" />
      <xsl:value-of select="' '"/>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread