Good afternoon!

I’m trying to sort xml file , I saw there is possibility of ordering by more then one attribute. But when I try

QueryExpression exp = xquery.compileQuery("for $e in /*/* order by $e/@UID @e/PACKAGE return $e" );

 

I get exception:

Error

  XQuery syntax error on line 1 in `...$e in /*/* order by $e/@UID $e`:

    expected "return", found "$"

net.sf.saxon.xpath.XPathException$Static: XQuery syntax error

      at net.sf.saxon.query.QueryParser.grumble(QueryParser.java:173)

      at net.sf.saxon.expr.ExpressionParser.expect(ExpressionParser.java:80)

      at net.sf.saxon.query.QueryParser.parseForExpression(QueryParser.java:888)

      at net.sf.saxon.expr.ExpressionParser.parseExprSingle(ExpressionParser.java:243)

      at net.sf.saxon.expr.ExpressionParser.parseExpression(ExpressionParser.java:223)

      at net.sf.saxon.query.QueryParser.parseQuery(QueryParser.java:80)

      at net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:45)

      at net.sf.saxon.query.QueryProcessor.compileQuery(QueryProcessor.java:145)

      at com.sap.portal.utils.lat.merger.XMLMerger.Sort(XMLMerger.java:62)

      at com.sap.portal.utils.lat.merger.XMLMerger.Merge(XMLMerger.java:113)

      at com.sap.portal.utils.lat.merger.XMLMerger.main(XMLMerger.java:194)

 

 

What am I doing wrong?

            Thank you

                        Irena Kofman