You are on page 1of 33

c   

   
               
   

 



Employee
Ename
Empid
Designation
Email
Address
Employee

Note :- make entry for at least 10 employees.


 
<?xml version="1.0" encoding="UTF-8"?>

<employees>
<employee>
<ename>Abhinav</ename>
<empid>1</empid>
<salary>12000</salary>
<designation>DBA</designation>
<email>reddevil@gmail.com</email>
<address>Devendra Nagar</address>
</employee>
<employee>
<ename>Abhishek</ename>
<empid>2</empid>
<salary>20000</salary>
<designation>DBA</designation>
<email>akakmisra@gmail.com</email>
<address>Pandri</address>
</employee>
<employee>
<ename>Amit</ename>
<empid>3</empid>
<salary>10000</salary>
<designation>Network Admin</designation>
<email>jain2111@yahoo.co.in</email>
<address>Dhamtari</address>
</employee>
<employee>
<ename>Irshad</ename>
<empid>4</empid>
<salary>10000</salary>
<designation>DBA</designation>
<email>monto911@gmail.com</email>
<address>Devendra Nagar</address>
</employee>
<employee>
<ename>Nikunj</ename>
<empid>21</empid>
<salary>30000</salary>
<designation>Developer</designation>
<email>nikunjrathod77@gmail.com</email>
<address>Shri Nagar</address>
</employee>
<employee>
<ename>Ritesh</ename>
<empid>12</empid>
<salary>12000</salary>
<designation>Network Admin</designation>
<email>riteshu@gmail.com</email>
<address>Ashram Road</address>
</employee>
<employee>
<ename>Mandeep</ename>
<empid>19</empid>
<salary>35000</salary>
<designation>MD</designation>
<email>mandeep263@gmail.com</email>
<address>Shr Ram Nagar</address>
</employee>
<employee>
<ename>Bhavdeep</ename>
<empid>7</empid>
<salary>12000</salary>
<designation>Network Administrator</designation>
<email>bhavdeepdua@gmail.com</email>
<address>Shyam Nagar</address>
</employee>
<employee>
<ename>Shivani</ename>
<empid>14</empid>
<salary>12000</salary>
<designation>Networking</designation>
<email>mandavi@gmail.com</email>
<address>Khamtrai</address>
</employee>
<employee>
<ename>Sandeep</ename>
<empid>22</empid>
<salary>12000</salary>
<designation>Hacker</designation>
<email>sandeepkhatik7@gmail.com</email>
<address>Shyam Nagar</address>
</employee>
</employees>
Î  
 
