[xsl] Xalan equivalent for <msxsl:script>?

Subject: [xsl] Xalan equivalent for <msxsl:script>?
From: "Mazza, Glen" <glen.mazza@xxxxxxx>
Date: Mon, 12 Feb 2001 18:30:16 -0500

Given an XML of authors and their books:

	<author name="Author1">
			<book title="Book#1">
			<book title="Book#2">
			<book title="Book#3">
	<author name="Author2">

I wish to identify the most expensive book of each author.  I've seen the
recursion example (#11 in http://www.dpawson.co.uk/xsl/N8090.html) in the
FAQ, but to avoid recursion, I used a msxml:script function:

<msxsl:script implements-prefix="user">
    function mostExpensive(e) 
	  	var maxVal = 0;
		var bookCost = 0;
		var node = e.nextNode();

		while (node != null) 
		   bookCost = parseInt(node.selectSingleNode("cost").text);
		   if (bookCost > maxVal)
			  maxVal = bookCost;
	       node = e.nextNode();
		return maxVal;

My code above works fine:

<td align = "right"><xsl:value-of

Two questions here:

1)  As a sanity check, is this pretty much the way to calculate the largest
value in a list?  Is there any quick XPath/XSLT instruction that would do
the same thing without me needing to resort to functions or recursion?

2)  I would like to move my XSL to a Java application, using Xalan to take
my XML and XSL and output HTML.  But the <msxsl:script> tag is
Microsoft-specific.  Is there a Xalan equivalent for XSLT-process-time
<msxsl:script>?  I'm just starting to learn Xalan, so if you can just give
me a pointer of where I need to look in its documentation, it would be

Glen Mazza

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

Current Thread