If I remember right this was fixed in Saxon 9.4; with 9.3 you will have to atomize the function result by hand using the data() function. Let me know if you get the same problem under 9.4.

Michael Kay

On 09/02/2013 22:24, David Rudel wrote:
I tried using saxon:lowest using an inline function and got an error when using Saxon EE

The following code:
<xsl:variable name="tree" as="element()*">
            <branch height="1" score="4"/>
            <branch height="2" score="5"/>
        <xsl:copy-of select="saxon:lowest($tree, function($x){$x/@score})"/>

returns the following error:
Severity: fatal
Description: Result of function supplied as second argument to lowest must be an atomic value

When using saxon:sort instead of saxon:lowest I get this error instead:
Description: Non-comparable types found while sorting: net.sf.saxon.tree.tiny.TinyAttributeImpl cannot be cast to net.sf.saxon.value.AtomicValue

I have also tried using a temporary tree instead of a sequence of nodes [using $tree/branch instead]. The same errors arise.

P.S. There is a stray quote mark on the documentation page for saxon:lowest.  In the last paragraph the following example is given:

saxon:lowest(sale, function($x){$x/@price * $x/@qty'})

I believe the quote after @qty is extraneous.


"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.

Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.

saxon-help mailing list archived at http://saxon.markmail.org/