File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Newbie need help with nested for loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Newbie need help with nested for loop" Watch "Newbie need help with nested for loop" New topic
Author

Newbie need help with nested for loop

Tokai Moshai
Greenhorn

Joined: May 24, 2006
Posts: 16
I know it could be too much to ask for, but I don't know much XSL and need only one thing, do not have to time to learn it as well. So, if someone can give me the code, I will really appreciate that. here is the xml file i need to use

<parent name="name1" group="grp1">
<class name="Style">
<param id="1" good="30" bad="10"/>
<param id="2" good="40" bad="20"/>
<param id="3" good="70" bad="30"/>
<param id="4" good="20" bad="15"/>
<param id="5" good="30" bad="18"/>
<param id="6" good="50" bad="15"/>
<param id="7" good="39" bad="18"/>
</class>
</parent>
<parent name="name2" group="grp1">
<class name="Style">
<param id="1" good="35" bad="14"/>
<param id="2" good="45" bad="23"/>
<param id="3" good="75" bad="36"/>
<param id="4" good="25" bad="15"/>
</class>
</parent>
<parent name="name3" group="grp2">
<class name="Style">
<param id="1" good="34" bad="34" correctable="23"/>
<param id="2" good="34" bad="13" correctable="23"/>
<param id="3" good="78" bad="56" correctable="23"/>
</class>
<class name="other">
<param id="1" good="34" bad="34" correctable="23"/>
<param id="2" good="34" bad="13" correctable="23"/>
<param id="3" good="78" bad="56" correctable="23"/>
<param id="4" good="41" bad="15" correctable="23"/>
<param id="5" good="30" bad="23" correctable="23"/>
</class>
</parent>

what i need is one for loop that will select the name. and then using that name i need another for loop that will go over the params. my problem is right here, i can't seem to use the value i'm getting in parent for loop into the nested for loop.

thanks in advanced.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It isn't considered correct to ask people to write code for you here. Generally we prefer to help people solve their own problems rather than doing their work for them.

However in this case, even if we wanted to write your code, you haven't posted anything near to the complete specifications for the code. So I think it would be better if you posted what you have, and explained what you want it to do.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Newbie need help with nested for loop