????? ????? ?????? "????? ???" ????? ?????? ?? Visual Studio .NET ?? Visual Studio 2005

?????? ????????? ?????? ?????????
???? ???????: 315903 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ??????? ?????? XML - ????? ???? ???? ??? Xml .NET ?????? ????? "????? ???" ???????? ????? ?????? ???? ???? ???????? ??? ??????? ??????? (XML). ?? ????? ??????? ??????? ?? Visual Basic .NET ?? 2005 Visual Basic. ?????? ??????? ???? ????? Visual C# ?? ?????? ?????? ????? ????? ?????? ???????? ???????.

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • Microsoft Windows 2000 Professional ?? ???? ??????? Microsoft Windows 2000 Server Microsoft Windows XP Professional ?? Microsoft Windows XP Server ?? Microsoft .NET Framework ? Microsoft Visual Studio .NET ?????
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • ????? ???????
  • XML ? ????? ??? ????? ??????? ??????? (XSLT)
  • ????? ???? ???? ??? Microsoft .NET

????? ????? ??? ASP.NET ????? ??????

?? ??????? ??????? ?????? ???? ??????? ????? ??? ASP.NET ???? ???? ?????? ????? ??????? ?????? ???????? ??? ??? ???????. ?????? ????? ?????? ??????? ???? ???? ???? ????? Xml ????? XML ???? ????? ??? ?????? ??????? ??? ???? ??? XSL ?????? ?????? XML. ???? ??? XsltArgumentList ?? ????? ????? System.Xml.Xsl ?????? ???????? ?? ??????? ???.
  1. ????? ????? Visual Basic ????? Windows ??? ???:
    1. ??? ????? Microsoft Visual Studio .NET ?? Microsoft Visual Studio 2005 ?? ???? ??? ????? ????.
    2. ??? ????? Project ? ???? ??? ?????? Visual Basic. ??? ????? ? ???? ??? ????? ??? ASP.NET. ????? ????? ??????? ??????? ?? ???? ??? ?????.

      ?????? ?? Visual Studio 2005 ? ???? ??? Visual Basic ??? ????? Project.
  2. ???? ?? ???? ???? "?????? ??????". ??? ?? ??? ???? ?????? ???????? CTRL + ALT + L.
  3. ???? ???? shell ????? ????? ??? 2005 Visual Basic ?? Visual Basic .NET ???? ?? ???? ?????. ???? ??? ?? ????? ?????? ??? ????? Visual C# "??? ?????".

    ?? ???? ???? ?????? Windows? ???? ??? ?????? ?????? ??? ????? ? ??? ??? ????? ? ?? ???? ??? ????? ????. ??? ????? Project ? ???? ??? Visual C# ????????. ??? ????? ? ???? ??? ????? ??????. ???????? ????? ????????? ClassLibrary1. ???? ??? ????? ?????? ??? "????? ??????" ??? ????.

    ?????? ?? Visual Studio 2005 ? ???? ??? Visual C# ??? ????? Project.
  4. ???? Class1.cs ?? ???? ????. ????? ????? ????? ????? ?????? ??? ???? ??? ??????:
    using System.Xml.Xsl;
    					
  5. ??? Class1 ?????? ?????? ???????? ???????? ???????:
    public XsltArgumentList CreateArgumentList(
    string ParamName, string NamespaceURI, string ParamValue)
    {
     XsltArgumentList tal = new XsltArgumentList();
     tal.AddParam(ParamName, NamespaceURI, ParamValue);
     return tal;
    }
    					
  6. ???? ???? Visual C# ??? ???? ???? ??????? ??????? XSLT ?????? ???? ??? XsltArgumentList. ????? ???? ????? ????? Visual Basic ???? ??? ?????? ??? ??????.

    ??? ?? ???? WebForm1.aspx ?????? ?? Design View ??????. ??? ?? ??? ???? ????? ??????? ??? WebForm1.aspx ?? ???? "?????? ??????". ???? ??? ????? ??????? ????? ???? ???? ???? ??????? ??? "????? ??? ???????".
  7. ???? ??????? F4 ?????? ??? ???? ???????. ????? ????? pageLayout ??? FlowLayout.
  8. ?? "????? ???" ???? "??????? ???????? ??????":.
  9. ????? ???? ???? ???? ?? ???? ???? ?? ??????? Xml ??? ??????? ??? ???:
    1. ???? ?????? ???????? CTRL + ALT + X ???? ???? ???????.
    2. ?? ???? ???????? ???? ??? ????? ???.
    3. ???? ???? ???? ???? ?? "?" ???? ???? ?? ?? ???? ??????? ?????? ????? ?????? ??? ??? ????? ?????.
    4. ???? F4 ?????? ??? ???? ??????? ????? ?????? ??.
    5. ????? ??????? Text ??? ????? ???????.
    6. ?? ??? ?????? ??? ???? ??? ?? ???? ENTER ???? ?????? ????? ?????? Xml.
    7. ???? ???? ???? ???? ??? Xml ?? ???? ??????? ???????? ???? ?????? ??? ??? "????? ???".
    8. ???? F4 ?????? ??? ???? ????? ???? ?????? Xml.
    9. ????? ????? DocumentSource ??? Menu.xml ?? ?? ?????? ??????? TransformSource ??? Menu.xslt.
  10. ???? ????? ??????? ??? ????? ????? ????? ????? ??? ???? ?? ??? ??????? ????????? ???????? ?? "????? ???". ??? ????? ????????? ???????? ??? ??????? ??? ????? ???? ??? Visual C# "??? ?????" ??? ???:
    1. ?? ???? "?????? ??????" ??? ClassLibrary1 ???? ??? ?????? ?????? ??? ????? ??? ?? ???? ??? ????? ????.
    2. ??? ????? ??????? "????????" ? ???? ????? ??????? ??? ClassLibrary1. ???? ???? ClassLibrary1 ?? ???? ??????? ???????? ???????.
    3. ???? ??? ?????. ???? ???? ClassLibrary1 ??? ????? ?? "????? ???".
  11. ????? ????????? ???????? ??????? ??? ????? ??????? ???:
    Dim myArgList As New ClassLibrary1.Class1()
    Xml1.TransformArgumentList = myArgList.CreateArgumentList("calories", "", TextBox1.Text)
    Xml1.Visible = True
    						
    ????? ??????? ???? ???? Visual C# ???? ?? ?????? ???? ???? ???? ???? ?? ?????? ??? ????? ???????. ?????? ??? ???? ????? XSLT ????? ????? ?????? ???? ????? ??????? ???? ?????? ??????? ?? ???? ??? ????? ???????. ????? ?????? ?? ????????? ???????? ?? ????? ??????? ???? ????? ???? ??????? ???????:
    <xsl:for-each select="lunch-menu/food[calories <= $calories]">
    					
  12. ??????? ????????? ???????? ?? Menu.xml ?????? Menu.xslt ?????? Menu.xml ?????? Menu.xslt. ?? ???? "?????? ??????" ? ???? ??? ?????? ?????? ??? ??????? ??????? ?? ?? ?????? .xslt ?????? .xml.

