MarkLogic 12 EA 1 Product Documentation
op:xml-text

op:xml-text(
   $content as item()
) as map:map

Summary

This function constructs an XML text node with the specified value.

Parameters
$content The value of the XML text node.

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-literals((
          map:entry("row",1)=>map:with("gp",1)=>map:with("nm","alpha")=>
          map:with("str","a")=>map:with("num",10)=>map:with("bool", true()  ),
          map:entry("row",2)=>map:with("gp",1)=>map:with("nm","beta" )=>
          map:with("str","b")=>map:with("num",20)=>map:with("bool", false() ),
          map:entry("row",3)=>map:with("gp",2)=>map:with("nm","gamma")=>
          map:with("str","c")=>map:with("num",30)=>map:with("bool", true()  ),
          map:entry("row",4)=>map:with("gp",2)=>map:with("nm","delta")=>
          map:with("str","d")=>map:with("num",40)=>map:with("bool", false() )
          ))
	          => op:where(op:eq(op:col("gp"), 1))
              => op:select(("row",
	                  op:as("node", op:xml-document(
	                      op:xml-element(op:col("nm"), (),
	                          op:xml-element(op:col("str"), (),
                                   op:xml-text(op:col("bool"))))))
	               ))
	          => op:order-by("row")
	          => op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy