.. _insert-before: ============= insert-before ============= Insere um item novo numa sequência Descrição ~~~~~~~~~ A função fn:insert-before devolve uma cópia da sequência $target com os itens de $inserts inseridos na posição indicada por $position. As posições começam em 1, não em 0. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parâmetros** - **Descrição** * - target:item() - a sequência onde inserir * - position:integer() - a posição onde inserir * - inserts:item() - os itens a inserir Exemplos ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Resultado** * - 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')