[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] FW: Linear counting problem in nested loop

Subject: [xsl] FW: Linear counting problem in nested loop
From: "Wang, Dongzhi (ACF)" <DWang@xxxxxxxxxxx> (by way of Mulberry Technologies List Owner)
Date: Sat, 24 Jan 2004 13:47:41 -0500


I have the following XML and want to implement such that I can have a linear counter increment with each iteration of the parent for-each loop and also the nested for-each loop.

<?xml version="1.0"?>
        <MenuLabel>Menu 1</MenuLabel>
            <SubMenuLabel>Sub Menu 1</SubMenuLabel>
            <SubMenuLabel>Sub Menu 11</SubMenuLabel>
        <MenuLabel>Menu 2</MenuLabel>
            <SubMenuLabel>Sub Menu 2</SubMenuLabel>

e.g. The counter should return as: 1 for Menu 1
2 for SubMenu 1
3 for SubMenu 11
4 for Menu 2
5 for SubMenu 2

So far, what I got is the counter breaks when it reaches the second <MenuItems>, as it doesn't know about the subMenu from the first MenuItems counts 3 already...

Thanks a lot!

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread