ASP.NET - System.Xml, System.Xml.Xsl and System.Xml.XPath Namespace

System.Xml, System.Xml.Xsl, System.Xml.XPath Namespace

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml.XPath" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
    string xmlFilePath = Request.PhysicalApplicationPath + @"App_Data\ITBookList.xml";
    string xsltFilePath = Request.PhysicalApplicationPath + @"App_Data\ITBookList.xslt";
    XPathDocument xPathDoc = new XPathDocument(xmlFilePath);
    XslCompiledTransform transform = new XslCompiledTransform();
    transform.Transform(xPathDoc, null, Response.Output);
<html xmlns="" >
<head id="Head1" runat="server">
    <title>Using System.Xml, System.Xml.Xsl, System.Xml.XPath Namespace in</title>
    <form id="form1" runat="server">

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
  <xsl:output method="html"/>
  <xsl:template match="/">
        <title>XSLT document for display book list</title>
        <h2 style="color:DeepPink; font-style:italic;">How to use System.Xml, System.Xml.Xsl, System.Xml.XPath Namespace in</h2>
        <hr width="775" align="left" color="Pink" />
        <br />
        <table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
          <tr bgcolor="OrangeRed" style="color:White; font-weight:bold">
            <td>Book ID</td>
            <td align="center">Name of Book</td>
            <td>Name of Author</td>
            <td>Book Price</td>
          <xsl:for-each select="books/book">
            <tr bgcolor="Snow" style="color:Crimson; font-weight:normal; font-style:italic;">
              <td height="10" style="font-weight:bold;" align="center">
                <xsl:value-of select="id"/>
              <td height="10">
                <xsl:value-of select="name"/>
              <td height="10">
                <xsl:value-of select="author"/>
              <td height="10" style="font-weight:bold;" align="right">
                <xsl:value-of select="price"/>

<?xml version="1.0" ?>
<!-- Sample XML file for various XML, XSLT, XPath example-->
  <book Category="XML and XSLT">
    <name>Beginning XML Databases</name>
    <author>Gavin Powell</author>
  <book Category="">
    <name>ASP.NET 3.5 Website Programming: Problem - Design - Solution</name>
    <author>Chris Love</author>
  <book Category="">
    <name>jQuery for ASP.NET Developers</name>
    <author>Joe Brinkman</author>
  <book Category="">
    <name>ASP.NET MVC 1.0 Test Driven Development: Problem - Design - Solution</name>
    <author>Emad Ibrahim</author>
  <book Category="XML and XSLT">
    <name>Beginning XSLT and XPath: Transforming XML Documents and Data</name>
    <author>Ian Williams</author>
  <book Category="XML and XSLT">
    <name>XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition</name>
    <author>Michael Kay</author>
  <book Category="Database">
    <name>Professional Microsoft SQL Server 2008 Programming</name>
    <author>Robert Vieira </author>
More examples