Hello,

I run into some troubles with saxon, specifically regarding xpath, not xslt.

 

I am using saxon-he, and I am using an xpath expression as follows: sum(/a/b)

I execute the xpath using standard Java api, roughly as follows (expecting a string as a result): getXpathExpression().evaluate(item, XPathConstants.STRING);

 

This works ok, but for large results (7 digits and up) I get the result in a scientific notation format: 3.0E6

 

So I tried to use the format-number function: format-number(sum(/a/b),'#')

but then I get this exception:

 

Caused by: net.sf.saxon.trans.XPathException: System function format-number#2 is not available with this host language/version

                at net.sf.saxon.expr.parser.ExpressionParser.grumble(ExpressionParser.java:263)

 

Any idea how I can solve this:

 

1)      Will upgrading to saxon-pe or saxon-ee help?

2)      I can change the code to expect a numeric result, but this is currently very costly, I am trying to avoid it.

3)      Any way to use custom functions in xpath?

 

Thanks,

Yoni