Today, I have published another article on fundamental of RAISERROR in SQL Server 2005. Its all about internal of RAISERROR, how to use it, sp_addmessage, use them inside TRY-CATCH etc. If you really interesed, Here is my complete article
Abhijit Jana
My New Article : Test Your ASP.NET WebServices using SOAP UI
Today I have published another article on Web Service Testing- Using SOAP UI. This is very important to test our web service before we moved it to production. Soap UI is one of the best tool for test any SOAP Request and Response. If have described the basick overview of that tool so that any one can start from scratch. If you are really intereseted, then please read my article complete here, Test You Web Service Using Soap UI
Please give your suggestion and feedback .
My New Article : Overview of Error in SQL Server 2005 Handling
Today I have published another article on Error Handling in SQL Server 2005. This is all about how we are going to handled errors and exception in T-SQL. I have described basic of @@ERROR and TRY-CATCH Block with proper example. If you are really intereseted, then please read my article here, Overview of Error Handling in SQL Server 2005
Please give your suggestion and feedback .
My New Article : Overview of VIEW in SQL Server 2005
Lastnight I have published another article on fundamental of SQL Server VIEW. Its all about View Creation, Use of View, Description of System View, Schema Binding with view and Encryption of View. If you really interesed, Here is my complete article Overview of View in SQL Server 2005 .
This is the Part 1. In the next part I will write on Parameterized View and Indexing of View
Please give your valuable suggestion and feedback.
Prize winner in Competition “Best ASP.NET article of June 2009”
I have own the first prize in the article competition for my article Debug Your ASP.NET Application that Hosted on IIS : Process Attach and Identify which process to attach.. This is second time in this year I have received the prizes from codeproject. Thanks to all of you who read my articles and vote for it.
I have published another article on Remote IIS Debugging in this month. Hope this will also help you.
Please give your suggestion and feedback to improve my articles. Thanks again.
My New Article : Debug your web application Hosted on Remote IIS
Lastnight I have published another article on debugging of ASP.NET article which hosted on Remote IIS Server. Its all about the how to msvsmon.exe and its configuration. If you really interesed, Here is my complete article Remote IIS Debugging : Debug your ASP.NET Application which is hosted on “Remote IIS Server”
Please give your valuable suggestion and feedback.
XSL Transformation : Rendering XML using XSL – HTML Output
Overview
Some times we need to display the XML data in our web application in specific format. XSLT provides the ability to display the XML document in some specific format like HTML, PDF etc. We can select a a XML file or a portion of XML File and using XSL Transformation we can display in some specific format.
An XSL transformation need an XML document to transform and an XSL style sheet describing how the transformation will take place. An XSLT engine then transforms the XML document via the XSL style sheet and will produce the output in the format specified by the style sheet.
How to Implement ?
1. Create Data Base :
Rather than reading the data from xml, I have read the data from database. First of all I have create an DB Student with table name “StudentDetails” . Table contain some dummy data like,
2. Add XSL File
Before, reading the data from database, we have to create the XSL file, We can add XSL file by just right click on the project > Add New Item >Select XSLT File
3. Desing XSL
Now, Designing XSL is one of the important task, and there are many things that related with XSL . In my case, this is very simple XSL, but if you need to learn in details, I will suggest you to read from W3School. First of all have a look into the XML data which I have got from the dataset.
And based on that we need to desing the XSL File. Below is the StudentDetails XSL
</span> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <table width="100%" align="center" cellpadding="0" cellspacing="0" border="1" style="background-color:#123456;font-family:verdana;font-size:10pt;border:1"> <tr> <td width="10%" align="left" > Roll</td> <td width="70%" align="left"> Name</td> <td width="20%" align="left"> Address</td> </tr> </table> <xsl:for-each select="Students/Table"> <table width="100%" align="center" cellpadding="0" cellspacing="0" border="1" style="font-family:verdana;font-size:10pt;border:1"> <tr > <td width="10%" align="left" > <xsl:value-of select="Roll"/></td> <td width="70%" align="left" > <xsl:value-of select="Name"/></td> <td width="20%" align="left" > <xsl:value-of select="Address"/></td> </tr> </table> </xsl:for-each> </xsl:template> </xsl:stylesheet> <span style="font-family: Verdana; font-size: x-small;">
Now, have a look into the code,
Read the data from database and put it into dataset. We can easily get the XML from dataset using.
string XMLString=ds.GetXml();
Below code is used to read data from database
public string strstudentDetails = string.Empty; protected void Page_Load(object sender, EventArgs e) { string _strConnectionString = "Data Source=.\\sqlexpress;Initial Catalog=Student;Integrated Security=True"; string _strquery = "select * from studentDetails"; SqlConnection con = new SqlConnection(_strConnectionString); DataSet ds = new DataSet("Students"); SqlDataAdapter da = new SqlDataAdapter(_strquery, con); da.Fill(ds); //Get the XML From DataSet string strXML = ds.GetXml(); strstudentDetails=GetHtml(Server.MapPath("~/xsl/studentDetails.xsl"), strXML); }
GetHtml function actually doing the job. Its taking XSL Stylesheet and XML data as parameter and returning the html output
/// <summary> /// Get HTML From XML and XSL /// </summary> /// <param name="xsltPath">XSL File Path</param> /// <param name="xml">XML String</param> /// <returns>HTML Output</returns> public static string GetHtml(string xsltPath, string xml) { MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(xml)); XPathDocument document = new XPathDocument(stream); StringWriter writer = new StringWriter(); XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(xsltPath); transform.Transform(document, null, writer); return writer.ToString(); } }
Now for displaying the result, we have to put following line in the aspx page,
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Student Page</title> </head> <body> <form id="form1" runat="server"> <div> <table > <tr> <td> <b>Student Info : Displying using XSL Rendering</b></td> </tr> <tr> <td> <%= strstudentDetails %></td> </tr> </table> </div> </form> </body> </html>
and the output like,
Hope this will help you to move ahead with XSL Transformation.
Thankyou
My CodeProject MVP Certificate
My Birth Day
Today , 22nd June is My Birth day.
Wish all of you all the best.
Thank you !!
My Recent Article :Debug Your ASP.NET Application that Hosted on IIS : Process Attach and Identify which process to attach
Ahh… After a long time, I have a published an article on Codeproject.
This article describe how to debug a web application which is hosted on IIS. It also describe how to select a particular process to attach with your application when multiple worker process are running. Please read details over here and give your suggestions and feedback
Thank you.
My New Dell Laptop
Recently I purchased a Dell Inspiron 1545 Notebook . The design by Dell is quite impressive as it has been released with different colors. I have go for BLUE. My Laptop configuration is 4 GB RAM, 320 GB HDD, C2D Processor and 1.3 MP Camera , OS Vista . Hmm.. along with that, got a Carry Case. I love this ….
New Domain for my blog
WoW… Today I have registered my blog with a new domain name.
First Prize winner in Competition “Best ASP.NET article of January 2009”
I have won the first prize for my “Exploring Session in ASP.NET” article in the month of January . Thanks to all for voting.
CodeProject MVP for 2009
5th Jan 2009, I have received an MVP Award for 2009 from Codeproject.com. And I really fill proud for that I was selected for Codeproject MVP 2009.
I have received an MVP Award from codeproject for the articles what ever I have written on codeprject and helps other developers through the forums.
Here is the some content of the mail that I have received from Chris Maunder , C0-Founder of Codeproject.com
From: Chris Maunder
Sent: Tuesday, January 06, 2009 5:37 AM
To: Abhijit Jana
Subject: Code Project MVP recognition
Hi Abhijit
Congratulations!
In recognition of your outstanding contributions to the community, either through the forums or through articles, you have been awarded CodeProject MVP status for 2009.
Your MVP status will be recognized through the MVP icon you will have next to your forum postings as well as a notice in your member profile. Also, as formal recognition of your award status we will be sending out certificates to all our MVPs ……..
Again, Thank you for all the help you have provided to the community.
cheers,
Chris Maunder
Co-founder
The Code Project
www.codeproject.com
Thanks you Chirs and Your Team .
I would also like to thanks all CP members and specially My Guru (Sacha barber ) , christian Graus and Navaneeth . I have learned a lot from all of them . They all are Rock !!!
And Finally , Codeproject You are Rock !!!