xsl-list
[Top] [All Lists]

Re: [xsl] Newbie Question with @value

2006-03-28 13:11:43
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="{(_at_)name}" runat="server">

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

<asp:ListItem Value="{(_at_)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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>