[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Newbie Question with @value

Subject: Re: Newbie Question with @value
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Mar 2006 15:11:04 -0500
asp listitem world countries
At 2006-03-28 14:58 -0500, Falls, Travis D (HTSC, CASD) wrote:
I have the following XSLT which is from an example:
...
                                                <xsl:if test="@type='radio'">

<asp:RadioButtonList id="{@name}" runat="server">

<xsl:for-each select="choice">

<asp:ListItem Value="{@value}">

<xsl:value-of select="@value"/>

</asp:ListItem>

</xsl:for-each>

</asp:RadioButtonList>
...
I have the following XML file:
<?xml version="1.0" encoding="utf-8"?>
<survey name="Example Survey">
        <question type="text" name="Title" required="yes"/>
        <question type="text" name="Industry"/>
        <question type="radio" name="Education">
                <choice>High School</choice>
                <choice>Some College</choice>
                <choice>College</choice>
        </question>
</survey>

and I get the following output
...
                      <asp:RadioButtonList id="Education" runat="server">
                                <asp:ListItem Value=""></asp:ListItem>
                                <asp:ListItem Value=""></asp:ListItem>
                                <asp:ListItem Value=""></asp:ListItem>
                        </asp:RadioButtonList>
..
my question is why isn't the Value or Text of the ListItem being filled in?

I don't see any attributes named value= in your source XML.


I can't seem to put 2 and 2 together here.

The stylesheet is addressing a value attribute using "@value", and yet your XML element with @type='radio' does not have a value= specification. And it is not an error in XPath to address something that isn't there ... you just get the empty string.


I hope this helps.

. . . . . . . Ken

--
Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.