xsl-list
[Top] [All Lists]

Re: [xsl] Newbie Question with @value

2006-03-28 13:11:23
                                                <xsl:if test="@type='radio'">
                                                        <asp:RadioButtonList 
id="{(_at_)name}" runat="server">
                                                                <xsl:for-each 
select="choice">
                                                                        
<asp:ListItem Value="{(_at_)value}">
             ^^^ where is the attribute value in your input xml on the
choice element?

                <choice>High School</choice>
                <choice>Some College</choice>
                <choice>College</choice>
                              ^^^ no attributes


my question is why isn't the Value or Text of the ListItem being filled in?  
I can't seem to put 2 and 2 together here.  Any links to help debug this 
would be greatly apprecated.  Thanks all.

What do you expect it to fill in?  There's no attribute called value
anywhere in your XML as far as I can tell.

You're going over each node that is a question (//question) and doing
some output based on the values of the type attribute (the various
<xsl:if test="@type='blah'>. For the radio buttons you're applying a
chunk of code to each choice element.  You're trying to grab the value
attribute (@value) two times in that code block.

I'm guessing what you want is the text value of the current node. 
(text value is perhaps a poor choice of words, but the value of
applying string to the various nodes as outlined in the Xpath and XSLT
specs). If you just want the value of the current node (ie choice) do
<asp:ListItem Value="{.}">
    <xsl:value-of select="."/>

...


see http://www.w3.org/TR/xslt#value-of

Jon Gorman

--~------------------------------------------------------------------
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>