Mashups in EMML : Advanced Mashup Techniques : Removing Duplicates With Filtering : XPath Axes
XPath Axes
Axes in XPath are a syntax that allow XPath expressions to refer to other nodes based on a relationship with the node that is the current context. Take a simple <filter> statement, such as this:
<filter inputvariable="$a" outputvariable="$a" filterexpr="/rss/channel/item[contains(title,'Java')" />]
As the filter is processed, it checks each item node and that node becomes the current context. The title node in this example, in fact, uses the default XPath axis -- the child axis. Because there is no other axis identifier, the filter looks for title as a child of item.
There are many other axes in XPath that allow you to refer to previous nodes, following nodes, the parent node, ancestor nodes, descendant nodes and many more. See the XPath 2.0 specification for a complete list of valid axes.
To use a different axis than the default child axis, you add a prefix to each node name in the form:
axis-name::node-name
For example, preceding::item identifies any item node that comes before the current node and is not an ancestor. The path expression ancestor::channel identifies the channel node that is a parent or earlier ancestor at any level of the document to the current node. You can also use wildcards, such as following::* or following::node() to identify all following nodes of any name.
To filter out duplicates, you typically use one of these axes:
*preceding: any nodes from the document root node to the current context node that come before the current context in document order and are not ancestor nodes of the current context.
*following: any nodes that come after the current context in document order and are not descendants of the current context.
*preceding-sibling: any nodes that have the same parent as the current context and occur before the current context in document order.
*following-sibling: any nodes that have the same parent as the current context and occur after the current context in document order.
Copyright © 2013-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback