Description
The fn:insert-before function returns a copy of the $target sequence with the item(s) in $inserts inserted at the position indicated by $position . Position numbers start at 1, not 0.
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type | Description |
$target |
item()* |
the sequence to insert into |
$position |
xs:integer |
the position to insert at |
$inserts |
item()* |
the items to insert |
return value |
item()* |
ExamplesXPath Example | Results |
---|
insert-before(
('a', 'b', 'c'), 1, ('x', 'y')) |
('x', 'y', 'a', 'b', 'c') |
insert-before(
('a', 'b', 'c'), 2, ('x', 'y')) |
('a', 'x', 'y', 'b', 'c') |
insert-before(
('a', 'b', 'c'), 10, ('x', 'y')) |
('a', 'b', 'c', 'x', 'y') |
insert-before(
('a', 'b', 'c'), 0, ('x', 'y')) |
('x', 'y', 'a', 'b', 'c') |
insert-before(
('a', 'b', 'c'), 2, ()) |
('a', 'b', 'c') |
insert-before(
(), 3, ('a', 'b', 'c') ) |
('a', 'b', 'c') |
History |
Recommended Reading:
|