[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Plse Help! something to do with counter....
Hi, I think I will explain what my project is about to give a better view.
The simplified model is like this: Relational Database --> JavaServlet --> XML & XSL -->output This system is basically an online library system, where a user will query the database and convert the result into XML via the servlet. Then with XSL it will be display accordingly. In the display, only the books that are available will have a checkbox assign to it, whereas the others(that are being borrowed) will not. The number of books and the availability of these books are arbitary depending on the query result. The user can borrow more than one books, so I need to get the values of each book that the user want to borrow so that I can update the database. (This is the part that I can't get it right) below is my xml and xsl, Thanks for the help! (my xsl is very messy, so sorry about it..)I use position() in the XSL. <?xml version="1.0" ?> <?xml-stylesheet type="text/xsl" href="trying.xsl"?> <List xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional"> <Resource> <Index>1</Index> <Type>CD</Type> <Title>XML and Java</Title> <Author>Mcgrath</Author> <Subject>Programming</Subject> <Serial_no>123-123-123</Serial_no> <Status>Loan</Status> <Loaner>loaner</Loaner> <Date>12/2/2001</Date> </Resource> <Resource> <Index>6</Index> <Type>Book</Type> <Title>Java Servlet</Title> <Author>Suns</Author> <Subject>Programming</Subject> <Serial_no>123-123-312</Serial_no> <Status>Available</Status> <Loaner>nil</Loaner> <Date>nil</Date> </Resource> <Resource> <Index>8</Index> <Type>Book</Type> <Title>Java XML Programming</Title> <Author>Wrox</Author> <Subject>XML Programming</Subject> <Serial_no>1233-2390</Serial_no> <Status>Available</Status> <Loaner>nil</Loaner> <Date>nil</Date> </Resource> <Resource> <Index>9</Index> <Type>CD</Type> <Title>Java Programming</Title> <Author>Suns</Author> <Subject>Programming</Subject> <Serial_no>1239-12391</Serial_no> <Status>Available</Status> <Loaner>nil</Loaner> <Date>nil</Date> </Resource> <Resource> <Index>10</Index> <Type>CD</Type> <Title>Java 2EE</Title> <Author>Suns</Author> <Subject>Programming</Subject> <Serial_no>1239-12390</Serial_no> <Status>Available</Status> <Loaner>nil</Loaner> <Date>nil</Date> </Resource> </List> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html><body> <form method="GET" action="../servlet/takeLoan"> <xsl:for-each select="List/Resource"> <table width="100%"><xsl:variable name="num"><xsl:number count="Resource"/></xsl:variable><span><xsl:value-of select="$num"/></span> <tr><td width="25%">Title : <xsl:value-of select="Title"/></td> <td width="25%">Author : <xsl:value-of select="Author"/></td></tr> </table> <xsl:variable name="stat"><xsl:value-of select="Status"/></xsl:variable> <xsl:choose> <xsl:when test="$stat='Available'"> <div align="right"><input type="checkbox" name="c{position()}" value="{Index}"/><span>to Loan</span></div><br/> </xsl:when> <xsl:otherwise> <table width="100%"><tr><td width="25%">Loaner : <xsl:value-of select="Loaner"/></td> <td width="25%">Date of Loan : <xsl:value-of select="Date"/></td> </tr></table><br/> </xsl:otherwise> </xsl:choose> <hr/> </xsl:for-each> <input type="submit" name="submit" value="Loan"/> </form> </body></html> </xsl:template> </xsl:stylesheet> From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Reply-To: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> To: "Poh Justin KT" <nitsujpoh@xxxxxxxxxxx> CC: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Plse Help! something to do with counter.... Date: Wed, 2 May 2001 11:12:10 +0100
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|