Hi


Need help in sorting untypedAtomic Datatypes.



I am facing issue while sorting untypedAtomic types (i.e. combination of
string and integer)



E.g.



let $data := document {

<standards>

  <standard>SC.3.P</standard>

  <standard>SC.3.P.10</standard>

  <standard>SC.3.P.10.2</standard>

  <standard>SC.3.P.11</standard>

  <standard>SC.3.P.11.1</standard>

  <standard>SC.3.P.8</standard>

  <standard>SC.3.P.8.3</standard>

  <standard>SC.3.P.9</standard>

  <standard>SC.3.P.9.1</standard>

</standards> }

for $each in $data//standard

order by $each

return $each



Result:

<?xml version="1.0" encoding="UTF-8"?>

<results warning="more than one root item">

  <standard>SC.3.P</standard>

  <standard>SC.3.P.10</standard>

  <standard>SC.3.P.10.2</standard>

  <standard>SC.3.P.11</standard>

  <standard>SC.3.P.11.1</standard>

  <standard>SC.3.P.8</standard>

  <standard>SC.3.P.8.3</standard>

  <standard>SC.3.P.9</standard>

  <standard>SC.3.P.9.1</standard>

</results>



Expected Result:

<?xml version="1.0" encoding="UTF-8"?>

<results warning="more than one root item">

  <standard>SC.3.P</standard>

  <standard>SC.3.P.8</standard>

  <standard>SC.3.P.8.3</standard>

  <standard>SC.3.P.9</standard>

  <standard>SC.3.P.9.1</standard>

  <standard>SC.3.P.10</standard>

  <standard>SC.3.P.10.2</standard>

  <standard>SC.3.P.11</standard>

  <standard>SC.3.P.11.1</standard>

</results>



How can you sort the given input so that we get the expected result. Is
there any way to sort it using a regular expression or tokenizing
mechanism?



Thanks and Regards,



Gnanaprakash Bodireddy

Sr Associate - Projects | IME

Cognizant Technology Solutions

VNET: 682831

(O): +91 (40) 44514444 extn: 682831

(M): +91-8897575644




This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorized review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful.
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to