rdt:redact( $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.
redaction-user
role or the
following privilege:
http://marklogic.com/xdmp/privileges/redaction-user
$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.
(: 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"; xdmp:document-insert("/redactionRules/ssn.xml", <rule xml:lang="zxx" xmlns="http://marklogic.com/xdmp/redaction"> <description>Stomp SSN</description> <path>//ssn</path> <method> <function>redact-us-ssn</function> </method> <options> <level>partial</level> </options> </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")