|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i am having issues getting the VALUE of a select's box into option HTML from the XSLT.
ok heres the code for the XML : Code:
<ELEMENT>LISTBOX</ELEMENT>
<OPTIONS>
<OPTION>
<TEXT>User</TEXT>
<VALUE>UN</VALUE>
</OPTION>
<OPTION>
<TEXT>Group</TEXT>
<VALUE>GN</VALUE>
</OPTION>
<OPTION>
<TEXT>Location</TEXT>
<VALUE>LN</VALUE>
</OPTION>
</OPTIONS>
and heres the code for the XSLT : Code:
<xsl:if match=".[ELEMENT='LISTBOX']">
<tr>
<td><font face="verdana" size="1"><b><xsl:value-of select="PROMPT"/></b></font></td>
<td>
<select size="1" name="cbotest">
<xsl:for-each select="OPTIONS/OPTION">
<option value="{@id}"><xsl:value-of select="TEXT"/></option>
</xsl:for-each>
</select>
</td>
</tr>
</xsl:if>
how do i get the option tag to pass the value across? thanks a load guys ![]() |
|
#2
|
|||
|
|||
|
this is such a usless forum, ive progressed to something like this as the solution. if anyone has a chance could you please reply :
Code:
<xsl:if match=".[ELEMENT='LISTBOX']">
<tr>
<td><font face="verdana" size="1"><b><xsl:value-of select="PROMPT"/></b></font></td>
<td>
<select size="1" name="cbotest">
<xsl:for-each select="OPTIONS/OPTION">
<option value="<xsl:value-of select="VALUE"/>"><xsl:value-of select="TEXT"/></option>
</xsl:for-each>
</select>
</td>
</tr>
</xsl:if>
ooh yeah and this above doesnt work either ![]() Last edited by eXa_bOy : November 24th, 2003 at 08:23 PM. |
|
#3
|
|||
|
|||
|
Try this...
<xsl:if match=".[ELEMENT='LISTBOX']"> <tr> <td><font face="verdana" size="1"><b><xsl:value-of select="PROMPT"/></b></font></td> <td> <select size="1" name="cbotest"> <xsl:for-each select="OPTIONS/OPTION"> <xsl:text><![CDATA[<option value="]]></xsl:text> <xsl:value-of select="VALUE"/> <xsl:text><![CDATA[">]]></xsl:text> <xsl:value-of select="TEXT"/> <xsl:text><![CDATA[</option>]]></xsl:text> </xsl:for-each> </select> </td> </tr> </xsl:if> Last edited by Ganymede22 : November 25th, 2003 at 09:25 AM. |
|
#4
|
|||
|
|||
|
Hello eXa_bOy. I reworked your code a bit. I realize I only have a bit of your code, but judging on what you are trying to do, I suggest you change your XML file so that the "OPTIONS" tags are enclosed inside of the "ELEMENT" tag. Then change the current value of "ELEMENT" to be it's attribute instead. It looked to me that you were choosing the "OPTIONS" based on the value of "ELEMENT".
Here is the new XML file (reworked a bit): Code:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="eXa_bOy.xsl" ?>
<ELEMENT id="LISTBOX">
<OPTIONS>
<OPTION>
<TEXT>User</TEXT>
<VALUE>UN</VALUE>
</OPTION>
<OPTION>
<TEXT>Group</TEXT>
<VALUE>GN</VALUE>
</OPTION>
<OPTION>
<TEXT>Location</TEXT>
<VALUE>LN</VALUE>
</OPTION>
</OPTIONS>
</ELEMENT>
And the reworked xsl file, eXa_bOy.xsl: Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table>
<tr>
<td>
<font face="verdana" size="1"><b><!--<xsl:value-of select="/PROMPT"/>-->Prompt Will Go Here</b></font>
</td>
<td>
<select size="1" name="cbotest">
<xsl:if test="/ELEMENT[@id='LISTBOX']">
<xsl:for-each select="/ELEMENT/OPTIONS/OPTION">
<option value="{VALUE}"><xsl:value-of select="TEXT"/></option>
</xsl:for-each>
</xsl:if>
</select>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
I believe this is what you're trying to do.
__________________
T. Springs |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Xml > Xslt > Html |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|