????? ??? ????????? ????????

Menu.xml

<?xml version='1.0'?>
<lunch-menu>
  <food>
    <name>Cheese Pizza</name>
    <price>$6.95</price>
    <description>Individual deep-dish pizza with lots of mozzarella cheese</description>
    <calories>800</calories>
  </food>
  <food>
    <name>Pepperoni Pizza</name>
    <price>$7.95</price>
    <description>Individual deep-dish cheese pizza with thick-cut pepperoni slices</description>
    <calories>950</calories>
  </food>
  <food>
    <name>The "Everything" Pizza</name>
    <price>$9.95</price>
    <description>Individual deep-dish pizza with all our toppings. House specialty!</description>
    <calories>800</calories>  </food>
  <food>
    <name>Hungarian Ghoulash</name>
    <price>$4.50</price>
    <description>Large serving in a sourdough bread bowl. A_local delight!</description>
    <calories>600</calories>
  </food>
  <food>
    <name>Maisey's Pork Sandwich</name>
    <price>$6.95</price>
    <description>A fresh pork fillet, deep-fried to perfection. Served with fries.</description>
    <calories>950</calories>
  </food>
</lunch-menu>
				

Menu.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="calories">1500</xsl:param>
  <xsl:template match="/">
    <HTML>
      <BODY STYLE="font-family:Arial, helvetica, sans-serif; font-size:12pt;
            background-color:#EEEEEE">
        <xsl:for-each select="lunch-menu/food[calories <= $calories]">
          <DIV STYLE="background-color:blue; color:white; padding:4px">
            <SPAN STYLE="font-weight:bold; color:white"><xsl:value-of select="name"/></SPAN>
            - <xsl:value-of select="price"/>
          </DIV>
          <DIV STYLE="margin-left:20px; margin-bottom:1em; font-size:10pt">
            <xsl:value-of select="description"/>
            <SPAN STYLE="font-style:italic">
              (<xsl:value-of select="calories"/> calories per serving)
            </SPAN>
          </DIV>
        </xsl:for-each>
      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>
				

