.. _zero-or-one: =========== zero-or-one =========== Returns a sequence if it contains zero or one items, otherwise errors Description ~~~~~~~~~~~ The fn:zero-or-one function returns $arg if it contains zero or one items. Otherwise, the error FORG0003 is raised. This function is useful when static typing is in effect, to avoid apparent static type errors. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - arg:item() - Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - zero-or-one( () ) - () * - zero-or-one('a') - a * - zero-or-one( ('a', 'b') ) - Error FORG0003 See Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`one-or-more`. * :ref:`exactly-one`.