Hi, Vikas:

You can't at present change the uri in a transform.

One question is why you need to change the uri.  Doesn't that create a problem 
in that the client who wrote the document cannot retrieve the document?

If you must change the uri, one fallback would be to use a resource service 
extension instead of a transform.


Hoping that helps,


Erik Hennum

________________________________
From: [email protected] 
[[email protected]] on behalf of 
[email protected] [[email protected]]
Sent: Tuesday, February 03, 2015 5:15 AM
To: [email protected]
Subject: [MarkLogic Dev General] unable to change uri and output-types in 
marklogic7 using transformation rest api

Hi All

I am using document rest api put method  as below with transformation code  in 
marklogic7.

Request url: 
http://ip:9000/v1/documents?uri=/content_assessments/assessments/abc40148ef3c41399187eefed939a9d555ss1.json&collection=Assessments&transform=assessment
Content-type: “application/json”

In transformation rest api I am converting this document to xml
declare function assessment:transform($context as map:map, $params as map:map, 
$content as document-node())as document-node()
{
  let $document := 
json:transform-from-json(json:transform-to-json-object($content), 
json:config("full"))
  let $output-types := map:put($context,"output-type", "application/xml")
  let $fileuri := map:put($context,"uri", 
fn:concat(fn:substring-before(map:get($context,"uri"), ".json"), ".xml"))
  return document {$document)
};

I want to change the uri location to save xml file as well as “output-type” but 
finding issue in marklogic7.

In code I am modifying $context map to modify uri as well as “output-type” .How 
can I achieve this in Marklogc7?


Regards,
Vikas
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(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to