[xsl] How can I know if a node has already been processed ?

 Subject: [xsl] How can I know if a node has already been processed ? From: "Frédéric Choubelle" Date: Thu, 6 Nov 2008 19:49:27 +0100
```Hello,

I'm working on a (very big) XSL Sheet to translate MathML to Braille
(http://natbraille.free.fr/, GPL Software). We have a big technic
problem concerning the sin, cos, ln, etc functions because sometimes
we need to add braille blocks and this doesn't apply to children. I
won't go further into details but I can tell you we searched a lot a
lot to find a way to solve the problem.
The problem is : in the template-match where the sin or cos function
is identified, the best (and only) way to control what should be
between the blocks is to apply-templates of some following::* and
following-sibling::* axes, but then these nodes are processed again by
the parent.

Examples :
sin x should be translated sin(x) but is translated sin(x)x
sin 2x should be translated sin(2x) but is translated sin(2x)2x
ln xy should be translated ln(xy) but is translated ln(xy)xy
etc.

We tried so hard to determine from the context if the node should be
processed, but this leads to so many cases and so many side effects
that it can't be the right solution. Here's what we thought of :
- have a dynamic list with id's of all already processed nodes
- when we process a node in the sin or ln or cos funtion, we add it to this list
- every time we process a node, we just check if he's not already in
the list to decide if it should be processed or not.

This would be great, but we all know that variables don't vary in XSL.
I've checked the exslt.org site, there are these node-set functions
that would at least allow to test if the current node is in the
already-processed nodeset but we can't figure a way to dynamically add
a node to this node-set.
We also think that Xalan (which we use) might have some useful
extensions but we can't find any doc about it (yet).

So we're still searching, but any help would be greatly appreciated.
Many blind people are looking forward to seeing this problem solved :)