Hi Michael,

The error is shown below.

I get the same error when I call from the command line directly using java -jar [dir]/saxon9pe.jar

FWIW, I think I'm going to be able to talk my company into upgrading to either use oXygen or Stylus Studios IDE.

java.lang.ClassCastException: net.sf.saxon.value.SingletonItem cannot be cast to net.sf.saxon.value.AtomicValue
    at com.saxonica.functions.extfn.Sort$SortCall$1.evaluateSortKey(Sort.java:78)
    at net.sf.saxon.expr.sort.SortedIterator.buildArray(SortedIterator.java:232)
    at net.sf.saxon.expr.sort.SortedIterator.doSort(SortedIterator.java:248)
    at net.sf.saxon.expr.sort.SortedIterator.next(SortedIterator.java:133)
    at net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java:83)
    at net.sf.saxon.expr.instruct.CopyOf.processLeavingTail(CopyOf.java:475)
    at net.sf.saxon.expr.instruct.Template.applyLeavingTail(Template.java:212)
    at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1034)
    at net.sf.saxon.Controller.transformDocument(Controller.java:1957)
    at net.sf.saxon.Controller.transform(Controller.java:1803)
    at net.sf.saxon.Transform.processFile(Transform.java:985)
    at net.sf.saxon.Transform.doTransform(Transform.java:619)
    at net.sf.saxon.Transform.main(Transform.java:73)
Fatal error during transformation: java.lang.ClassCastException: net.sf.saxon.value.SingletonItem cannot be cast to net.sf.saxon.value.AtomicValue

On Mon, Apr 2, 2012 at 7:56 PM, Michael Kay <mike@saxonica.com> wrote:

> I had tried passing in a function but could not figure out how to
> reference the context item. And that leads me to a follow-up question
> that displays my ignorance:  where you "?" what should I put?
It was intended to be a literal '?'. saxon:sort expects the second
argument to be a one-argument function. If you have a two-argument
function f(a, b), then f('abcd', ?) represents a one-argument function:
if we call this one-argument function g($x) then the value of g($x) is
the value of f('abcd', $x). This construct is called 'partial function
> I then decided to try using a literal ?, and that threw a java error.
What was the error?

Michael Kay

This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
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.