WebForm1.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="menu.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
  </HEAD>
  <body >

    <form id="Form1" method="post" runat="server">
<P>Maximum Calories: 
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Filter menu"></asp:Button></P>
<P>
<asp:Xml id="Xml1" runat="server" DocumentSource="menu.xml" TransformSource="menu.xslt"></asp:Xml></P>

    </form>

  </body>
</HTML>
				

???? ????? ??? Class1.cs

using System;
using System.Xml.Xsl;

namespace ClassLibrary1
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    public class Class1
    {
        public XsltArgumentList CreateArgumentList(
        string ParamName, string NamespaceURI, string ParamValue)
        {
            XsltArgumentList tal = new XsltArgumentList();
            tal.AddParam(ParamName, NamespaceURI, ParamValue);
            return tal;
        }
    }
}
				

System.Web.UI.Page ????? WebForm1.vb

Imports System.Xml.Xsl

Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents Xml1 As System.Web.UI.WebControls.Xml

#Region " Web Form Designer Generated Code "

    'The Web Form Designer requires this call.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: The Web Form Designer requires this method call.
        'Do not use the Code editor to modify it.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        'Insert user code to initialize the page here.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
        Dim tal As New XsltArgumentList()
        tal.AddParam("calories", "", TextBox1.Text)
        Xml1.TransformArgumentList = tal
        Xml1.Visible = True
    End Sub
End Class
				

???? ????? Class1.cs

using System;
using System.Xml.Xsl;

namespace ClassLibrary1
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    public class Class1 : System.Web.UI.Page
    {
        public XsltArgumentList CreateArgumentList(
        string ParamName, string NamespaceURI, string ParamValue)
        {
            XsltArgumentList tal = new XsltArgumentList();
            tal.AddParam(ParamName, NamespaceURI, ParamValue);
            return tal;
        }
    }
}
				

ClassLibrary1 ????? WebForm1.vb

Imports System.Xml.Xsl

Public Class WebForm1
    Inherits ClassLibrary1.Class1
    Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents Xml1 As System.Web.UI.WebControls.Xml

#Region " Web Form Designer Generated Code "

    'The Web Form Designer requires this call.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: The Web Form Designer requires this method call.
        'Do not use the Code editor to modify it.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        'Insert user code to initialize the page here.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    Xml1.TransformArgumentList = CreateArgumentList("calories", "", TextBox1.Text)
        Xml1.Visible = True
    End Sub
End Class
				

???? ?? ???? ?? ???

  1. ???? ??????? F5 ?????? ??????? ?? ??? ???????.
  2. ???? ??????? ??????? ???? ???????. ???? ?????? ???? ??????? ??? ????.
  3. ?? ???? ????? ???? ??? ??????? ???????? ?? ???? ??? ????? ???????. ???? ???? ????? ??????? ???? ??? ?? ?? ????? ??? ??????? ??????? ???.
  4. ???? ?????? ???????? SHIFT + F5 ????? ????? "?" ?????? ??? Visual Studio.

????? ??? ????? ????? ??????

??? ???? ????? ????? ?????? ????? ????? ?????? ??????? ???????. ????? ?? ????? ???? ?? "????? ??????" ??? ??????? ???? ?? ????? ??? Visual Basic .NET ??? ??????? ????????? ????????.

