Hi!
I have a little question - probably easy-to-answer, except for a newbie like
me. I try to describe it as precisely as possible, which makes my mail very
long. I am sorry, but I dont want to bother you with an unclear question and
i hope you wont mind the long mail. Thank You.
I have a number of xml-files which includes something like the following
(Actually, there is much more stuff around in those files, but I try to keep
it reduced to my question...):
<test id="test1">
<question>
What is five plus four?
</question>
<answer>
nine
</answer>
</test>
<test id="test2">
<question>
What is five minus two?
</question>
<answer>
three
</answer>
</test>
Where the number of <test>-elements varies from file to file.
I want an output in html, where the question is just text and after every
question there is a form input for the answer. the whole form will be send
to a servlet. So the html will look something like this:
<form method="post" action="NextServlet">
<p>
What is five plus four?<br/>
<input type="text" name="test1"/>
</p>
<p>
What is five minus two?<br/>
<input type="text" name="test2"/>
</p>
<input type="submit"/>
</form>
Now, the xsl. I know it has to be something like this:
<form method="post" action="NextServlet">
<xsl:for-each select="test">
<p>
<xsl:value-of select="question" /><br/>
<input type="text" name="????????"/>
</p>
</xsl:for-each>
<input type="submit"/>
</form>
As you can see, the questionmarks are where my problem is. How can I put a
unique identifier there (which should equal "test1" or "test2", the id-
attribute of <test>, so that my Servlet can compare the given answer to that
in the xml-file?
Thank you for your time (and answer), sorry for any mistakes (english just
isnt my language...),
Nica Huestegge
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list