XML VALUE BIND IN ASP.NET USIN XSLT(XML CONTROL)
Xmlàxslt--àaspx
Product.xml
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<product>
<product_id>1</product_id>
<Productname>bata</Productname>
<Productdes>Shoe 123 Desd</Productdes>
<Image>/image/2309210image2.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Createdby>admin</Createdby>
<uom>1</uom>
<OpeningStock>2</OpeningStock>
<OpeningDate>2013-11-11T00:00:00+05:30</OpeningDate>
<ClosingStock>14</ClosingStock>
<ClosingDate>2013-11-11T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>10</product_id>
<Productname>Glasses</Productname>
<Productdes>Fast track</Productdes>
<Image>/image/822984029577406797735Car.jpg</Image>
<Price>6765</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>Fast track</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>11</product_id>
<Productname>Glasses</Productname>
<Productdes>Glasses</Productdes>
<Image>/image/83004058288584Jellyfish.jpg</Image>
<Price>456</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>Glasses</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>12</product_id>
<Productname>TShirt</Productname>
<Productdes>Description</Productdes>
<Image>/image/800690Koala.jpg</Image>
<Price>100</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>TShirt</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>13</product_id>
<Productname>TShirt Adidas</Productname>
<Productdes>TShirt Adidas Desc</Productdes>
<Image>/image/5672546Koala.jpg</Image>
<Price>100</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>TShirt Adidas</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>14</product_id>
<Productname>Shoe123</Productname>
<Productdes>aaaaa</Productdes>
<Image>/image/9476495Koala.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>15</product_id>
<Productname>ProductName</Productname>
<Productdes>descr</Productdes>
<Image>/image/377319329577406797735Car.jpg</Image>
<Price>100</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>2</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>16</product_id>
<Productname>test</Productname>
<Productdes>test</Productdes>
<Image>/image/9514139image4.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>test</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>17</product_id>
<Productname>test1</Productname>
<Productdes>test</Productdes>
<Image>/image/3184058image4.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>test</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>18</product_id>
<Productname>test1</Productname>
<Productdes>test</Productdes>
<Image>/image/2143022image4.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>test</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>19</product_id>
<Productname>new</Productname>
<Productdes>new</Productdes>
<Image>/image/9441356image2.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>new</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>2</product_id>
<Productname>dice1</Productname>
<Productdes>Shoe 123 Desd</Productdes>
<Image>image/64733386797735Car.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Createdby>admin</Createdby>
<created>2013-12-05T00:00:00+05:30</created>
<uom>1</uom>
<OpeningStock>6</OpeningStock>
<OpeningDate>2013-11-11T00:00:00+05:30</OpeningDate>
<ClosingStock>160</ClosingStock>
<ClosingDate>2013-11-11T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>20</product_id>
<Productname>nike</Productname>
<Productdes>nike</Productdes>
<Image>/image/86933837319179image4.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-19T00:00:00+05:30</created>
<Brandname>nike</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>21</product_id>
<Productname>nike</Productname>
<Productdes>nike</Productdes>
<Image>/image/26031747319179image4.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-19T00:00:00+05:30</created>
<Brandname>nike</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>3</product_id>
<Productname>adidas</Productname>
<Productdes>adidas Desc</Productdes>
<Image>/image/74887847319179image4.jpg</Image>
<Price>100</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-13T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>1</uom>
<OpeningStock>10</OpeningStock>
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock>100</ClosingStock>
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>4</product_id>
<Productname>paragon</Productname>
<Productdes> adidas Description</Productdes>
<Image>/image/90989162309210image2.jpg</Image>
<Price>1000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-13T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>1</uom>
<OpeningStock>10</OpeningStock>
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock>50</ClosingStock>
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>5</product_id>
<Productname>slipper</Productname>
<Productdes>adidas</Productdes>
<Image>/image/189346729577406797735Car.jpg</Image>
<Price>70000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-16T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>1</uom>
<OpeningStock>10</OpeningStock>
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock>9</ClosingStock>
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>6</product_id>
<Productname>sss</Productname>
<Productdes />
<Image>/image/2194484image3.jpg</Image>
<Price>0</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-16T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>1</uom>
<OpeningStock>10</OpeningStock>
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock>50</ClosingStock>
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>7</product_id>
<Productname>dice</Productname>
<Productdes>adidas</Productdes>
<Image>/image/55343757319179image4.jpg</Image>
<Price>10</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-16T00:00:00+05:30</created>
<Brandname>adidas</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>8</product_id>
<Productname>TShirt</Productname>
<Productdes>TShirt Description</Productdes>
<Image>/image/189346729577406797735Car.jpg</Image>
<Price>100</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>BrandName</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
<product>
<product_id>9</product_id>
<Productname>shirt</Productname>
<Productdes>basics</Productdes>
<Image>/image/8288584Jellyfish.jpg</Image>
<Price>7000</Price>
<status>Yes</status>
<Modifiedby />
<Modified>1900-01-01T00:00:00+05:30</Modified>
<Createdby>admin</Createdby>
<created>2013-12-18T00:00:00+05:30</created>
<Brandname>basics</Brandname>
<uom>1</uom>
<OpeningStock />
<OpeningDate>1900-01-01T00:00:00+05:30</OpeningDate>
<ClosingStock />
<ClosingDate>1900-01-01T00:00:00+05:30</ClosingDate>
</product>
</NewDataSet>
Product.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<table border="1">
<tr>
<th>product_id</th>
<th>Productname</th>
<th>
Productdes
</th>
<th>
Image
</th>
<th>
Price
</th>
<th>
status
</th>
<th>
Createdby
</th>
<th>
created
</th>
<th>
uom
</th>
<th>
OpeningStock
</th>
<th>
OpeningDate
</th>
<th>
ClosingStock
</th>
<th> ClosingDate</th>
</tr>
<xsl:for-each select="NewDataSet/product">
<xsl:sort select="product_id" data-type="number"/>
<!--<xsl:if
test="product_id<'2'">-->
<tr>
<td>
<xsl:value-of select="product_id"/>
</td>
<td>
<xsl:value-of select="Productname"/>
</td>
<td>
<xsl:value-of select="Productdes"/>
</td>
<td valign="bottom" align="center">
<img>
<input
type="image" name="imagem" width="450px">
<xsl:attribute
name="src">
<xsl:value-of
select="image" />
</xsl:attribute>
</input>
</img>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
<td>
<xsl:value-of select="status"/>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
<td>
<xsl:value-of select="Createdby"/>
</td>
<td>
<xsl:value-of select=" created"/>
</td>
<td>
<xsl:value-of select="uom"/>
</td>
<td>
<xsl:value-of select="OpeningStock"/>
</td>
<td>
<xsl:value-of select="OpeningDate"/>
</td>
<td>
<xsl:value-of select=" ClosingStock"/>
</td>
<td>
<xsl:value-of select=" ClosingDate"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="xslt._default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
--%>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Xml ID="Xml1" DocumentSource="product.xml" TransformSource="product.xslt" runat="server" />
</form>
</body>
</html>
Default.aspx
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Xml.Xsl;
namespace xslt
{
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}