Subject: RE: [xsl] matching input value to a node From: "John Wang" <jwang@xxxxxxxxxxx> Date: Mon, 30 Apr 2001 16:48:36 -0500 |
Try this please, see if it is what you want to do. here is the xml: <?xml version="1.0"?> <root> <field>Org 1</field> <field>Org 2</field> <field>Org 3</field> <field>Org 4</field> <field>Org 5</field> </root> here is the xsl: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/root"> <xsl:variable name="sel">Org 2</xsl:variable> <html> <body> <select name="request" size="1"> <xsl:for-each select="field"> <option> <xsl:choose> <xsl:when test="node()=$sel"> <xsl:attribute name="selected"/> </xsl:when> </xsl:choose> <xsl:value-of select="."/> </option> </xsl:for-each> </select> </body> </html> </xsl:template> </xsl:stylesheet> -John -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of tanz@xxxxxxxxxxxxxxxxxxxxx Sent: Sunday, April 29, 2001 1:06 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] matching input value to a node My xml is as follows: <organisations> <orgRecord> <orgID>1</orgID>> <organisation>whatever</organisation> <acronym>WH</acronym> <orgType>Org 2</orgType> <orgType>bla</orgType> ------- </orgRecord> </organisations> In my xsl I am trying to: 1. set the value of a html text box to the value of a node: e.g. <td bgcolor="#FFFFFF"> <div> <input size="55" name="orgname" type="text" maxlength="200" value=<xsl:value-of select="organisation"/>> </input> <!-- here is the problem--> </div> This obviously does not work. 2. From a drop down list /menu - I want to ensure that the top value displayed is equal to the node. e.g. <select name="droptypeoforg"> <option value="org 1"> Org 1</option> <option value="org 2">Org 2</option> -------------- <option value="other">Other (specify)</option> </select> So that the <xsl:value-of select="orgType"/> e.g Org 2 in xml, would be highlighted (or top of the list) Can someone help? Tanz XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] matching input value to a, Jeni Tennison | Thread | Re: Find position among siblings {R, Xiaocun Xu |
RE: [xsl] Browser caching XML, Chris Bayes | Date | RE: [xsl] how to call templates fro, Wate |
Month |