|
Subject: [xsl] Linear counting problem in nested loop. From: "Govil, Anoop (Contractor)" <Anoop.Govil@xxxxxxxxxxxxxxxx> Date: Thu, 22 Jan 2004 09:33:59 -0500 |
Hi,
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"?>
<MENU>
<MenuItems>
<MenuLabel>Menu 1</MenuLabel>
<SubMenuItems>
<SubMenuLabel>Sub Menu 1</SubMenuLabel>
</SubMenuItems>
<SubMenuItems>
<SubMenuLabel>Sub Menu 11</SubMenuLabel>
</SubMenuItems>
</MenuItems>
<MenuItems>
<MenuLabel>Menu 2</MenuLabel>
<SubMenuItems>
<SubMenuLabel>Sub Menu 2</SubMenuLabel>
</SubMenuItems>
</MenuItems>
</MENU>
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
counted 3 already... So the output of my code is something like this:
1 for Menu 1
2 for SubMenu 1
3 for SubMenu 11
2 for Menu 2
3 for SubMenu 2
Any help in fixing this will be much appreciated. Thanks a lot!
Anoop
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Parsing date, kakridge | Thread | RE: [xsl] Linear counting problem i, kakridge |
| [xsl] Parsing date, Mark Williams | Date | [xsl] Linear counting problem in ne, Govil, Anoop (Contra |
| Month |