0% found this document useful (0 votes)
75 views4 pages

3 XML DTD and XSLT

The document describes an assignment to design an XML document to store employee information and demonstrate using DTD, XML Schema, and CSS/XSL to display the content. Students will learn to create static webpages using XML and apply DTD and CSS/XSL to XML pages. The document provides details on XML, DTD, XSL, and steps to create and test XML applications using a text editor, browser, and Eclipse.

Uploaded by

shivali.mali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views4 pages

3 XML DTD and XSLT

The document describes an assignment to design an XML document to store employee information and demonstrate using DTD, XML Schema, and CSS/XSL to display the content. Students will learn to create static webpages using XML and apply DTD and CSS/XSL to XML pages. The document provides details on XML, DTD, XSL, and steps to create and test XML applications using a text editor, browser, and Eclipse.

Uploaded by

shivali.mali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TE Computer Web Technology Lab

Assignment No. : 3

Title: XML,DTD and CSS/XSL.

Design the XML document to store the information of the employees of any business
organization and demonstrate the use of:
a) DTD
b) XML Schema
And display the content in (e.g., tabular format) by using CSS/XSL

Students will be able to,


1. Design static webpage using XML.
2. Apply DTD to XML pages.
3. Apply CSS/XSLT to XML pages

Software Requirements:
1. Operating System: Windows 7/8/10/Ubuntu
2. Browser: Firefox/Google Chrome/ Microsoft Edge etc.
3. Software : Sublime Text editor/ Notepad/ Notepad++, Eclipse (for DTD)
Hardware Requirements:
1. Processor: Minimum 1 GHz.
2. Ethernet connection (LAN) OR a wireless adapter (Wi-Fi)
3. Hard Drive: Minimum 32 GB.
4. Memory (RAM): Minimum 1 GB
5. Sound card-speakers/camera/microphone (Depending upon website selection)

XML stands for Extensible Markup Language. It is nothing but the text-based
markup language which is derived from Standard Generalized Markup Language
(SGML). XML tags identify the data and are used to store and organize the data,
rather than specifying how to display it like HTML tags, which are used to display
the data. XML is not going to replace HTML in the near future, but it introduces

SNJB’s Late Sau K. B. Jain COE, Chandwad


TE Computer Web Technology Lab

new possibilities by adopting many successful features of HTML.


There are three important characteristics of XML that make it useful in a variety of
systems and Solutions:
1. XML is extensible − XML allows you to create your own self-descriptive tags, or
language, that suits your application.
2. XML carries the data, does not present it − XML allows you to store the data
irrespective of how it will be presented.
3. XML is a public standard − XML was developed by an organization called the World
Wide
Web Consortium (W3C) and is available as an open standard.

The XML document have an XML declaration, but it is optional, and it is written as−
<? xml version = "1.0" encoding = "UTF-8"?>

Where version is nothing but the version of an XML document and UTF specifies the
character- encoding used in the document. Each XML-element needs to be closed either
with start or with end elements as shown below −
<element>………</element>
An XML document can have only one root element.
XML Attributes:
Using a name/value pair, an attribute specifies a single property for an element. An
XML- element can have one or more attributes. For example −
<a href = "http://www.google.com/">XMLTutorial</a>
Here href is the attribute name and http://www.google.com/ is attribute value.

A DTD is a Document Type Definition. A DTD defines the structure and the legal
elements and attributes of an XML document. With a DTD, independent groups of
people can agree on a standard DTD for interchanging data. An application can use a
DTD to verify that XML data is valid.
An Internal DTD Declaration
If the DTD is declared inside the XML file, it must be wrapped inside the <!DOCTYPE>
definition:
XML document with an internal DTD
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>

SNJB’s Late Sau K. B. Jain COE, Chandwad


TE Computer Web Technology Lab

<!ELEMENT from (#PCDATA)>


<!ELEMENT heading (#PCDATA)>
]>

<note>
<to>Neha</to>
<from>Amit</from>
<heading>Reminder</heading>
</note>

The DTD above is interpreted like this:

!DOCTYPE note defines that the root element of this document is note
!ELEMENT note defines that the note element must contain four elements:
"to,from,heading"
!ELEMENT to defines the to element to be of type "#PCDATA"
!ELEMENT from defines the from element to be of type "#PCDATA"
!ELEMENT heading defines the heading element to be of type "#PCDATA"

An External DTD Declaration


If the DTD is declared in an external file, the <!DOCTYPE> definition must contain a
reference
to the DTD file:

<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
</note>

XSL (eXtensible Stylesheet Language) is a styling language for XML.


XSLT stands for XSL Transformations.
The root element that declares the document to be an XSL style sheet is <xsl:stylesheet>
or <xsl:transform>.
Note: <xsl:stylesheet> and <xsl:transform> are completely synonymous and either can
be used!
The correct way to declare an XSL style sheet according to the W3C XSLT

SNJB’s Late Sau K. B. Jain COE, Chandwad


TE Computer Web Technology Lab

Recommendation is:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Link the XSL Style Sheet to the XML Document
Add the XSL style sheet reference to your XML document ("student.xml"):
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="stud.xsl"?>
If you have an XSLT compliant browser it will nicely transform your XML into
XHTML.

Following steps are used to Create and Execute web applications,


1. Write the XML code in notepad and save with .xml extension.
2. Write the DTD in notepad and save with .dtd extension (For external DTD)
3. Write a XSLT code in notepad and save using .xsl extension.
4. Open XML page in the browser for running simple XML or XML using XSLT.
5. To run internal/external dtd open Eclipse and run the code using validate.

Manual testing is used to check whether XSLT gets applied or not.


Eclipse validates function used to check whether DTD gets applied or not.

Hence, we have designed static web pages using XML, XSLT/CSS and DTD

1. Explain difference between HTML and XML?


2. What is XML DOM?
3. Explain difference between CDATA and PCDATA?
4. What is mean by simple element and complex element?
5. What is DTD?
6. Explain XSL and XSL

SNJB’s Late Sau K. B. Jain COE, Chandwad

You might also like