Okay, I thought that is what you meant. I sent a complete XSL and XML source as an attachment earlier. Perhaps they are not allowed on the list.

The complete XSL is shown below. I just tested it and confirm:
A) As written, this throws an error when run in oXygen using SaxonPE. (error shown below)
B) If the return type for function udf:expression is given [<xsl:function name="udf:expression" as="xs:string">], the xsl runs as desired.

Severity: error
Description: net.sf.saxon.value.SingletonItem cannot be cast to net.sf.saxon.om.Item

    <xsl:stylesheet version="3.0"
    exclude-result-prefixes="xs udf saxon">

    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
    <xsl:variable name="seq1" select="saxon:sort(changes/item, udf:expression('@price',?))"/>

    <xsl:copy-of select="$seq1"></xsl:copy-of>
    <xsl:function name="udf:expression">
      <xsl:param name="expr" as="xs:string"/>
      <xsl:param name="context-item" as="node()"/>
      <xsl:for-each select="$context-item">
        <xsl:evaluate xpath="$expr"/>

Here is the source:

<?xml version="1.0" encoding="UTF-8"?>
<item price="1.10">
<item price="1.50">

On Thu, Apr 12, 2012 at 9:28 PM, Michael Kay <mike@saxonica.com> wrote:

On 12/04/2012 18:44, David Rudel wrote:
> Michael,
> I apologize for not being as fluent with computer-science language.
> What constitutes a "repro"?

Sorry, that's not computer science language, it's just help desk jargon.
Just as it's easy to slip into calling a bug report a "ticket", a
"repro" is a runnable test case - as small as possible, but complete -
that demonstrates the problem.
> I sent a source code/stylesheet earlier. Is there something else you
> are looking for?
As far as I'm aware, you sent some fragments of code. I tried to
reproduce the bug from those fragments, and failed.

Michael Kay

For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
saxon-help mailing list archived at http://saxon.markmail.org/


"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.