Asp.net Xml control


asp:Xml control

XML control is used to load and transform XML documents.

DocumentSourcePath of the XML document to be used to write data.
TransformSourceThis should be a valid XSL transform document. Used to change the XML document before written content of its use.


NameNeha
PlaceMumbai
Namerohan
PlaceDelhi
Nameshivam
PlaceNoida delhi
NameEr. Vivek
Placebhopal, India

// Xml Control ///////////////////////////////////////////////////
<asp:Xml ID="Xml1" runat="Server" DocumentSource="~/tutorials/controls/controldata/XMLFile.xml" TransformSource="~/tutorials/controls/controldata/XSLTFile.xsl"></asp:Xml>

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

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

</xsl:stylesheet>

// XML File //////////////////////////////////////////////////////
<DotNetFunda>
  <Writers>
    <Name>Neha</Name>
    <From>Mumbai</From>
  </Writers>
  <Writers>
    <Name>rohan</Name>
    <From>Delhi</From>
  </Writers>
  <Writers>
    <Name>shivam</Name>
    <From>Noida delhi</From>
  </Writers>
  <Writers>
    <Name>Er. Vivek</Name>
    <From>bhopal, India</From>
  </Writers>

</DotNetFunda>




Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment