Irritating problem in JScript and XSL

wxdqz

New Member
Hi,I am calling JScript from my XSL. Below is the code where i am getting aproblemI get 'null' is either null or not an object Error in the InsertHTMLfunction. Check the code.Any help is appreciated. Thanx.Brijesh<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0" xmlns:local="#local-functions"xmlns:msxsl="urn:schemas-microsoft-com:xslt"><xsl:output method="html" /><msxsl:script implements-prefix="local"><![CDATA[var gArray;function InsertHTML(documentNode){var FieldCol;var FieldObj;var numFields;var FieldNo=0;var numRecords;var result;var Recordvalue="";numRecords =documentNode.item(0).selectSingleNode("NumOfRecords").text;dimArray(documentNode.item(0).selectSingleNode("NumOfFields").text);FieldCol = documentNode.item(0).selectNodes("Fields/Field");numFields = FieldCol.length;for (FieldNo=1;FieldNo<=numFields;FieldNo++){//**** here is where the problem occurs)//**** I get 'null' is either null or not an object ErrorRecordvalue +=FieldCol(FieldNo).selectSingleNode("RecordValue").text;//This one works fine though//return FieldCol(FieldNo).selectSingleNode("RecordValue").text}return Recordvalue;}]]></msxsl:script><xsl:template match="DSDataClass"><HTML><BODY><TABLE cellspacing='0' cellpadding='1' border='1'><TR><TD bgcolor="lightblue" nowrap="True"><STRONG> <xsl:value-of select="Name" /></STRONG></TD><xsl:call-template name="for"><xsl:with-param name="from" select="1" /><xsl:with-param name="to" select="number(NumOfFields)-1" /><xsl:with-param name="body"><TD bgcolor="lightblue"> </TD></xsl:with-param></xsl:call-template></TR><TR><xsl:for-each select="Fields/*"><TD bgcolor="lightblue" nowrap="True"> <xsl:value-of select="SubGroupName" /></TD></xsl:for-each></TR><TR><xsl:for-each select="Fields/*"><TD bgcolor="lightblue" nowrap="True"> <xsl:value-of select="Name" /></TD></xsl:for-each></TR><xsl:value-of select="local:InsertHTML(current())" /><TR><xsl:call-template name="for"><xsl:with-param name="from" select="1" /><xsl:with-param name="to" select="number(NumOfFields)" /><xsl:with-param name="body"><TD> </TD></xsl:with-param></xsl:call-template></TR></TABLE></BODY></HTML></xsl:template><xsl:template name="for"><xsl:param name="from" /><xsl:param name="to" /><xsl:param name="body" /><xsl:if test="$from <= $to"><xsl:copy-of select="$body" /><xsl:call-template name="for"><xsl:with-param name="from" select="$from+1" /><xsl:with-param name="to" select="$to" /><xsl:with-param name="body" select="$body" /></xsl:call-template></xsl:if></xsl:template></xsl:stylesheet>
 
Back
Top