Thank you this is what I looking for !

2009/3/26 Michael Kay <>
The union operator (|) in XPath requires both operands to be node-sequences, but your second operand is a number.
You can use the comma operator (,) in XPath 2.0. The result will then be a sequence of nodes followed by a number. This is not a type that XPath 1.0 recognizes, so you can't handle it using the JAXP interface. But it would work fine using s9api.
In s9api it would work like this:
Processor proc = new Processor();
DocumentBuilder builder = proc.newDocumentBuilder();
XdmNode document =;
XPathCompiler xpc = proc.newXPathCompiler();
XPathSelector xps = xpc.compile("/BOOKLIST/BOOKS/ITEM, sum(//BOOKLIST/BOOKS/ITEM/PAGES)").load();
for (XdmItem xi : xps) {
  ... process the next item in the result ...
Michael Kay

From: Erik Rens []
Sent: 26 March 2009 15:03
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Fwd: Xpath 2.0 sequences and Saxon examples problems.

I want to sent more then one expression to xpath something like this.


thats the problem my evaluation function expects a NodeSet and for the sum a String. Ofcourse I can split those on the'  |  ' character en use two return types XPathConstants.NodeSet and XPathConstants.Number. But I prefer to handle this in one expression. So I thought XPath 2.0 can to this for me.

So this is the file I used from Saxon examples.

Sorry but I dont understand how I can use s9api to solve this problem..



saxon-help mailing list archived at