Subject: [xsl] Generic Dropdown template From: atulss@xxxxxxxxxx Date: Mon, 24 Mar 2003 21:27:54 +0530 |
Hi, As in my application, there are many dropdowns for which data may come from XML, (eg. to display date - day, month, year or grade of user etc.) I would like to create new generic template for displaying dropdown on the screen. but this doesn't work. Can anybody help me. thanks in advance. <xsl:template name="GetDropDown"> <xsl:param name="xpath"/> <xsl:param name="option"/> <xsl:param name="id"/> <xsl:param name="sel"/> <xsl:for-each select="$xpath"> <option> <xsl:attribute name="value"> <xsl:value-of select="ID"/> </xsl:attribute> <xsl:if test="($id) = ($sel)"> <xsl:attribute name="selected"> true </xsl:attribute> </xsl:if> <xsl:value-of select="$option"></xsl:value-of> </option> </xsl:for-each> </xsl:template> My XML look like, where User_info element stores id for the selected option. <ROOT> <USER_INFO> <USER_NAME>Kevin Smith</USER_NAME> <GRADE>2</GRADE> </USER_INFO> <GRADE> <ROW num="1"> <M>Grade 1</M><ID>1</ID> </ROW> <ROW num="2"> <M>Grade 2</M><ID>2</ID> </ROW> <ROW num="3"> <M>Grade 3</M><ID>3</ID> </ROW> <ROW num="4"> <M>Grade 4</M><ID>4</ID> </ROW> <ROW num="5"> <M>Grade 5</M><ID>5</ID> </ROW> </GRADE> </ROOT> regards, Atul Samnerkar MASTEK Investing in relationships In the US, we're called MAJESCO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] manipulating attribute va, Jarno . Elovirta | Thread | Re: [xsl] Generic Dropdown template, David Carlisle |
Re: [xsl] manipulating attribute va, Lionel Crine | Date | Re: [xsl] Generic Dropdown template, David Carlisle |
Month |