XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2003, 09:41 PM
eXa_bOy eXa_bOy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 eXa_bOy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Xml > Xslt > Html

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

Reply With Quote
  #2  
Old November 24th, 2003, 08:21 PM
eXa_bOy eXa_bOy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 eXa_bOy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old November 25th, 2003, 09:16 AM
Ganymede22 Ganymede22 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 1 Ganymede22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old November 26th, 2003, 02:02 AM
tsprings tsprings is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Seattle, WA
Posts: 55 tsprings User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Xml > Xslt > Html


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT