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.9.3.0.5 (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"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:udf="user-defined"
    xmlns:saxon="http://saxon.sf.net/"
    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:template>
  
    <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"/>
      </xsl:for-each>
    </xsl:function>
</xsl:stylesheet>

Here is the source:

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


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
Saxonica

------------------------------------------------------------------------------
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!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help



--

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