Webtechnologylabmanualpdf 240131072014 3b5b7428
Webtechnologylabmanualpdf 240131072014 3b5b7428
LABORATORY MANUAL
PREPARED BY
Mrs. K. M. Preethi
Teaching Assistant
1
22IT401 - WEB TECHNOLOGY
Course Objectives:
1. To understand different Internet Technologies
List of Experiments:
1.Create a web page with the following using HTML.
3. Client Side Scripts for Validating Web Form Controls using DHTML.
2
TABLE OF CONTENTS
4. Installation of Apache
Tomcatweb server.
3
Ex. No. : 1 CREATION OF IMAGE MAP TO FIX
HOTSPOTS
Date:
AIM
To create a webpage with image map to fix the hotspots and show its related
information.
SOFTWARE USED
DESCRIPTION
<area>is used with in the map element to define the clickable areas.
CODE
4
main.html
<html>
<head>
<BODYbgcolor="#gop6876cgdt5564ss">
<imgsrc="indiamap.jpeg"usemap="#indiamap" />
<mapname=indiamap>
<areashape="circle"coords="500,1092,15"href="tamilnadu.html"alt="Tamilnadu
">
<areashape="rect"coords="376,1076,406,1100"href="karnataka.html"alt="Karna
taka">
</map>
</head>
</BODY>
</html>
tamilnadu.html
<html>
<head><title>TanilNadu -India</title></head>
<bodybgcolor="palegreen">
<h1><center>TamilNadu</center></h1>
<h3>
<ul>
5
<li>Districts<i>-33</i>
<li>CapitalCity<i>-Chennai</i>
<li>LargestCity<i>-Chennai</i>
<li>Governor<i>-BanwarilalPurohit</i>
<li>ChiefMinister<i>-EdappadiK.Palaniswami</i>
<li>Population<i>-72,147,030</
</ul>
<ahref="main.html">back</a>
</body>
</html>
karnataka.html
<html>
<head><title>Karnataka-India</title></head>
<bodybgcolor="wheat">
<h1><center>Karnataka</center></h1>
<h3>
<ul>
<li>Districts<i>-30</i>
<li>CapitalCity<i>-Bangalore</i>
<li>LargestCity<i>-Bangalore</i>
<li>Governor<i>-VajubhaiVala</i>
6
<li>Population<i>-61,130,704</i>
<li>Touristspots<i>-GolGumbaz,MysorePalace,KeshavaTempleetc.,</i>
</ul>
</h3>
<ahref="main.html">back</a>
</body>
</html>
OUTPUT
7
RESULT
Thus the Web Page had been created using image map to fix the hotspots and
relevant information had been displayed.
8
Ex. No. : 2 CREATION OF WEB PAGE WITH ALL TYPES OF
Date: CASCADING STYLESHEETS
AIM
SOFTWARE USED
DESCRIPTION
Cascading Style Sheet (CSS) is used to set the style in web pages which contain
HTML elements. It sets the background color, font-size, font-family, color etc
property of elements in a web pages.
Inline CSS
Internal or Embedded CSS
External CSS
ALGORITHM
Internal CSS:
STEP 2: Inside the <style> tag, specify the format required for that web page
External CSS:
9
STEP 4: Open a notepad, type the needed CSS in it and save it with .css
extension. STEP5:Refer this .css file in the HTML using the tag<link>.
CODE
style.html
<html>
<head>
<title>FLOWERS</title>
<!--ExtendedStyleSheet-->
<linkrel="stylesheet"type="text/css"href="style.css">
<!--EmbedStyleSheet-->
<style type="text/css">p{
background-color:
lightgrey;text-align:justify; margin:2em7em;
</style>
</head>
<bodyid="body">
<h1>FLOWER</h1>
<p>
he flower is God's finest workmanship in the world.It is his finest gift to the
mankind.
10
We have seent he flowers of many kinds and to many colors.In India we see the
flowers like
</p>
<!--InlineSytleSheet-->
<tablestyle="background-position:center;text-align:center;padding:3px;">
<tr>
<tdalign="left">
<divclass="div">
<ul>
<li><ahref="">Lily</a></li>
<li><ahref="">Lotus</a></li>
<li><ahref="">Rose</a></li>
<li><ahref="">Jasmine</a></li>
</ul>
</div>
</td>
</tr>
</table>
</body>
</html>
style.css
h1,h2{
text-decoration: underline;font-style:italic;
text-align:center;
11
}
.div{ border:perusolid;
*{
letter-spacing:1px;
a:link{color
:black;
a:visited{colo r:yellow;
a:hover{color
:green;
a:active{col or:blue;
ul li{
font-size:small;
12
OUTPUT
RESULT
AIM
SOFTAREUSED
DESCRIPTION
DHTML stands for Dynamic HTML, it is totally different from HTML. The
browsers which support the dynamic HTML are some of the versions of
Netscape Navigator and Internet Explorer of version higher than 4.0. The
DHTML is based on the properties of the HTML, javascript, CSS, and DOM
(Document Object Model which is used to access individual elements of a
document) which helps in making dynamic content. It is the combination of
HTML, CSS, JS, and DOM. The DHTML make use of Dynamic
objectmodel to take changes in settings and also in properties and methods. It
also makes uses of Scripting and it is also part of earlier computing trends.
ALGORITHM
The form will include one text field called "Your Name ",and a submit button.
Validation script will ensure that the user enters their name before the form is
sent to the server.
Try pressing the Send Details button with out filling anything in the "Your
Name "field.
14
You might like to open the source code for this form in a separate window
CODE
<!DOCTYPEhtml>
<html>
<head>
<script>functionvalidate Form(){
var x =
</script>
</head>
<body>
<inputtype="submit"val ue="Submit">
</form>
</body>
</html>
15
OUTPUT
16
RESULT
17
Ex. No. : 4 INSTALLATION OF APACHE TOM CAT
Date: WEBSERVER
Alternatively, you can find tomcat via the Apache mother site
@http://www.apache.org.
Tomcat was originally written by James Duncan Davison (then working in Sun)
in 1998,based on an earlier Sun's server called Java Web Server (JWS). It began
at version 3.0 afterJWS2.1 it replaced. Sun sub sequently made Tomcat open-
source and gave it to Apache.
Tomcat3.0(1999):ReferenceImplementation(RI)forServlet 2.2andJSP1.1.
Tomcat 8.0 (Jun 2014): RI for Servlet 3.1, JSP 2.3, EL 3.0 and
WebSocket 1.0. Tomcat 8.5(June2016)supportsHTTP/2,
OpenSSL,TLSvirtual hostingand JASPIC 1.1.
Tomcat 9.0 (Jan 2018): RIfor Servlet 4.0, JSP 2.3, EL3.0, WebSocket 1.0,
JASPIC 1.1.
How to Install Tom cat and Get Started with Java Servlet Programming
18
STEP0:CreateaDirectory to Keep all your Works
I shall assume that you have created a directory called "c:\myWebProject" (for
Windows) or"~\myWebProject" (for Mac OS X) in your earlier exercises. Do it
otherwise. This step is important; otherwise, you will be out-of-sync with this
article and will not be able tofind your files later.
Take note of Your Tomcat Installed Directory. Hereafter, I shall refer to the
Tomcat installed directory as<TOMCAT_HOME>.
Tomcat's Sub-Directories
Take a quick look at the Tom cat installed directory. It contains the these sub-
directories bin: contains the binaries and scripts (e.g.,startup . bat and
shutdown. Bat for Windows; startup .sh and shutdown.sh for Unixes and
MacOS X).
conf:containsthesystem-
wideconfigurationfiles,suchasserver.xml,web.xml,andcontext.xml.
webapps:containsthewebappstobedeployed.YoucanalsoplacetheWAR(WebappAr
chive)filefor deployment here.
19
lib:containstheTomcat'ssystem-
widelibraryJARfiles,accessiblebyallwebapps.Youcouldalso place external JAR
file (such as MySQL JDBC Driver)here.
logs: contains Tomcat's log files. You may need to check for error messages
here. work: Tomcat's working directory used byJSP, forJSP-to-Servlet
conversion.
First, find your JDK installed directory. For JDK11, the defaultis " c:\Program
Files\Java\jdk- 11.0.{x}", where "{x} is the update number. Use your "File
Explorer" to find this directory and take note of your update number{x}.
Set JAVA_HOME
Launch"ControlPanel"⇒(Optional)"SystemandSecurity"⇒"System"⇒Click"Adv
ancedsystem settings" on the left pane.
Under "System Variables" (the bottom pane) ⇒ Click "New" (or Look for
"JAVA_HOME"and "Edit" if it is already set) ⇒ In "Variable Name", enter
"JAVA_HOME"
20
⇒ In "Variable Value", enter your JDK installed directory you noted in Step 1.
(In the latest Windows 10:you can push the "Browse Directory" button and
navigate to the JDK installed directory to avoid typo error.)
Set JAVA_HOME
STEP3:ConfiguretheTomcatServer
The Tomcat configuration files, in XML format, are located in the "conf" sub-
directory
ofyourTomcatinstalleddirectory,e.g."c:\myWebProject\tomcat\conf"(forWindow
s)or"~/myW
ebProject/tomcat/conf"(forMacOSX).Theimportantconfigurationfilesare:
Useaprogrammingtexteditor(e.g.,SublimeText,Atom)toopentheconfigurationfile
"server.xml".
The default TCP port number configured in Tomcat is 8080, you may choose
any number between 1024 and 65535, which is not used by existing
applications. We shall choose 9999 in this article. (For production server, you
should use port 80, which is pre-assigned to HTTP server as the default port
number.)
21
Locate the following lines (around Line 69) that define the HTTP connector,
and change port="8080"to port="9999".
/docs/config/http.htmlJava AJPConnector:
/docs/config/ajp.htmlAPR(HTTP/AJP)Conne ctor:/docs/apr.html
-->
Step3(b)"conf\web.xml" -EnableDirectoryListing
Weshallenabledirectorylistingbychanging"listings"from"false"to"true"forthe"de
fault"servlet. Thisis handyfortest system,but not forproduction
systemforsecurity.
Locatethefollowinglines(aroundLine108)thatdefinethe"default"servlet;andchang
ethe"listings" from"false"to"true".
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
22
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Step3(c)"conf\context.xml"-EnablingAutomaticReload
Locatethe<Context>startelement(aroundLine19),andchangeitto<Contextreloada
ble="true">.
<Contextreloadable="true">
......
......
</Context>
TheTomcat'sexecutableprogramsandscriptsarekeptinthe"bin"sub-
directoryoftheTomcatinstalled directory.
Step4(a)StartServer
ForWindows
IshallassumethatTomcatisinstalledin"c:\myWebProject\tomcat".LaunchaCMDsh
ellandissue: c: //Changedrive
23
Step4(b)Start a Client to Access the Server
Startabrowser(Firefox,Chrome)asanHTTPclient.IssueURL"http://localhost:9999
"toaccessthe
Tomcatserver'swelcomepage.Thehostname"localhost"(withIPaddressof127.0.0.1
)ismeantforlo calloop-back testing within the same machine. For users on the
other machines over the net, they have to use the server's IP address or DNS
domain name in the form of"http://serverHostnameOrIPAddress:9999".
(Optional)TryissuingURLhttp://localhost:9999/examplestoviewtheservletandJS
Pexamples.Tr y running some of the servlet examples.
Step4(c)ShutdownServer
For Windows
PressCtrl-ContheTomcatconsole;OR
Run"<TOMCAT_HOME>\bin\shutdown.bat"script.Openanew"cmd"andissue:
c://Changethecurrentdrive
cd\myWebProject\tomcat\bin//ChangedirectorytoyourTomcat'sbinarydirectory
shutdown//Runshutdown.battoshutdowntheserver
RESULT:
24
Ex. No. : 5 INVOKING SERVLETS FROM HTML
Date: FORMS-SESSION
TRACKING
AIM
SOFTWAREREQUIRED
Tomcat Server
DESCRIPTION
Cookies
HiddenFormField
URLRewriting
HttpSession
25
ALGORITHM
client.html
Create a web page using HTML form that contains the fields such as text,
password and one submit button.
Set the URL of the server as the value of form’s action attribute.
server.java
Define the class server that extends the property of the class Generic Servlet.
Handle the request from the client by using the method service() of Generic
Servlet class.
Get the parameter names from the HTML form by using the method get
ParameterNames().
Get the parameter values from the HTML forms by using the method get
Parameter().
Send the response to the client by using the method of Print Writer class.
CODE
index.html
<!DOCTYPEhtml>
<html>
<head>
<metacharset="ISO-8859-1">
<title>ServletLoginExample</title>
</head>
<body>
<h1>WelcometoLoginApp byCookie</h1>
26
<ahref="login.html">Login</a>|
<ahref="LogoutServlet">Logout</a>|
<ahref="ProfileServlet">Profile</a>
</body>
</html>
link.html
<ahref="login.html">Login</a>|
<ahref="LogoutServlet">Logout</a>|
<ahref="ProfileServlet">Profile</a>
<hr>
login.html
<formaction="LoginServlet"method="post">Name:<inputt
ype="text"name="name"><br>Password:<inputtype="pass
word"name="password"><br>
<inputtype="submit"value="login">
importjava.io.IOException;i mportjava.io.PrintWriter;
importjavax.servlet.ServletException;i mport
javax.servlet.http.Cookie;importjavax. servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;im port
javax.servlet.http.HttpServletResponse;publiccl ass
LoginServletextendsHttpServlet{
response.setContentType("text/html"); PrintWriterout=response.getWriter();
27
request.getRequestDispatcher("link.html").include(request,
response);Stringname=request.getParameter("name");
Stringpassword=request.getParameter("password");
}else{
out.print("sorry,
usernameorpassworderror!");request.getRequestDispatcher("login.html
").include(request,response);
out.close();
LogoutServlet.javapackage com.javatpoint;import
java.io.IOException;importjava.io.PrintWriter;
importjavax.servlet.ServletException;i
importjavax.servlet.http.HttpServletRequest;imp ort
javax.servlet.http.HttpServletResponse;publiccla ss LogoutServlet
extendsHttpServlet{
File:ProfileServlet.java
packagecom.javatpoint;
importjava.io.IOException;i mportjava.io.PrintWriter;
importjavax.servlet.ServletException;i mport
javax.servlet.http.Cookie;importjavax. servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;im port
javax.servlet.http.HttpServletResponse;publiccl
assProfileServletextendsHttpServlet{
response.setContentType("text/html"); PrintWriterout=response.getWriter();
request.getRequestDispatcher("link.html").include(request,
response);Cookieck[]=request.getCookies();
if(ck!=null){
out.print("<b>Welcome to Profile</b>");out.print("<br>Welcome,"
+name);
}else{
29
out.print("Pleaselogin
first");request.getRequestDispatcher("login.html").include(request,resp onse);
out.close();
web.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http:/
/java.sun. com/xml
/ns/javaee
http://java.sun.com/xml/ns/javaee/web-
app_2_5.xsd"id="WebApp_ID"version="2.5">
<servlet>
<description></description>
<display-name>LoginServlet</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.javatpoint.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet>
30
<description></description>
<display-name>ProfileServlet</display-name>
<servlet-name>ProfileServlet</servlet-name>
<servlet-class>com.javatpoint.ProfileServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProfileServlet</servlet-name>
<url-pattern>/ProfileServlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>LogoutServlet</display-name>
<servlet-name>LogoutServlet</servlet-name>
<servlet-class>com.javatpoint.LogoutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LogoutServlet</servlet-name>
<url-pattern>/LogoutServlet</url-pattern>
</servlet-mapping>
</web-app>
OUTPUT
31
RESULT
Thus a simple application has been created for invoking servlets from
HTML forms.
32
Ex. No. : 6 a) CREATION OF THREE-TIER
Date: APPLICATIONS USING JSP AND
DATABASES-FOR CONDUCTING ON-LINE
EXAMINATION
AIM
To create a three-tier application using JSP and Databases for the conduction of
online-examination.
SOFTWARE REQUIRED
TomcatServer
DESCRIPTION
Java Server Pages (JSP) is a technology that helps software developers create
dynamically generated web pages based on HTML, XML, or other document
types. Released in 1999 by Sun Micro systems, JSP is similar to PHP and ASP,
but it uses the Java programming language.
ALGORITHM
Set the URL of the server (ExamServer.jsp)as the value of the action attribute.
33
Use submit button to invoke the server and send the form data to the server.
Match the answers from the user with the correct answers from the database
table.
CODE
ExamServer.jsp:
<%@pagecontentType="text/html"language="java"import="java.sql.*"%>
<html>
<head>
<title>OnlineExamServer</title>
<styletype="text/css">
body{background-color:black;font-family:courier;color:blue}
</style>
</head>
<body>
<h2style="text-align:center">ONLINEEXAMINATION</h2>
<p>
<ahref="ExamClient.html">BackToMainPage</a>
</p>
<hr/>
34
<%
String
str1=request.getParameter("ans1");String
str2=request.getParameter("ans2");String
str3=request.getParameter("ans3");int
mark=0;Class.forName("sun.jdbc.odbc.Jd bcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:examDS");Statementst
mt=con.createStatement();
ResultSetrs=stmt.executeQuery("SELECT*FROMexamTab");in t i=1;
while(rs.next())
if(i==1)
mark=mark+5;
if(i==2)
mark=mark+5;
35
}
if(i==3)
String dbans3=rs.getString(1);
if(str3. equals(dbans3))
{
mark=mark+5;
}i+
+;
if(mark>=10)
out.println("<h4>YourMarkIs : "+mark+"</h4>");
else
out.println("<h4>YourMarkis:"+mark+"</h4>");
%>
</form>
</body>
36
</html>
ExamClient.HTML:
<html>
<head>
<title>OnlineExamClient</title>
<styletype="text/css">
body{background-color:black;font-family:courier;color:blue}
</style>
</head>
<body>
<h2style="text-align:center">ONLINEEXAMINATION</h2>
<h3>Answerthefollowingquestions(5marksfor eachcorrectanswer)</h3>
<hr/>
<formname="examForm"method="post"action="ExamServer.jsp">
Allcomputersmust have<br/>
<inputtype="radio"name="ans1"value="OperatingSystem">OperatingSystem
<inputtype="radio"name="ans1"value="ApplicationSoftware">ApplicationSoftw
are
<inputtype="radio"name="ans1"value="CD Drive">CDDrive
<inputtype="radio"name="ans1"value="Microsoftword">Microsoftword
<br/><br/>
<inputtype="radio"name="ans2"value="PrivateComputer">PrivateComputer
37
<inputtype="radio"name="ans2"value="ProfessionalComputer">ProfessionalCo
mputer
<inputtype="radio"name="ans2"value="PersonalComputer">PersonalComputer
<inputtype="radio"name="ans2"value="PersonalCalculator">PersonalCalculator
<br/><br/>
wasdevelopedby?<br/>
<inputtype="radio"name="ans3"value="Dennis Ritchie">DennisRitchie
<inputtype="radio"name="ans3"value="Stroustrup">Stroustrup
<inputtype="radio"name="ans3"value="David Ritchie">DavidRitchie
<inputtype="radio"name="ans3"value="Charles Babbage">CharlesBabbage
<br/><br/>
<inputtype="submit"value="CheckYourResult"/>
</form>
</body>
</html>
OUTPUT
38
RESULT
Thus a simple web application using JSP and Database had been created for the
conduction of online examination.
39
Ex. No. : 6 b) CREATIONOFTHREE-
Date: TIERAPPLICATIONSUSINGJSPAND
DATABASES-FOR DISPLAYING STUDENT
MARKLIST
AIM
To create a three-tier application using JSP and Databases for displaying the
student mark list.
SOFTWARE REQUIRED
TomcatServer
DESCRIPTION
Java Server Pages (JSP) is a technology that helps software developers create
dynamically generated web pages based on HTML, XML, or other document
types. Released in1999bySun Microsystems, JSP is similar to PHP and ASP
,but uses the Java programming language.
ALGORITHM
Set the URL of the server (marklist.jsp)as the value of the action attribute.
Use submit button to invoke the server and send the form data to the server.
Read the parameter value (Register Number) from the form by using the method
get Parameter().
40
Server retrieves the details from the database table with respect to the form
input.
CODE
marklist.jsp:
<%@pagecontentType="text/html"language="java"import="java.sql.*"%>
<html>
<head>
<title>ThreeTierApplication</title>
<styletype="text/css">
body{color:blue;font-family:courier;text-align:center}
</style>
</head>
<body>
<h2>EXAMINATIONRESULT</h2><hr/>
<%
String str=request.getParameter("regno");Class.forName("sun.jdbc.odbc.Jdb
cOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:markDS");Statementst
mt=con.createStatement(); ResultSetrs=stmt.executeQuery("SELECT*FROM
markTab WHERE rno="+str);while(rs.next())
%>
RegisterNo:<%=rs.getObject(1)%><br/> Name:<%=rs.getObject(2)%><br/>
<tableborder="1">
41
<th>SUBJECT</th><th>Mark</th>
<tr><td>Network Programming
andManagement</td><td><%=rs.getObject(3)%></td></tr>
<tr><td>ObjectOrientedAnalysisandDesign</td><td><%=rs.getObject(4)%></td
></tr>
<tr><td>CryptographyandNetworkSecurity</td><td><%=rs.getObject(5)%></td
></tr>
<tr><td>EmbeddedSystems</td><td><%=rs.getObject(6)%></td></tr>
<tr><td>WebTechnology</td><td><%=rs.getObject(7)%></td></tr>
<tr><td>SoftwareRequirementandEngineering</td><td><%=rs.getObject(8)%>
</td></tr>
</table>
<%
%>
<br/>
<ahref="stud.html">Back</a>
</body>
</html>
stud.html
<html>
<head>
<title>ThreeTierApplication</title>
<styletype="text/css">
42
body{color:blue;font-family:courier;text-align:center}
</style>
</head>
<body>
<h2>EXAMINATIONRESULT</h2><hr/>
<inputtype="submit"value="SUBMIT"/>
</form>
</body>
<html>
OUTPUT
43
RESULT
Thus a simple web application using JSP and Database had been created
displaying student mark list.
44
Ex. No. : 7 PROGRAMS USING XML–SCHEMA–
Date: XSLT/XSL
AIM
SOFTWAREREQUIRED
DESCRIPTION
In HTML documents, tags are predefined but in XML documents, tags are not
predefined. World Wide Web Consortium(W3C) developed XSL to understand
and style an XML document, which can act as XML based Style sheet
Language.
XSLT:It is a language for transforming XML documents into various other types
of documents.
45
ALGORITHM
Step1:Starttheprogram
CODE
CDCatalog.xml
<?xmlversion="1.0"encoding="ISO-8859-1"?>
<!--EditedbyXMLSpy® --><?xml-
stylesheettype="text/xsl"href="CDCatalog.xsl"?>
<catalog>
<cd>
<title>EmpireBurlesque</title>
<artist>BobDylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price><year>1985</year>
</cd>
<cd>
46
<title>Hideyourheart</title>
<artist>BonnieTyler</artist>
<country>UK</country>
<company>CBSRecords</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title>GreatestHits</title>
<artist>DollyParton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
</catalog>
CDCatalog.xsl
<?xmlversion="1.0"encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transfor
m">
<xsl:templatematch="/">
<html>
<body>
47
<h2>MyCD Collection</h2>
<tableborder="1">
<trbgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-eachselect="catalog/cd">
<xsl:sortselect="artist"/>
<tr>
<td><xsl:value-ofselect="title"/></td>
<td><xsl:value-ofselect="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
RESULT
Thus an XML application had been created to display CDC at a log using XSL.
48
49
50