As Tamino’s XQuery implementation is missing the preceding reverse Axis, I was wondering if there was any way to perform the following task.
Let’s say I have this XML document :
001
002
019
020
Chapter are recursive and can contain any number of terminal Article nodes.
What I want to do is to select an article from its id (eg “020”), and count how many preceding Article nodes I have (eg 19). That is its position among all other Articles.
Axis preceding::Article, would be great, but it is not implemented yet.
I developped an SXS to count Article using SAX, but this messes my Tamino DB’s memory (Memory Allocation Failed).
I have to admit that the preceding axis is not supported by Tamino XQuery. This is due to the fact that the preceding axis is optional. Moreover I’m afraid that there is no other way to express the preceding axis with Tamino 4.2 (except writing an sxs function). The good news is that the upcoming Tamino version will support order comparisons which allow you to count the predecessors of a given node.