using xsl for dropdown

Discussion in 'ASP General' started by bic, Jan 16, 2010.

  1. bic

    bic Guest

    Hi,

    I am trying to use xsl output for my asp.net and have gotten as far as
    displaying xml control OK. How do I change it to a dropdown using the
    lastname, and when selected I want to have all elements displayed on the
    page. Thanks in advance.

    --this is my asp.net file----------------------

    <%@ Page Language="C#" AutoEventWireup="True" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Import Namespace="System.Xml.Xsl" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html >
    <script runat="server">
    void Page_Load(Object sender, EventArgs e)
    {
    XmlDocument doc = new XmlDocument();
    doc.Load(Server.MapPath("people.xml"));

    XslTransform trans = new XslTransform();
    trans.Load(Server.MapPath("peopletable.xsl"));

    xml1.Document = doc;
    xml1.Transform = trans;
    }
    </script>
    <head runat="server">
    <title>Xml Class Example</title>
    </head>
    <body>
    <h3>Xml Example</h3>
    <form id="form1" runat="server">
    <asp:Xml id="xml1" runat="server" />
    </form>
    </body>
    </html>


    --this is my xsl file----------------------

    <?xml version="1.0" encoding="utf-8"?>

    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/People">
    <xsl:apply-templates select="Person" />
    </xsl:template>

    <xsl:template match="Person">
    <table width="100%" border="1">
    <tr>
    <td>
    <b>
    <xsl:value-of select="Name/FirstName" />

    <xsl:value-of select="Name/LastName" />
    </b>
    </td>
    </tr>
    <tr>
    <td>
    <xsl:value-of select="Address/Street" /><br />
    <xsl:value-of select="Address/City" />
    ,
    <xsl:value-of select="Address/State" />
    <xsl:value-of select="Address/Zip" />
    </td>
    </tr>
    <tr>
    <td>
    Job Title: <xsl:value-of select="Job/Title" /><br />
    Description: <xsl:value-of select="Job/Description" />
    </td>
    </tr>
    </table>
    </xsl:template>

    </xsl:stylesheet>


    --this is my xml file------------------
    <?xml version="1.0" encoding="utf-8" ?>
    <People>
    <Person>
    <Name>
    <FirstName>Joe</FirstName>
    <LastName>Suits</LastName>
    </Name>
    <Address>
    <Street>1800 Success Way</Street>
    <City>Redmond</City>
    <State>WA</State>
    <ZipCode>98052</ZipCode>
    </Address>
    <Job>
    <Title>CEO</Title>
    <Description>Wears the nice suit</Description>
    </Job>
    </Person>
    </People>
     
    bic, Jan 16, 2010
    #1
    1. Advertisements

  2. bic

    Bob Barrows Guest

    ***canned wrong-newsgroup reply************************
    There was no way for you to know it (except maybe by browsing through some
    of the previous questions in this newsgroup before posting yours - always a
    recommended practice) , but this is a classic (COM-based) asp newsgroup.
    ASP.Net bears very little resemblance to classic ASP so, while you may be
    lucky enough to find a dotnet-knowledgeable person here who can answer your
    question, you can eliminate the luck factor by posting your question to a
    group where those dotnet-knowledgeable people hang out. I suggest
    microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.
    ******************************************************************
     
    Bob Barrows, Jan 16, 2010
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...