c 
 
  !
  

 



 
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT employees (employee*)>
<!ELEMENT employee (ename,empid,salary,designation,email,address)>
<!ELEMENT ename (#PCDATA)>
<!ELEMENT empid (#PCDATA)>
<!ELEMENT salary (#PCDATA)>
<!ELEMENT designation (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT address (#PCDATA)>

Î  



c"  
 
  !
   

# 

1.Ename must contain only alphabets and must not exceed 20 characters.
2. Empid must start with the initials emp.
3. salary must not contain alphabets should not be negative and should be on 5 digit figure only.
4.Email must contain @ and only.com suffix.


 


 
  !!
 
<?xml version="1.0" encoding="UTF-8"?>
<Employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:///C:/Documents%20and%20Settings/SysAdmin/Desktop/Final/S
econd(2).xsd">
<empid>emp1</empid>
<name>nikunj</name>
<salary>50000</salary>
<email>nikunjrathod@yahoo.com</email>
</Employee>


 
 !
  !
 

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="first">
<xs:restriction base="xs:string">
<xs:minLength value="4"/>
<xs:pattern value="([e][m][p])([0-9])*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="second">
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
<xs:pattern value="([a-z])*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="third">
<xs:restriction base="xs:integer">
<xs:totalDigits value="5"/>
<xs:pattern value="([0-9])*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="four">
<xs:restriction base="xs:string">
<xs:pattern value="([a-z])*([@])([a-z])*([.][c][o][m])"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="Employee">
<xs:complexType>
<xs:sequence>
<xs:element name="empid" type="first"/>
<xs:element name="name" type="second"/>
<xs:element name="salary" type="third"/>
<xs:element name="email" type="four"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


Î  






c$ 
 
!   
%

J xml version="1.0" 
Jfood_list
Jfood_item type="vegetable"
JnameAgarJname
Jcarbs_per_serving1Jcarbs_per_serving
Jfiber_per_servingJfiber_per_serving
Jfat_per_serving0.5Jfat_per_serving
Jkj_per_serving120Jkj_per_serving
Jfood_item
Jfood_item type="vegetable"
JnameAsparagusJname
Jcarbs_per_serving1Jcarbs_per_serving
Jfiber_per_serving1Jfiber_per_serving
Jfat_per_serving0Jfat_per_serving
Jkj_per_serving40Jkj_per_serving
Jfood_item
Jfood_item type="vegetable"
JnameabbageJname
Jcarbs_per_serving0Jcarbs_per_serving
Jfiber_per_serving1Jfiber_per_serving
Jfat_per_serving0Jfat_per_serving
Jkj_per_serving14Jkj_per_serving
Jfood_item
Jfood_item type="vegetable"
JnameotatoJname
Jcarbs_per_serving21.5Jcarbs_per_serving
Jfiber_per_serving2Jfiber_per_serving
Jfat_per_serving1Jfat_per_serving
Jkj_per_serving460Jkj_per_serving
Jfood_item
Jfood_item type="vegetable"
JnameumpkinJname
Jcarbs_per_serving6Jcarbs_per_serving
Jfiber_per_serving1Jfiber_per_serving
Jfat_per_serving0.5Jfat_per_serving
Jkj_per_serving150Jkj_per_serving
Jfood_item
Jfood_item type="vegetable"
JnameamJname
Jcarbs_per_serving30.5Jcarbs_per_serving
Jfiber_per_serving2Jfiber_per_serving
Jfat_per_serving0.5Jfat_per_serving
Jkj_per_serving550Jkj_per_serving
Jfood_item
Jfood_item type="vegetable"
JnameucchiniJname
Jcarbs_per_serving1.5Jcarbs_per_serving
Jfiber_per_serving1.5Jfiber_per_serving
Jfat_per_serving0.5Jfat_per_serving
Jkj_per_serving55Jkj_per_serving
Jfood_item
Jfood_item type="seafood"
JnameAbaloneJname
Jcarbs_per_serving0Jcarbs_per_serving
Jfiber_per_serving0Jfiber_per_serving
Jfat_per_serving1Jfat_per_serving
Jkj_per_serving400Jkj_per_serving
Jfood_item
Jfood_item type="seafood"
JnamearramundiJname
Jcarbs_per_serving0Jcarbs_per_serving
Jfiber_per_serving0Jfiber_per_serving
Jfat_per_serving2Jfat_per_serving
Jkj_per_serving390Jkj_per_serving
Jfood_item
Jfood_item type="fruit"
JnameAppleJname
Jcarbs_per_serving15Jcarbs_per_serving
Jfiber_per_serving2.5Jfiber_per_serving
Jfat_per_serving0Jfat_per_serving
Jkj_per_serving250Jkj_per_serving
Jfood_item
Jfood_item type="fruit"
Jname iwi FruitJname
Jcarbs_per_serving
.5Jcarbs_per_serving
Jfiber_per_serving2.5Jfiber_per_serving
Jfat_per_serving0Jfat_per_serving
Jkj_per_serving150Jkj_per_serving
Jfood_item
Jfood_item type="grain"
Jname atbranJname
Jcarbs_per_serving62Jcarbs_per_serving
Jfiber_per_serving14Jfiber_per_serving
Jfat_per_serving
Jfat_per_serving
Jkj_per_serving1400Jkj_per_serving
Jfood_item
Jfood_item type="grain"
Jname heatgermJname
Jcarbs_per_serving1.5Jcarbs_per_serving
Jfiber_per_serving1Jfiber_per_serving
Jfat_per_serving0.5Jfat_per_serving
Jkj_per_serving
0Jkj_per_serving
Jfood_item
Jfood_list

# 

1. create a file as food.xslt and retrieve the information according to the food item type mentioned.
2. retrieve the kj_per_serving from food type seafood in ascending order in tabular format.
3. Retrieve the name from food type grain in descending order or as specified in tabular format.
4. Retrieve only the name, carbs_per_serving and kj_per_serving for all food types as grain.


 

1. <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:template match="food_list">
<table border="2" bgcolor="skyblue" align="center">
<tr align="center">
<th>Food Type</th>
<th>Name</th>
<th>Carbs Per Serving</th>
<th>Fiber Per Serving</th>
<th>Fiber Per Serving</th>
<th>KG Per Serving</th>
</tr>
<xsl:for-each select="food_item">
<tr align="center">
<td>
<xsl:value-of select="@type"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="carbs_per_serving"/>
</td>
<td>
<xsl:value-of select="fiber_per_serving"/>
</td>
<td>
<xsl:value-of select="fat_per_serving"/>
</td>
<td>
<xsl:value-of select="kj_per_serving"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

2. <?xml version="1.0" encoding="UTF-8"?>


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="food_list">
<center><h2>Sorting in assending order When Food Type is Seafood</h2></center>
<table border="2" bgcolor="navyblue" align="center">
<tr>
<th>Name</th>
<th>Kj Per Seving</th>
</tr>
<xsl:for-each select="food_item">
<xsl:sort select="kj_per_serving" order="ascending"/>
<xsl:if test="@type='seafood'">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td align="center">
<xsl:value-of select="kj_per_serving"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<center><h2>Sorting in desending order When Food Type is Grain</h2></center>

3. <table border="2" bgcolor="navyblue" align="center">


<tr>
<th>Name</th>
<th>Kj Per Seving</th>
</tr>
<xsl:for-each select="food_item">
<xsl:sort select="name" order="descending"/>
<xsl:if test="@type='grain'">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td align="center">
<xsl:value-of select="kj_per_serving"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

4.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="food_list">
<table border="2" bgcolor="navyblue" align="center">
<tr>
<th>Name</th>
<th>Kj Per Seving</th>
<th>carbs Per Seving</th>
</tr>
<xsl:for-each select="food_item">

<xsl:if test="@type='grain'">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td align="center">
<xsl:value-of select="kj_per_serving"/>
</td>
<td align="center">
<xsl:value-of select="carbs_per_serving"/>
</td>
</tr>

</xsl:if>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

#%






  



 

 









c&
 
 
  
%
ooks
ook bk_id
Name
Subject
ublication
rice {200,300,500,400,
00,1100,2300,450,1500}
ooks

# 
1. Dake entry for at least 10 books.
2. Retrieve the name price and subject information either in ascending or descending order of id.
3. Retrieve the name and price of only those books whose price lies between 500 to 1000.
4. Retrieve the complete information about the book based on the maximum and minimum price
5. erform all the validation for the data wherever requied


 

1.
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 sp1 (http://www.altova.com) by end user (free.org) -->
<?xml:stylesheet type="text/xsl" href="Fifth.xslt"?>
<Books>
<Book type="Java">
<Book_Id>101</Book_Id>
<Name>Jaishwal</Name>
<Subject>Java</Subject>
<Publication>2000</Publication>
<Price>600</Price>
</Book>
<Book type="Java">
<Book_Id>102</Book_Id>
<Name>Goyal</Name>
<Subject>XML</Subject>
<Publication>2002</Publication>
<Publication>2002</Publication>
<Price>1100</Price>
</Book>
<Book type="Java">
<Book_Id>103</Book_Id>
<Name>P.K. Gupta</Name>
<Subject>O.R.</Subject>
<Publication>1990</Publication>
<Price>5500</Price>
</Book>
<Book type="Java">
<Book_Id>104</Book_Id>
<Name>Peterson</Name>
<Subject>A.I.</Subject>
<Publication>1995</Publication>
<Price>300</Price>
</Book>
<Book type="Java">
<Book_Id>105</Book_Id>
<Name>Rozer Precmen</Name>
<Subject>S.E.</Subject>
<Publication>1999</Publication>
<Price>950</Price>
</Book>
<Book type="Java">
<Book_Id>106</Book_Id>
<Name>Jaiveher Khan</Name>
<Subject>D.W.H.</Subject>
<Publication>1997</Publication>
<Price>750</Price>
</Book>
<Book type="Java">
<Book_Id>107</Book_Id>
<Name>Bala Guruswami</Name>
<Subject>C++</Subject>
<Publication>2001</Publication>
<Price>400</Price>
</Book>
<Book type="Java">
<Book_Id>108</Book_Id>
<Name>Pilipsh</Name>
<Subject>P.O.M.</Subject>
<Publication>2003</Publication>
<Price>360</Price>
</Book>
<Book type="Java">
<Book_Id>109</Book_Id>
<Name>Mukhrjee</Name>
<Subject>P.M.</Subject>
<Publication>2006</Publication>
<Price>800</Price>
</Book>
<Book type="Java">
<Book_Id>110</Book_Id>
<Name>Gupta</Name>
<Subject>HTML</Subject>
<Publication>2007</Publication>
<Price>990</Price>
</Book>
</Books>

<?xml version="1.0" encoding="UTF-8"?>


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<font face="Arial" size="-3">
<center>
2. <h1>Asecnding Order</h1>
</center>
<table border="2" bgcolor="navyblue" align="center">
<tr>
<th>Book_ID</th>
<th>Name</th>
<th>Subject</th>
<th>Price</th>
</tr>
<xsl:for-each select="Books/Book">
<xsl:sort select="@Book_Id" order="ascending"/>
<tr>
<td>
<xsl:value-of select="Book_Id"/>
</td>
<td>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="Subject"/>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
</tr>
</xsl:for-each>
</table>
</font>
<font face="Arial" size="-3">
<center>
<h1>Desending Order</h1>
</center>
<table border="2" bgcolor="navyblue" align="center">
<tr>
<th>Book_ID</th>
<th>Name</th>
<th>Subject</th>
<th>Price</th>
</tr>
<xsl:for-each select="Books/Book">
<xsl:sort select="@Book_Id" order="descending"/>
<tr>
<td>
<xsl:value-of select="Book_Id"/>
</td>
<td>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="Subject"/>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
</tr>
</xsl:for-each>
</table>
</font>
3. <h2>Book Price Lessthen 500 And Greterthen 1000</h2>
<table border="2" bgcolor="navyblue" align="center">
<tr>
<th>Name</th>
<th>Price</th>
</tr>
<xsl:for-each select="Books/Book">

<xsl:if test="Price&gt;500 and Price&lt;1000">


<tr>
<td>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<h2><center>Book Price Lessthen 500 And Greterthen 1000</center></h2>
<h2><center>Minimum Price</center></h2>
<table border="2" bgcolor="navyblue" align="center">
<tr>
<td>Book_Id</td>
<th>Name</th>
<th>Subject</th>
<th>Publication</th>
<th>Price</th>
</tr>
4. <xsl:for-each select="Books/Book">
<xsl:sort select="Price" data-type="number" order="ascending"/>
<xsl:if test="position()=1">

<tr>
<td>
<xsl:value-of select="Book_Id"/>
</td>
<td>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="Subject"/>
</td>
<td>
<xsl:value-of select="Publication"/>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>

<h2><center>Maximum Price</center></h2>
<table border="2" bgcolor="navyblue" align="center">
<tr>
<td>Book_Id</td>
<th>Name</th>
<th>Subject</th>
<th>Publication</th>
<th>Price</th>
</tr>
<xsl:for-each select="Books/Book">
<xsl:sort select="Price" data-type="number" order="descending"/>
<xsl:if test="position()=1">

<tr>
<td>
<xsl:value-of select="Book_Id"/>
</td>
<td>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="Subject"/>
</td>
<td>
<xsl:value-of select="Publication"/>
</td>
<td>
<xsl:value-of select="Price"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

5.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Books">
<xs:complexType>
<xs:sequence>
<xs:element name="Book_Id" type="xs:integer"/>
<xs:element name="Book_Name" type="xs:string"/>
<xs:element name="Subject" type="xs:string"/>
<xs:element name="Publication" type="xs:string"/>
<xs:element name="Price" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Î  
c'() 
 (*)   

  

roducts
roductname
rice
ompany
Description
Quantity
roducts
()# %
roductname
{
Font-family:Arial
Font-size:20 points
Font-weight:bold
olor:red
Display:block
adding-top:6pt
adding-bottom:6pt
}
rice, ompany, Description, Quantity
{
Font-family: Times Roman
Font-size: 10 pints
Font-weight:bold
olor: blue
Display:block
adding-top:3pt
adding-bottom:3pt
}


 

The xml file for the above problem

<?xml version="1.0" encoding="UTF-8"?>


<?xml:stylesheet type="text/xsl" href="product.xslt"?>
<Products>
<Productname>CD</Productname>
<Price>500</Price>
<Company>sony</Company>
<Description>write_a_data</Description>
<Quantity>50</Quantity>
</Products>

The xsl file for the above css

<?xml version="1.0" encoding="UTF-8"?>


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="Products">
<div style="Font-family:Arial;Font-size:20 points;Font-
weight:bold;Color:red;Display:block;Padding-top:6pt;Padding-bottom:6pt">
<xsl:value-of select="Productname"/>
</div>
<div style="Font-family: Times Roman; Font-size: 10 pints;Font-weight:bold; Color: blue;
Display:block; Padding-top:3pt; Padding-bottom:3pt">
<br>Price : <xsl:value-of select="Price"/></br>
<br>Company : <xsl:value-of select="Company"/></br>
<br>Description : <xsl:value-of select="Description"/></br>
<br>Quantity : <xsl:value-of select="Quantity"/></br>
</div>
</xsl:template>
</xsl:stylesheet>



Î  




  




 





























c+#   
      
 (*)  
 
 ,- -
 . 
 

 
 

           
 
  / -  0-  

1     !
   
 
 !
     
     


JSummary
Jproduct Id=´´ Name=´´ price=´´
J rder Id=´´
Jship_addJship_add
JquantityJquantity
J rder
JSummary

# 
As per the problem statement the data to be displayed:-

1. productId, roduct Name, rice per Unit


2. Details about orders placed against the product are rder Number, Shipping Address, Total
Quantity, rderValue, total sales for the product.
3. Use Xath to perform the operations.
4. reate XSLT to display the required data in a tabular format with different font color of the
column and data.
5. Insert atleast 10 Records.


 


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="shop.xsl"?>
<summary>
<product id="1" name="monitor" price="4400"/>
<product id="2" name="mouse" price="400"/>
<product id="5" name="cabinet" price="1500"/>
<product id="8" name="hard disk" price="3400"/>
<product id="9" name="RAM" price="1200"/>
<product id="3" name="SMPS" price="600"/>
<product id="7" name="DVD-Drive" price="4400"/>
<product id="4" name="floppy drive" price="600"/>
<product id="6" name="USB " price="900"/>
<product id="10" name="external harddisk" price="3200"/>

<order id="101">
<ship_add>Bihar</ship_add>
<quantity>33</quantity>
</order>

<order id="102">
<ship_add>UP</ship_add>
<quantity>12</quantity>
</order>

<order id="103">
<ship_add>gujrat</ship_add>
<quantity>77</quantity>
</order>

<order id="106">
<ship_add>maharastra</ship_add>
<quantity>88</quantity>
</order>

<order id="109">
<ship_add>hariyana</ship_add>
<quantity>76</quantity>
</order>

<order id="111">
<ship_add>Delhi</ship_add>
<quantity>92</quantity>
</order>

<order id="114">
<ship_add>Mumbai</ship_add>
<quantity>65</quantity>
</order>

<order id="115">
<ship_add>goa</ship_add>
<quantity>85</quantity>
</order>

<order id="117">
<ship_add>bangal</ship_add>
<quantity>100</quantity>
</order>

<order id="130">
<ship_add>Chennai</ship_add>
<quantity>55</quantity>
</order>

</summary>


1!

 
 !



<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">
<html><head><title>Products Sample</title>
</head>
<body>
<xsl:apply-templates/>
<xsl:apply-templates select="order">
<xsl:sort select="id" order="ascending"/>
</xsl:apply-templates>
</body></html>
</xsl:template>

<xsl:template match="summary">
<xsl:text disable-output-escaping="yes">
&lt;li&gt;

</xsl:text>

<table border="2">
<caption align="bottom">Product Table</caption>
<tbody>
<tr bgcolor="green">
<th>Product Id</th>
<th>Product Name</th>
<th>Product Price</th>
</tr>
<xsl:for-each select="product">
<tr bgcolor="blue">
<font color="green">
<td > <b><xsl:value-of select="@id"/></b></td>
<td> <b><xsl:value-of select="@name"/></b></td>
<td><b><xsl:value-of select="@price"/></b></td>
</font>
</tr>
</xsl:for-each>
</tbody>
</table>

<table border="1">
<caption align="bottom">Order Details</caption>
<tbody>
<tr>
<th>Order Id</th>
<th>Shipping Address</th>
<th>Quantity</th>
</tr>
<xsl:for-each select="order">
<tr bgcolor="#ECF1EF">
<th><b><xsl:value-of select="@id"/></b><br/></th>
<th><b><xsl:value-of select="ship_add"/></b><br/></th>
<th><b><xsl:value-of select="quantity"/></b><br/></th>
</tr>
</xsl:for-each>
</tbody>
</table><br/>
<pre><b>The total shiping value is<xsl:value-of select="sum(//@price)"></xsl:value-of></b></pre>
</xsl:template>
</xsl:stylesheet>
Î  

























c23!


%
JEmployeedata
JEmployee
JEmpNameJEmpName
JAddress
JResidenceJResidence
JAddress
JSalaryJSalary
JEmployee
JEmployeedata

# 
1. reate an html file using the D D model that navigats through all the records of Employee.xml
and prints the data for an individual employee using ActiveX bject.
2. Insert atleast 5 Records.
3. rovide validation for the data wherever required.


 


<?xml version="1.0" encoding="UTF-8"?>
<Employeedata>
<Employee type="It">
<EmpName>Nikunj Rathod</EmpName>
<Address>
<Residence>Shri Nagar</Residence>
</Address>
<Salary>30000</Salary>
</Employee>
<Employee type="mba">
<EmpName>Devendra Jangde</EmpName>
<Address>
<Residence>Ravan Bhata</Residence>
</Address>
<Salary>30000</Salary>
</Employee>
<Employee type="Networking">
<EmpName>Sandeep Khatik</EmpName>
<Address>
<Residence>Telibandha</Residence>
</Address>
<Salary>25000</Salary>
</Employee>
<Employee type="DBA">
<EmpName>Abhishek Kumar</EmpName>
<Address>
<Residence>Pandari</Residence>
</Address>
<Salary>30000</Salary>
</Employee>
<Employee type="Desiner">
<EmpName>Ritesh Shrivastav</EmpName>
<Address>
<Residence>Ashram Road</Residence>
</Address>
<Salary>30000</Salary>
</Employee>
</Employeedata>


3*) 
   0!(#4

Jhtml

Jhead

Jscript langugage="JavaScript"

function one()

var xml_doc = new ActiveX bject("Dsxml2.D DDocument");

xml_doc.async = false;

var i,j;

xml_doc.load("Eight.xml");

var comment1=xml_doc.documentElement.childNodes.item(1).childNodes.item(2).text;

var num1=comment1.length;

for(i=0;iJ=num1-1;i++)

for(j=0;jJ=2;j++)

comment = xml_doc.documentElement.childNodes.item(i).childNodes.item(j).text;

var num = comment.length;

document.write(comment+'\n');

Jscript

Jhead
Jbody onload="one()"

Jbody

Jhtml

 
 
 

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="ENTER_NAME_OF_ROOT_ELEMENT_HERE">
<xs:complexType>
<xs:sequence>
<xs:element name="EmpName" type="xs:string"/>
<xs:element name="Residence" type="xs:string"/>
<xs:element name="Salary" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Î  





c53!




JStudentInfo
JStudent
JNameJName
JityJity
JStudent
JStudentInfo

# 
1. reate an xml file containing the appropriate data for the elements defined above.
2. rite an html file that uses XDL property of DomDocument bject and adds a new element
node called D  and Email to first Student element, it also appends a new node to Student fully.
3. Run the .html file to see the updated XDL script in out put..


 


 

<?xml version="1.0" encoding="UTF-8"?>
<StudentInfo>
<Student>
<Name>Nikunj</Name>
<City>Raipur</City>
</Student>
</StudentInfo>



 

<html>
<head>
<script language="javascript">
function one()
{
var obj=new ActiveXObject("Msxml2.DOMDocument");
obj.load("Nine.xml");
var root=obj.documentElement;
var elem=obj.createElement("DOB");
elem.text="10.02.1987";
root.childNodes.item(0).insertBefore(elem,root.childNodes.item(0).lastChild);
var elem=obj.createElement("Email");
elem.text="nikunjrockstar@yahoo.com";
root.childNodes.item(0).insertBefore(elem,root.childNodes.item(0).lastChild);
alert(obj.xml);
}
</script>
</head>
<body onload="one()">
</body>
</html>

Î  





c 63!




J xml version=´1.0´ encoding=´IS -59-1´ 


Jbookstore
Jbook category=´ ING´
Jtitle lang=´en´Everyday ItalianJtitle
JauthorGiada De LaurentiisJauthor
Jyear2005Jyear
Jbook
Jbook category=´ ILDERN´
Jtitle lang=´en´ arry otterJtitle
JauthorJ RowlingJauthor
Jyear2005Jyear
Jprice29.99Jprice
Jbook
Jbook category =´ E´
Jbook
Jbook category=´ E´
Jtitle lang=´en´XQueary ick StartJtitle
JauthorJames DcGovernJauthor
Jauthorer othnerJauthor
Jauthor url agleJauthor
JauthorJames LinnJauthor
JauthorVaidyanathan NagarajanJauthor
Jyear2003Jyear
Jprice49.99Jprice
Jbook
Jbook category=´ E´
Jtitle lang=´en´Learning XDLJtitle
JauthorErik T. RayJauthor
Jyear2003Jyear
Jprice39.95Jprice
Jbook

# 
1. rite an Xath script that iterate through each title element and prints them in separate line.


 

Jhtml
Jhead
Jscript type="textjavascript" src="loadxmldoc.js"Jscript
Jhead
Jbody
Jscript type="textjavascript"
xmlDoc=loadXDLDoc("books.xml");
for(i=0;iJ=4;i++)
{
x=xmlDoc.getElementsyTagName("title")[i]
y=x.childNodes[0];
document.write("\n"+y.nodeValue);
document.write(" \n ");
}
Jscript
Jbody
Jhtml

#%