You could always construct the entire for clause as a string and pass it to 
xdmp:value(...).
The MarkLogic folk probably have a better solution though.

From: [email protected] 
[mailto:[email protected]] On Behalf Of Tim Meagher
Sent: Friday, May 22, 2009 8:16 AM
To: 'General Mark Logic Developer Discussion'
Subject: [MarkLogic Dev General] Can an xquery order by clause be constructed?


Hi folks,



I would like to know if the order by clause can be programmatically 
constructed. For example, given a query such as the following:



for $el in cts:search(xdmp:directory("/SomeDir/","infinity")/SomeNode,

  cts:element-value-query(xs:QName("SomeElement"), "SomeElementValue",

  ("case-insensitive", "punctuation-insensitive", "diacritic-insensitive")))



  let $id := string($e/@ID)

  let $author := string($el/author[1])

  let $title := string($el/title[1])



  order by $id, $title, $author



  return $el



I would like to be able to programmatically construct the order clause to be 
something like "$author, $title" instead of "$id, $title, $author".



Thank you!



Tim - aaom consulting


 NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message.


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to