xsl-list
[Top] [All Lists]

[xsl] Newbie Question with @value

2006-03-28 12:59:19
I have the following XSLT which is from an example:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:asp="remove">
        <xsl:output method="xml" indent="yes" encoding="utf-8" 
omit-xml-declaration="yes"/>
        <xsl:template match="/">
                <table>
                        <xsl:for-each select="//question">
                                <tr>
                                        <td valign="top">
                                                <xsl:value-of select="@name"/>
                                                <xsl:if test="@required = 
'yes'">
                                                        
<asp:RequiredFieldValidator ErrorMessage="Required Field" runat="server" 
ControlToValidate="{(_at_)name}"/>
                                                </xsl:if>
                                        </td>
                                        <td>
                                                <xsl:if test="@type='text'">
                                                        <asp:TextBox 
id="{(_at_)name}" runat="server"/>
                                                </xsl:if>
                                                <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>
                                                </xsl:if>
                                        </td>
                                </tr>
                        </xsl:for-each>
                </table>
                <asp:button id="submit" runat="server" Text="Submit"/>
        </xsl:template>
</xsl:stylesheet>

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 using XMLSpy (and with my C# code)
<table xmlns:asp="remove">
        <tr>
                <td valign="top">Title<asp:RequiredFieldValidator 
ErrorMessage="Required Field" runat="server" ControlToValidate="Title"/></td>
                <td>
                        <asp:TextBox id="Title" runat="server"/>
                </td>
        </tr>
        <tr>
                <td valign="top">Industry</td>
                <td>
                        <asp:TextBox id="Industry" runat="server"/>
                </td>
        </tr>
        <tr>
                <td valign="top">Education</td>
                <td>
                        <asp:RadioButtonList id="Education" runat="server">
                                <asp:ListItem Value=""></asp:ListItem>
                                <asp:ListItem Value=""></asp:ListItem>
                                <asp:ListItem Value=""></asp:ListItem>
                        </asp:RadioButtonList>
                </td>
        </tr>
</table>
<asp:button xmlns:asp="remove" id="submit" runat="server" Text="Submit"/>

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.

Travis D. Falls | Consultant   RAFT.Net   IT | 860.547.4070 | 
travis(_dot_)falls(_at_)thehartford(_dot_)com

Travis D. Falls | Consultant   RAFT.Net   IT | 860.547.4070 | 
travis(_dot_)falls(_at_)thehartford(_dot_)com


*************************************************************************
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*************************************************************************


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