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 January 20th, 2010, 01:40 PM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question XSLT - Lookup/Dropdownlist selected value

Good day, i making changes in an xslt file.

I have a dropdown on my aspx page with values "Yes & No"
I need to get the selected value to set a var.

I cant seem to get it going, I can return the "Value" but it does give me the selected value
it returns "Yes/No"
Below is what i tried & what i got returned, please help
Code:
<xsl:value-of select="Value" />  =   "Yes/No"
<xsl:value-of select="@Name" /> = nothing
<xsl:value-of select="Description" /> = "Description"
<xsl:value-of select="@selectedOption" /> = nothing
<xsl:value-of select="selectedOption" disable-output-escaping="yes" /> = nothing
<xsl:value-of select="selected" disable-output-escaping="yes" /> = nothing
Object
Code:
<xsl:templatename="ListValueType">
<xsl:paramname="Name" />
<xsl:paramname="Attributes" />
<xsl:paramname="Options" />
<xsl:paramname="Value" />
<xsl:elementname="asp:dropdownlist">
<xsl:attributename='id'><xsl:value-ofselect='$Name' /></xsl:attribute> 
<xsl:attributename='runat'>server</xsl:attribute> 
<xsl:for-eachselect="$Attributes/Attribute">
<xsl:attributename='{@name}'><xsl:value-ofselect='.' /></xsl:attribute>
</xsl:for-each>
<xsl:for-eachselect='$Value/Options/Option'>
<xsl:elementname="asp:ListItem">
<xsl:attributename='Value'><xsl:value-ofselect='.' /></xsl:attribute>
<xsl:iftest="@selected[. = 'true']"><xsl:attributename='selected'>true</xsl:attribute></xsl:if>
<xsl:value-ofselect='.' />
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
 
Old January 20th, 2010, 02:14 PM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question

I dont understand, in the aspx page i can test for the value beinvg Yes or No

With the value being "Yes" this is the output:

Code:
     <select name="VE1060NewSupplier" id="VE1060NewSupplier">
 <option selected="selected" value=""></option>
 <option value="Yes">Yes</option>
 <option value="No">No</option>
</select>
 
Old January 20th, 2010, 02:25 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

XSLT takes some input, usually in the form of an XML document, and produces some output in the form of XML or HTML or plain text.
If you show us the XML input you have and then show the corresponding output you want to create then we can help write the XSLT code to achieve that.
If you have some XSLT code that is not doing what you want you can also post the input you have, the output you want, the output you get, and the XSLT code you have, but you need to post minimal but complete samples that allow us to reproduce the problem.

I am afraid so far I can't tell what exactly it is that you want to achieve with XSLT and what problem exactly you face. And you don't make it easy to understand your problem and your code if you don't post readable and usable code: in your XSLT sample there are a lot of spaces missing that make it very hard to read it and make it impossible to use and test the code without heavily editing it first.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old January 20th, 2010, 02:34 PM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question

Thank You

Unfortunately I'm really new to this, All i know is that the aspx page loads the xslt stylesheet & i'm trying to make changes in the xslt file.

I searched on the site (server) & can't find the xml files.

Regards
 
Old January 20th, 2010, 04:20 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I searched on the site (server) & can't find the xml files.

I don't think you should be making any changes to an existing application if you have so little understanding of how it works.

We can't tell you how it works: we don't know.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old January 21st, 2010, 02:19 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thank You for helping





Similar Threads
Thread Thread Starter Forum Replies Last Post
find the selected index of the dropdownlist suneet.pant ASP.NET 2.0 Basics 0 May 22nd, 2008 03:45 AM
DropDownList, DataSource and Selected Items kingroon ASP.NET 2.0 Basics 2 February 25th, 2008 10:41 AM
read the selected value of DropDownList from VBScr dbayona ASP.NET 2.0 Professional 0 November 11th, 2007 06:16 PM
DropDownList Selected Index = -1?? dorothee ASP.NET 1.0 and 1.1 Basics 4 June 11th, 2004 03:08 AM
selected value from dropdownlist control netwizard_01 ASP.NET 1.0 and 1.1 Basics 3 January 20th, 2004 09:29 AM





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