Hi Guys,
Greetings of the day.
I am using MarkLogic8 using REST API. I was trying to execute the below XQuery
Code using REST Api.
let $size := 1
let $distinct-element-qnames := distinct-values(
for $i in doc("BTU_NZ_Equity.xml")[1 to $size]//*
return node-name($i) )
for $qn in $distinct-element-qnames
return element element {
attribute local-name { local-name-from-QName($qn) }
}
I was referring to the below link for content transformations,
https://docs.marklogic.com/guide/rest-dev/transforms#id_17421
The Example provided is using the documents service whereas I want to use the
content transformation for search service.
Below is the code I have written following the guidelines provided in the
example online.
xquery version "1.0-ml";
module namespace example =
"http://marklogic.com/rest-api/transform/element_root";
declare function example:transform(
$context as map:map,
$params as map:map,
$content as document-node()
) as document-node()
{
if (fn:empty($content/*)) then $content
else
let $size := (map:get($params,"size"),"UNDEFINED")[1]
let $category := (map:get($params, "category"), "transformed")[1]
let $distinct-element-qnames := distinct-values(
for $i in collection($category)[1 to $size]//*
return node-name($i) )
for $qn in $distinct-element-qnames
return element element {
attribute local-name { local-name-from-QName($qn) }
}
};
However I couldn't get it working, Can anyone help me with the above problem
and let me know if I am missing something.
Thanks for your help in advance.
Thanks & Regards,
Bhushan Suryawanshi
Bhushan Suryawanshi
Developer
t: +1-212-401-7894
www.xenomorph.com<http://www.xenomorph.com/?mail> |
blog<http://xenomorph.typepad.com/?mail> | twitter<http://goo.gl/oaBWO> |
linkedin<http://goo.gl/rdi8W>
This email is confidential and is intended only for the addressee. If you are
not the intended recipient, please note that any dissemination, distribution or
copying of this email is strictly prohibited. Any and all estimates, proposals,
quotes and fees contained herein are for discussion purposes only and are not
contractually binding unless executed in accordance with the standard practices
of the Company. Attachments to this message have been virus checked but no
guarantee can be made that any attachment is virus free. Please notify us
immediately of any problem.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general