Source view of XML.ASPX
DotNet Funda: Code Viewer
xml.aspx | xml.aspx.cs
Close Window  

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr valign="top" class="ArticleTitle">
            <td style="padding-left:10px;" valign="middle">
                asp:Xml control</td>
        </tr>
        <tr>
            <td class="ArticleContents">
                Xml control is used to load and transform Xml document.
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
    <div class="ArticleContents">
        Xml control is used to load and transform XML document.
                
        Following are some important properties that are very useful.
        <table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
            <tr>
                <td class="DemoCP">DocumentSource</td>
                <td>
                    Path of the XML document to be used to write data.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">TransformSource</td>
                <td>
                    This must be a valid XSL Transform document. This is used to transform the XML document before its contents are written.
                </td>
            </tr>
        </table>
        <!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>
                <td class="DemoTitle">
                    DEMO : Xml
                </td>
                <td align="right">
                    <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/controls/xml.aspx" target="_blank">Show Source Code</a>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Xml ID="Xml1" runat="Server" 
                    DocumentSource="~/tutorials/controls/controldata/XMLFile.xml" 
                    TransformSource="~/tutorials/controls/controldata/XSLTFile.xsl"></asp:Xml>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <pre>
// Xml Control ///////////////////////////////////////////////////
&lt;asp:Xml ID="Xml1" runat="Server" DocumentSource="~/tutorials/controls/controldata/XMLFile.xml" TransformSource="~/tutorials/controls/controldata/XSLTFile.xsl"&gt;&lt;/asp:Xml&gt;

// XSL File //////////////////////////////////////////////////////
&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:template match="/DotNetFunda"&gt;
    &lt;xsl:apply-templates select="Writers" /&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="Writers"&gt;
  &lt;table style="border:1px solid #456789;" cellpadding="2" cellspacing="1" width="100%"&gt;
    &lt;tr aligh="left"&gt;
      &lt;td style="width:20%;"&gt;Name&lt;/td&gt;
      &lt;td&gt;
        &lt;xsl:value-of select="Name"/&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr aligh="left"&gt;
      &lt;td style="width:20%;"&gt;
        Place
      &lt;/td&gt;
      &lt;td&gt;
        &lt;xsl:value-of select="From"/&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt; 

// XML File //////////////////////////////////////////////////////
&lt;DotNetFunda&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Sheo Narayan&lt;/Name&gt;
    &lt;From&gt;Hyderabad, India&lt;/From&gt;
  &lt;/Writers&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Vijay Bandaru&lt;/Name&gt;
    &lt;From&gt;Virginia, USA&lt;/From&gt;
  &lt;/Writers&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Raheem Shaik&lt;/Name&gt;
    &lt;From&gt;New York, USA&lt;/From&gt;
  &lt;/Writers&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Jay Shankar&lt;/Name&gt;
    &lt;From&gt;Aurangabad, India&lt;/From&gt;
  &lt;/Writers&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Dr. Sunita Narayan&lt;/Name&gt;
    &lt;From&gt;Bokaro, India&lt;/From&gt;
  &lt;/Writers&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Sunil Kumar Prasad&lt;/Name&gt;
    &lt;From&gt;Ranchi, India&lt;/From&gt;
  &lt;/Writers&gt;
  &lt;Writers&gt;
    &lt;Name&gt;Sunita Shankar&lt;/Name&gt;
    &lt;From&gt;Daudnagar, India&lt;/From&gt;
  &lt;/Writers&gt;
&lt;/DotNetFunda&gt;

                   
                    </pre>
                </td>
            </tr>
        </table>
        <!-- END - Demo Section -->
        </div>
    <br />
    
    <script language="javascript" type="text/javascript">
        function GiveAlertToUser()
        {
            alert("Hi Dear, Client side method worked.");
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Go Top