Brian -- For some reason, $v is being interpreted as a string in your elementAt call. Try inserting a
<xsl:copy-of select="$v"/> to see what Xalan thinks the value of $v is. Gary -----Original Message----- From: Brian Grainger [mailto:[EMAIL PROTECTED] Sent: Saturday, April 27, 2002 11:52 AM To: [EMAIL PROTECTED] Subject: Extension function expects extra parameter Greetings. Xalan-Java 2.3.1 is throwing an exception during a call to an extension function. The details from the XSLT stylesheet: [Namespaces] xmlns:xalan="http://xml.apache.org/xalan" xmlns:string="java.lang.String" xmlns:vector="java.util.Vector" [Example code] <xsl:variable name="v" select="vector:new()"/> <xsl:for-each select="descendant::*"> <!-- Save element name into a variable --> <xsl:variable name="descendantNode"> <xsl:value-of select="name(current())"/> </xsl:variable> <!-- Attach the variable to a vector --> <xsl:value-of select="vector:addElement($v, string:new($descendantNode))"/> </xsl:for-each> <xsl:call-template name="writeVectorElements"> <xsl:with-param name="v" select="$v"/> <xsl:with-param name="vectorLimit" select="vector:size($v) - 1"/> </xsl:call-template> <xsl:template name="writeVectorElements"> <xsl:param name="v"/> <xsl:param name="vectorLimit">0</xsl:param> <xsl:param name="vectorCount">0</xsl:param> <xsl:if test="$vectorLimit >= 0"> <!-- Write out the vector --> <!-- The next line generate the exception --> <xsl:value-of select="vector:elementAt($v, $vectorCount)"/> <!-- Recurse --> <xsl:call-template name="writeVectorElements"> <xsl:with-param name="vectorLimit" select="$vectorLimit - 1"/> <xsl:with-param name="vectorCount" select="$vectorCount + 1"/> </xsl:call-template> </xsl:if> </xsl:template> [Exception message] XSLT Error (javax.xml.transform.TransformerException): java.lang.NoSuchMethodException: For extension function, could not find method java.util.Vector.elementAt([ExpressionContext,] #STRING, #NUMBER). Checked both static and instance methods. [Method definition] elementAt(int index) Returns the component at the specified index [Comment] The elementAt method expects an integer, and returns a Java object, which in this case should be a java.lang.String. The wording of the exception message seems to indicate that Xalan is looking for a method of the form elementAt(String s, int index) which of course it won't find. Any suggestions would be gratefully received. Regards, Brian
