Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes Putting in a variable as an object name? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Putting in a variable as an object name?" Watch "Putting in a variable as an object name?" New topic
Author

Putting in a variable as an object name?

Ivan Egan
Greenhorn

Joined: Jan 09, 2003
Posts: 1
Trying to put in a number of radioboxes onto a page. I have a loop where 3 radioboxes are displayed each time, each time with the same name so only one can be chosen in each occasion of the loop.
Basically I want this,
<input type="radio" name="radiobox[$variable]"/>
if I used javascript or anything else, I would set the name = radiobox[i] where 'i' would change for each loop. But can't get the variable into the name field here.
Anyone able to help?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Evan,
You can either use the combinaison of <xsl:element> and <xsl:attribute> to achieve this. In <xsl:attribute>, you can use <xsl:value-of select="$variable"/> to output the value of your variable. Or use:
<input type="radio" name="radiobox[{$variable}]"/>
Cheers,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Putting in a variable as an object name?
 
Similar Threads
Create Object in DoWhile Send to Arraylist
Time out inside a servlet
Need help in looping
Which is a good practice to refer maxQ.length ?
Performance!!