I was already writing about tuples and maps in the xslt (see
Tuples and maps - Status: CLOSED, WONTFIX, and
Tuples and maps in Saxon).
Now, I want to argue on a use case, and on how xslt processor can detect such a
use case and implement it as map. This way, for a certain conditions, a sequences
could be treated as maps (or as sets).
There are two stages:
Whenever we're talking of nodes than result of the first stage is
a sequence $set as node()*. The role of this sequence is a
set of nodes (order is not important).
$set as node()*
The second stage is usually an xsl:for-each, an xsl:apply-templates,
or something of this kind, which repeatedly verifies whether a some $node as
node()? belongs to the $set, like a following: $node intersect
$set, or $node except $set.
$node except $set
In spite of that we're still using regular xpath 2.0, we have managed to express
a set based operation. It's a matter of xslt processor's optimizer to detect
such a use case and consider a sequence as a set. In fact the detection rule is
$node intersect $set
Thus what to do? Well, I do not think I'm the smartest child, quite opposite...
however it worth to hint this idea to xslt implementers (see
Suggest optimization). I still do not know if it was fruitful...
P.S. A very similar use case exists for a function index-of($collection, $item).
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u