??? ??? ??????? ??? ????? System.Web.UI.Page ??????. ???? ?? ????? Microsoft .NET ????? ?????? ??? ???? ??? ????? ????? ?????? ??? ??? Visual C#.
  1. ????? ???? ??? ????? ????? System.Web ?? "????? ??????" ??? ????? ?? Visual C# ????????? ????????.
  2. ?? ???? "?????? ??????" ??? ClassLibrary1 ???? ??? ?????? ?????? ??? ????? ??? ?? ???? ??? ????? ????.
  3. ??? ????? ??????? .NET ? ???? ????? ??????? ??? System.Web.dll. ???? ???? System.Web.dll ?? ???? ??????? ???????? ???????.
  4. ???? ??? ?????. ???? ???? System.Web ??? ????? ?? "????? ??????".
  5. ????? ????? Class1 ?? ??? ????? ??????:
    public class Class1 : System.Web.UI.Page
    					
  6. ??? ??????? ????????? ???????? Visual Basic .NET ?? Visual Basic 2005 ???? ???? ?? ??? Class1. ???? ??? Class1 ??? ?????? ? ??? ????? ??????? ????????? ???????? ????? ??? ?????? ???? ??????? ?? Class1.

    ?? ???? "????" ? ???? ??? WebForm1.aspx.vb. ??? ????? ??? ??????? System.Web.UI.PageClassLibrary1.Class. ??? ?? ???? ??? ??????? ??? ???:
    Inherits ClassLibrary1.Class1
    					
  7. ??????? ?????? ????? ????? ?? ????? ??????? ???? ??? ???:
    'Dim myArgList As New ClassLibrary1.Class1()
    					
  8. ????? ????? ?????? ?? ????? ??????? ???? ?? ???? ??????? CreateArgumentList ???? ???? ????:
    Xml1.TransformArgumentList = CreateArgumentList("calories", "", TextBox1.Text)
    					
  9. ??? ??????? ?? ?????? Verify That It Works.

??????? ??????? ????????

  • ??? ????? ?? ????? ??? ????? ???? ??? ???? ??????. ?? ???? Visual C# ???? ?????? ???? ???? ?????. ????? ??? ???? ????? ????? Visual C# .NET ??? ????? ???? ?? ??????? ??? ???? ????? ??? Visual Basic .NET. ???????? ??? ???????? ????????? ???? ??? "??? ???????" ?? Microsoft .NET Framework ????? ?????? ??????? (SDK):
    ??????? ?????
    http://msdn2.microsoft.com/en-us/library/czz35az4(vs.71).aspx
  • ??? ??? ???? ?? ??????? ????? ????? ?????? ????? ????? ????? ?? ?? ???? ???????? ????? ??????? ??????. ??? ????? ?? ??? ????????? ???????? ?? ????? ????? ???? ????? ??? ??? ?? "????? ??????". ?? ??? ?????????? ?? ??? ??????? ??????? ?? "????? ??????" ????? ?????? ??????. ??? ???? ??????? ???? ????? ???? ??? ??????? ??????? ?? ??????? ClassLibrary1. ???? ????? ????? ???????:
    ???? ????? ???? ??? '?????'. ???? ????? ??? ??????? ????? ????? ??????.

?????

????? ?? ?????????? ???? ??? ????? Microsoft ??????? ??? ?????:
Instincts ????????: ??????? ????? ?? .NET ??? 1
http://msdn.microsoft.com/en-us/magazine/cc135806.aspx

Instincts ????????: ??????? ????? ?? .NET ??? 2
http://msdn.microsoft.com/en-us/magazine/cc301744.aspx

XML ????????
http://msdn.microsoft.com/en-us/xml/bb291077.aspx

???? ???? ???? ??? Xml
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gnconxmlwebservercontrol.asp

?????? XML-???
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/comsrv2k/htm/cs_tp_bizdesk_nqok.asp

???????

???? ???????: 315903 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 5.8
????? ???
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
  • Microsoft Visual Basic 2005
????? ??????: 
kbnosurvey kbarchive kbmt kbvs2005swept kbvs2005applies kbhowtomaster KB315903 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????315903

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com