saxon:new-processing-instruction

Returns a new processing instruction node, with given name and content.

new-processing-instruction($name as xs:string, $content as xs:string?) ➔ processing-instruction()

Arguments

 

$name

xs:string

The name of the new processing instruction

 

$content

xs:string?

The content of the new processing instruction

Result

processing-instruction()

Namespace

http://saxon.sf.net/

Saxon availability

Requires Saxon-PE or Saxon-EE. Implemented since Saxon 10.

Notes on the Saxon implementation

Available since Saxon 10.

Details

This function constructs a new parentless processing instruction node.

The name of the processing instruction is determined by the first argument. This must be an instance of xs:string that conforms to the rules for an xs:NCName; it must not match the name "xml" in a case-blind comparison.

The content of the processing instruction (that is, the string value of the node) is formed by evaluating the second argument. If this is an empty sequence, the string value will be a zero-length string.

Any substring of the string value that matches ?> is replaced by ? > (that is, a space is inserted).

If the function is called twice with the same arguments, it is unpredictable whether it returns the same node or different nodes from the two invocations.

See also:

saxon:new-document()

saxon:new-element()

saxon:new-text()

saxon:new-comment()

saxon:new-attribute()