I'm using xslt version 2, I'm trying to transform an xml to a fo output, and I'm stuck on a specific problematic.
Here is what looks like my input:
<a1/>
<a1/>
<b/>
<c/>
<d/>
<a2/>
<b/>
<c/>
<a1/>
<a1/>
<a1/>
<a1/>
<b/>
<c/>
<d/>
This data, functionally speaking, contains a list of 'sets' defined by a1|a2,b?,c?,d?.
My problem is that I don't see how I can count the number of a1 tags for a specific 'set'.
Indeed, I have written my xsl and I get an output like that:
<fo:table>
<fo:row>
<fo:cell>b: </fo:cell>
<fo:cell>b value</fo:cell>
</fo:row>
<fo:row>
<fo:cell>a1: </fo:cell>
<fo:cell>number of a1 ???</fo:cell> <-- what I am trying to retrieve
</fo:row>
<fo:row>
...
</fo:row>
...
</fo:table>
I have done an apply-template on a1+|a2 tags, and I do nothing if a1 tag has a following sibling that equals to a1. I think there must be a way to count the tags with preceding sibling (but then how to insure to count only the corresponding one?)
Any hints would be appreciated!
Edit: On the above example of input, the first count should be 2:
<a1/>
<a1/>
<b/>
<c/>
<d/>
then it should be 4, and not 6:
<a1/>
<a1/>
<a1/>
<a1/>
<b/>
<c/>
<d/>