numbering problem
Hi all,
I need to number each occurence of '(' and ')' so that the number is distinct each time. Also the braces can be nested.
The example is used to explains the problem.
Sample XML
----------
<mrow>
<mi>erf</mi>
<mo>#8289;</mo>
<mo>(</mo>
<mrow>
<mi>a</mi>
<mo>#8290;</mo>
<mi>z</mi>
</mrow>
<mo>)</mo>
</mrow>
<mo>#8290;</mo>
<mrow>
<mi>erf</mi>
<mo>#8289;</mo>
<mo>(</mo>
<mrow>
<mi>b</mi>
<mo>#8290;</mo>
<mi>z</mi>
</mrow>
<mo>)</mo>
</mrow>
</mrow>
In this <mo>(</mo> and <mo>)</mo> can occur anywhere in the document, So starting from the first occurence i need to number whenever i come accross them correspondingly.
when I get <mo>(<mo> my output should be
<goto next = "XX"/>
<form number = "XX">
where XX is distinct number whenever i come accross <mo>(</mo> in the document.
Similarly when i get <mo>)</mo> In the document I should output
<goto next = "YY"/>
<form number = "YY">
except for the last occurence of <mo>)</mo> where I have to just output <goto next = "end"/>
where YY is some disctinct number.
Note :-
1)XX is not equal to YY and in the whole document each occurence of
XX and YY should be distinct.
2)Since the above is a MathML document for every ')' there will be
corresponding '('.
Kindly help is needed.
Thank you.
gs
|