Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 25th, 2008, 08:06 AM
Authorized User
 
Join Date: Sep 2008
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post
Default need help putting xsl:value-of in select option

I am creating a drop down in my XSL and I need to use the link as the value so I can pass that to my javascript using an onClick. My question is how do I get the xsl:value-of in the value of the select option for example

<select>

   <xsl:for-each select="//docs">
    <option value="<xsl:value-of select="docvalue"/>">
               <xsl:value-of select="title"/>
       </option>
   </xsl:for-each>
</select>

Is there any way or the best way to do this? currently what I have is not working.

 
Old September 25th, 2008, 08:11 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Use an attribute value template
Code:
<option value="{docvalue}">
  <xsl:value-of select="title"/>
</option>
or create an attribute
Code:
<option>
  <xsl:attribute name="value">
    <xsl:value-of select="docvalue"/>
  </xsl:attribute>
  <xsl:value-of select="title"/>
</option>
--
  Martin Honnen
  Microsoft MVP - XML
 
Old September 25th, 2008, 08:27 AM
Authorized User
 
Join Date: Sep 2008
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post
Default

thanks alot that worked. before I was trying it wil {$document} and not just {document}






Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl:param and xsl:apply-templates' "select" newbieboobers XSLT 1 March 25th, 2008 07:23 PM
wrap a select option nerssi HTML Code Clinic 0 June 16th, 2007 07:43 AM
disable Select option Dj Kat HTML Code Clinic 2 March 10th, 2006 04:03 AM
Select/Option Problem TSEROOGY Javascript 2 October 4th, 2004 03:32 PM
Getting select option name not value mildge Javascript How-To 2 April 5th, 2004 10:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.