Counting level of grandparent nodes
Posted: Fri Feb 29, 2008 8:31 pm
I have an element structure like the one below.
When processing "F" elements, I'd like to count which "C" element I'm in when processing each "F".
I think this would be like counting previous "C" siblings when processing "F", but I can't figure out the XPath pattern to give me such a count, or something similar, when in the XSL processing for each "F" element.
I can live with 0-based or 1-based counting, as long as values are sequential.
Thanks for suggestions.
-- Mike
When processing "F" elements, I'd like to count which "C" element I'm in when processing each "F".
I think this would be like counting previous "C" siblings when processing "F", but I can't figure out the XPath pattern to give me such a count, or something similar, when in the XSL processing for each "F" element.
I can live with 0-based or 1-based counting, as long as values are sequential.
Thanks for suggestions.
-- Mike
Code: Select all
<C>
<D>
<E Attr1="..." />
<F Attr2="..." /> <!--"C" level would be 0 (or 1) -->
</D>
</C>
<C>
<D>
<E Attr1="..." />
<F Attr2="..." /> <!--"C" level would be 1 (or 2) -->
</D>
</C>
<C>
<D>
<E Attr1="..." />
<F Attr2="..." /> <!--"C" level would be 2 (or 3) -->
</D>
</C>