functx:wrap-values-in-elements

Wraps a sequence of atomic values in XML elements

Description

The functx:wrap-values-in-elements function takes a sequence of atomic values and places each one inside an element with the name specified in $elementName.

The name must be specified as an xs:QName value. QNames can be constructed with calls to the xs:QName type constructor or the fn:QName function, as shown in the examples.

Parameters

Description

values:string()

the values to wrap in elements

elementName:string()

the name of the elements to construct

Examples

XPath

Results

functx:wrap-values-in-elements((1,2,3), xs:QName(‘num’))

<num>1</num> <num>2</num> <num>3</num>

functx:wrap-values-in-elements((1,2,3), xs:QName(‘new:num’))

<new:num xmlns:new=”http://newns”>1</new:num> <new:num xmlns:new=”http://newns”>2</new:num> <new:num xmlns:new=”http://newns”>3</new:num>

functx:wrap-values-in-elements((1,2,3), QName(‘http://newns’,’num’))

<num xmlns=”http://newns”>1</num> <num xmlns=”http://newns”>2</num> <num xmlns=”http://newns”>3</num>

functx:wrap-values-in-elements((1,2,3), QName(‘http://newns’,’new:num’))

<new:num xmlns:new=”http://newns”>1</new:num> <new:num xmlns:new=”http://newns”>2</new:num> <new:num xmlns:new=”http://newns”>3</new:num>