Returns the position of a node inside its containing sequence.
The position function allows you to determine the position of a specific node in a sequence, or use a specific position to filter out items based on that position.
The context item is defined by the item connected to the "node" parameter of the position function, Person, in the example below.
The simple mapping below adds a position number to each Person of each Department.
The position number is reset for each Department in the Office.
Using the position function to filter out specific nodes
Using the position function in conjunction with a filter allows you to map only those specific nodes that have a certain position in the source component.
The filter "node/row" parameter and the position "node" must be connected to the same item of the source component, to filter out a specific position of that sequence.
What this mapping does is to output:
•The second Person in each Department
•of each Office in Altova.
Finding the position of items in a filtered sequence:
As the filter component is not a sequence function, it cannot be used directly in conjunction with the position function to find the position of filtered items. To do this you have to use the "Variable" component.
The results of a Variable component are always sequences, i.e. a delimited list of values, which can also be used to create sequences.
•The variable component is used to collect the filtered contacts where the last name starts with a letter higher than "M".
•The contacts are then passed on (from the variable) to the target component
•The position function then numbers these contacts sequentially