Loading TOC...

op:xml-pi

op:xml-pi(
   $name as item(),
   $value as item()
) as map:map

Summary

This function constructs an XML processing instruction with the atomic value.

Parameters
$name The name of the processing instruction.
$value The value of the processing instruction.

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:select(("row",
                      op:as("node", op:xml-pi(op:col("str"), op:col("num")))
	               ))
	            => op:order-by("row")
	            => op:result()

  

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