[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

making html-form with an identifier in a xsl:for-each

Subject: making html-form with an identifier in a xsl:for-each
From: Nica Huestegge <Nica.H@xxxxxx>
Date: Sat, 11 Oct 2003 13:53:54 +0200
making a form
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.