Loading TOC...

op.xmlPI

op.xmlPI(
   $name as String,
   $value as String
) as processingInstructionNode

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


const op = require('/MarkLogic/optic');

const literals = op.fromLiterals([
            {row:1, gp: 1, nm:"alpha", str:"a", num:10, bool:true},
            {row:2, gp: 1, nm:"beta", str:"b", num:20, bool:false},
            {row:3, gp: 2, nm:"gamma", str:"c", num:30, bool:true},
            {row:4, gp: 2, nm:"delta", str:"d", num:40, bool:false}
            ])
literals.where(op.eq(op.col('gp'), 1))
        .select(['row', 
                 op.as('node', op.xmlPI(op.col('str'), op.col('node')) )
                ])
        .orderBy('row')
        .result();

  

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