[patch] problems in math package

Jonathan Wakely <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
Hi,

A colleague of mine came across several errors when trying to use the
math:max extensions, due to misplaced <xsl:import> elements and use of
<xsl:return/>, which I think should be <xsl:result/> instead.

We were using the exslt files with libxslt 1.1.2 and although we had
an old set of files updating to the latest all-exslt.zip file on
exslt.org didn't help.

The attached patch allows us to use the max() function.

I haven't touched any of the HTML or XML files, only the XSL files that
caused errors, let me know if I should make any changes to the other
files.

Additionally, should the declaration of the math namespace in the file
math/math.xsl be xmlns:math="http://exslt.org/math" (with a lower case 'm')
rather than xmlns:math="http://exslt.org/Math" ?

regards,

jon

-- 
"Those who don't understand UNIX are doomed to reinvent it, poorly."
	- Henry Spencer

_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list
exslt-math.patch (text/plain, 2.4 KB)
--- ./math/functions/max/math.max.function.xsl	Mon Sep 29 15:45:38 2003
+++ /home/jw/src/cvs/exslt/./math/functions/max/math.max.function.xsl	Thu Jan 27 13:24:17 2005
@@ -10,13 +10,13 @@
    <xsl:param name="nodes" select="/.." />
    <xsl:choose>
       <xsl:when test="not($nodes)">
-         <exsl:return select="number('NaN')" />
+         <exsl:result select="number('NaN')" />
       </xsl:when>
       <xsl:otherwise>
          <xsl:for-each select="$nodes">
             <xsl:sort data-type="number" order="descending" />
             <xsl:if test="position() = 1">
-               <exsl:return select="number(.)" />
+               <exsl:result select="number(.)" />
             </xsl:if>
          </xsl:for-each>
       </xsl:otherwise>
--- ./math/functions/sqrt/math.sqrt.xsl	Mon Oct 20 14:30:42 2003
+++ /home/jw/src/cvs/exslt/./math/functions/sqrt/math.sqrt.xsl	Thu Jan 27 13:24:17 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt.org/functions" xmlns:math="http://exslt.org/math" version="1.0" extension-element-prefixes="math" math:doc="http://www.exslt.org/math">
-   <func:script language="exslt:msxsl" implements-prefix="math" src="math.sqrt.msxsl.xsl"/>
-   <func:script language="exslt:javascript" implements-prefix="math" src="math.sqrt.js"/>
    <import href="math.sqrt.template.xsl"/>
    <import href="math.sqrt.function.xsl"/>
+   <func:script language="exslt:msxsl" implements-prefix="math" src="math.sqrt.msxsl.xsl"/>
+   <func:script language="exslt:javascript" implements-prefix="math" src="math.sqrt.js"/>
 </stylesheet>
--- ./math/functions/constant/math.constant.xsl	Mon Oct 20 14:30:44 2003
+++ /home/jw/src/cvs/exslt/./math/functions/constant/math.constant.xsl	Thu Jan 27 13:24:17 2005
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt.org/functions" xmlns:math="http://exslt.org/math" version="1.0" extension-element-prefixes="math" math:doc="http://www.exslt.org/math">
    <import href="math.constant.template.xsl"/>
-   <func:script language="exslt:javascript" implements-prefix="math" src="math.constant.js"/>
    <import href="math.constant.function.xsl"/>
+   <func:script language="exslt:javascript" implements-prefix="math" src="math.constant.js"/>
 </stylesheet>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.