Loading TOC...


   $doc as node()*,
   $rule-collection as xs:string*
) as node()*


Apply redaction rules to a set of XML and/or JSON documents, returning the resulting documents.

doc The documents to which to apply redaction rules. Only XML and JSON documents can be redacted.
rule-collection The URIs of collections of redaction rules to apply to the input nodes. The collection(s) can contain XML rules, JSON rules, or both, but must not contain non-rule documents.

Required Privileges

This operation requires the redaction-user role or the following privilege:


Usage Notes

This function applies redaction rules to a set of input documents. If no rules match a node, the node is returned unchanged. The collections named in $rule-collections can only contain redaction rule definitions.

You should validate your rules before using them to redact content. An invalid rule will cause this function to throw an exception. Use rdt:rule-validate to validate a redaction rule collection.

Install rules in the schema database associated with your content database.

See Also


(: Install a redaction rule using the built-in "redact-us-ssn" redaction 
 : function. The rule is installed in the "ssn-rules" collection. The 
 : context database for rule insertion must be the schema database. :)
xquery version "1.0-ml";
  <rule xml:lang="zxx" xmlns="http://marklogic.com/xdmp/redaction">
    <description>Stomp SSN</description>
  </rule>, xdmp:default-permissions(), "ssn-rules");

(: Redact all documents in the "people" collection, using the rules in the
 : "ssn-rules" collection. The context database is the content database. :)
xquery version "1.0-ml";
import module namespace rdt = "http://marklogic.com/xdmp/redaction"
    at "/MarkLogic/redaction.xqy";

rdt:redact(cts:search(fn:doc(), cts:collection-query("people")), "ssn-rules")

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.