You are on page 1of 26

XML was designed to transport and store data. HTML was designed to display data.

XML stands for eXtensible Markup Language. The XML standard was created by W3C to provide an easy to use and standardized way to store self-describing data (self-describing data is data that describes both its content and its structure).

What is XML?
     

XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data XML tags are not predefined. You must define your own tags XML is designed to be self-descriptive XML is a W3C Recommendation

The Difference Between XML and HTML
XML is not a replacement for HTML. XML and HTML were designed with different goals:
 

XML was designed to transport and store data, with focus on what data is HTML was designed to display data, with focus on how data looks

HTML is about displaying information, while XML is about carrying information.

XML Does Not DO Anything
Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information. The following example is a note to Tove, from Jani, stored as XML: <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>

The note above is quite self descriptive. It has sender and receiver information, it also has a heading and a message body. But still, this XML document does not DO anything. It is just information wrapped in tags. Someone must write a piece of software to send, receive or display it.

With XML You Invent Your Own Tags
The tags in the example above (like <to> and <from>) are not defined in any XML standard. These tags are "invented" by the author of the XML document. That is because the XML language has no predefined tags. The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like <p>, <h1>, etc.). XML allows the author to define his/her own tags and his/her own document structure.

XML is Not a Replacement for HTML
XML is a complement to HTML. It is important to understand that XML is not a replacement for HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data. My best description of XML is this: XML is a software- and hardware-independent tool for carrying information.

XML is a W3C Recommendation
XML became a W3C Recommendation on February 10, 1998.

XML is Everywhere
XML is now as important for the Web as HTML was to the foundation of the Web.

it will take a lot of work to edit the HTML each time the data changes. With XML. and be sure that changes in the underlying data will not require any changes to the HTML. With a few lines of JavaScript code. This way you can concentrate on using HTML/CSS for display and layout. XML Simplifies Platform Changes . XML Simplifies Data Sharing In the real world. XML data is stored in plain text format. computer systems and databases contain data in incompatible formats. XML Separates Data from HTML If you need to display dynamic data in your HTML document. This provides a software. XML is used in many aspects of web development. data can be stored in separate XML files. Exchanging data as XML greatly reduces this complexity. often to simplify data storage and sharing. you can read an external XML file and update the data content of your web page.and hardware-independent way of storing data. This makes it much easier to create data that can be shared by different applications. since the data can be read by different incompatible applications. XML Simplifies Data Transport One of the most time-consuming challenges for developers is to exchange data between incompatible systems over the Internet.XML is the most common tool for data transmissions between all sorts of applications.

This makes it easier to expand or upgrade to new operating systems. but also from XML data sources. The future might give us word processors. XML is Used to Create New Internet Languages A lot of new Internet languages are created with XML. . without losing data. etc). future applications will exchange their data in XML. voice machines. is always time consuming. or new browsers. without any conversion utilities in between. news feeds. XML data is stored in text format. With XML. your data can be available to all kinds of "reading machines" (Handheld computers. new applications. XML Makes Your Data More Available Different applications can access your data.Upgrading to new systems (hardware or software platforms). and make it more available for blind people. not only in HTML pages. or people with other disabilities. Large amounts of data must be converted and incompatible data is often lost. spreadsheet applications and databases that can read each other's data in XML format. Here are some examples:       XHTML WSDL for describing available web services WAP and WML as markup languages for handheld devices RSS languages for news feeds RDF and OWL for describing resources and ontology SMIL for describing multimedia for the web If Developers Have Sense If they DO have sense.

we have highlighted both the opening and closing tags from a piece of our example XML file.The XML tag is very similar to that of the HTML tag. while a closing tag has a slash that is placed before the element's name: </element>. An opening tag looks like <element>. then the value of the attribute must be specified. XML Code: <friend age="23">Samantha</friend> Element Review    Elements are used to classify data in an XML document so that the data becomes "selfexplanatory". For example. All information that belongs to an element must be contained between the opening and closing tags of an element. XML Attribute Attributes are used to specify additional information about the element. if a tag had a color attribute then the value would be: red. From now on we will refer to the opening or closing of an element as open or close tags. XML Code: <name>Robert</name> <grade>A+</grade> XML Tag A tag is just a generic name for a <element>. It may help to think of attributes as a means of specializing generic elements to fit your needs. If there are multiple values an attribute may have. blue. Opening and closing tags represent the start and end of an element. . Below. An attribute for an element appears within the opening tag. green. Attributes are used to include additional information on top of the data that falls between the opening and closing tag. Each element is marked with an opening tag and a closing tag. etc. The syntax for including an attribute in an element is:  <element attributeName="value"> In this example we will be using a madeup XML element named "friend" that has an optional attribute age.

while the DTD describes the rules your XML document must follow. An . also referred to as the "document". they seem to have succeeded. XML Prolog The XML prolog is an optional piece of information that must come before the root element when used. while the element <gif> may contain data for a GIF image. We have divided the components into sections and subsections. The element <p> might represent paragraph text. so that they can be considered valid XML. There are two pieces that make up the prolog: the XML declaration and the Document Type Declaration (DTD). The XML declaration states which version of XML you are using. the root element will be <html>. XML Root Element (Document) The root element. In an HTML file the root element is <html>. Although not required. elements often have attributes that are associated with them. W3C wanted to keep XML simple. dictates what kind of XML document it is.  Prolog XML Declaration DTD Declaration Root Element (Document) o Elements (Nested Elements)  Element Attributes and Values  Data o o  Webpage standards now recommend that an HTML document follow this form. The root element must be the first element in an XML document and there can only be one root element per file! XML Element & Attributes The meat of an XML document comes from the elements that are contained within the root element.Parts of an XML Document An XML document is made up of a small group of building blocks. When creating an HTML file that is XML complaint. and judging by the relatively few components of an XML document. XML attributes are similar to HTML attributes in that they have a name:value relationship. Each element represents a different type of data that is being stored in the document.

Students grades are updated bi-monthly --> <class_list> <student> . these other elements must show up after the opening root tag and before the closing root tag. XML Code: <?xml version="1. XML Code: <phonebook> <number> </number> <name> </name> </phonebook> XML comments have the exact same syntax as HTML comments.. Below. This is often referred to as the XML's "content"..example attribute for an <img> element might be "src". XML Element & Attribute Code: <img src = "C:/MyDocs/Happy. which represents the source location of the image. Below is an example of a notation comment that should be used when you need to leave a note to yourself or to someone who may be viewing your XML. XML Code: <story> <author>Jill Doe</author> <title>The Truth About the Family</title> <page> <paragraph>Here's a story of a lovely lady who.0" encoding="ISO-8859-15"?> <!-... The root element must encapsulate all other elements--meaning. Here is an example of an XML document with the root element "phonebook".</paragraph> <paragraph>.they became the Brady Bunch. we have an imaginary XML document that stores a story.</paragraph> </page> </story> In an XML file... there can only be one root element. the bulk of data in XML usually appears between the opening and closing tag of an XML element.gif"></img> XML Data In addition to the information stored in the element itself (attributes).

For now we will simply show you how to reference an existing DTD file.0" encoding="ISO-8859-15"?> <class_list> <student> <name>Robert</name> <grade>A+</grade> </student> <!-<student> <name>Lenard</name> <grade>A-</grade> </student> --> </class_list> XML Prolog The prolog is an optional component of the XML document. the prolog must be appear before the root element. so we will discuss its use and purpose first. which will allow you to make your own XML rules. either. XML Document Type Declaration (DTD) The Document Type Declaration is a file that contains the necessary rules that the XML code in this file must follow. You may think of the DTD as the grammar that the XML document must abide by to be a valid XML file. The DTD is most oftenly used.<name>Robert</name> <grade>A+</grade> </student> <student> <name>Lenard</name> <grade>A-</grade> </student> </class_list> XML Commenting out XML XML Comments let you do this easily. as this example below shows. you can choose to include both. <?xml version="1. A prolog consists of two parts: the XML declaration and the Document Type Declaration (DTD). . If included. or neither of these items in your XML document. Depending on your needs. In later lessons we will discuss how to create your own DTD.

w3.org/TR/xhtml1/DTD/xhtml1-transitional. The current version is 1.dtd"> .org/TR/xhtml1/DTD/xhtml1-transitional. Notice how this DTD resides on w3's servers." ..Referencing an External DTD There are two type declarations that may be used to reference an external DTD: PUBLIC and SYSTEM.Specifies that this a publicly available DTD.The definition of the public document. which has <html> as the root element. use PUBLIC. "-//W3C//D. XML & DTD Declaration Together If you were to include both an XML declaration and a DTD declaration on an XML document then you would place the XML declaration first.The physical location of the DTD. Here our example is an HTML file.. PUBLIC .w3." . Check out the most recent XML version at w3. When creating an XML document under the rules of a publicly distributed DTD. use the SYSTEM type declaration.0 Transitional//EN" "http://www. <?xml version="1. but should be included anyways. XML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.. "http://www.Specifies the root element of the XML document.0"?> The declaration is not absolutely necessary.0. which it has been for quite some time now.org/.0 Transitional//EN" "http://www.org. The example below shows a prolog that would be used for an HTML document that is using an XML prolog. <?xml version="1.Tell the XML processor that this piece of code defines the Document Type Definition html .0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1..dtd"> Let's take a look at each piece of this external DTD reference. Otherwise.w3. The XML Declaration This is where you define what version of XML you are using.      !DOCTYPE . We have done just that in the example below. Describing this is beyond the scope of this tutorial. followed by the DTD declaration. The DTD is publicly available thanks to the W3C.

XML Element Overlap When you are creating new elements.0" encoding="ISO-8859-15"?> <html> <body> <p>Welcome to my Health Resource</p> </body> <body> <height>6ft</height> <weight>155 lbs</weight> </body> </html> Here. we have two very different elements that want to use the same name: body. XML Namespace XML was designed to be a very robust markup language that could be used in many different applications. with XML being able to communicate between so many different platforms. The reserved attribute is actually more like a prefix that you attach to any namespace you create. Imagine someone was creating a health-related XML document that included XHTML (that's HTML that is also valid XML). which will differentiate between these two similarly named elements! XML Namespace Syntax The XML namespace is a special type of reserved XML attribute that you place in an XML tag. there is one problem that tends to occur. The colon is used to separate the prefix from your namespace that you are creating. there is the chance that the element's name already exists. This attribute prefix is "xmlns:". However.Be sure to include the optional prolog when you want to run your document through an XML processor to check for validity. If you have a valid DTD. . XML Code: <?xml version="1. The solution to this problem is to create XML Namespaces. which stands for XML NameSpace. simply use the free markup validation tool at W3C.

You probably only care that your XML document works. as well as valid. and broken. See our Root Element Lesson for more information. The rules are as follows:    One Root Element . XML Code: <?xml version="1.Any entities that are referenced in the document must also be wellformed. . Proper Nesting . Both the namespace attribute and its use in our document has been highlighted in red. we will be using the W3C's XHTML URL and a made up URI for our second body element.org/health'> <health:height>6ft</height> <health:weight>155 lbs</weight> </health:body> </html:html> By placing a namespace prefix before our elements. Well-Formed Entities . but knowing the requirements for each kind of validity may shed some light on problems that arise in the future. xmlns must have a unique value that no other namespace in the document has.As we mentioned in our XML Attribute Lesson. there are three ways to measure a document's validity: valid.org/TR/xhtml1/'> <html:body> <html:p>Welcome to my Health Resource</html:p> </html:body> <health:body xmlns:health='http://www.0" encoding="ISO-8859-15"?> <html:html xmlns:html='http://www. Well-Formed XML A well-formed XML document has to follow several rules that most other markup languages also follow. What is commonly used is the URI (Uniform Resource Identifier) or the more commonly used URL. To rectify the overlap in our health XML document.w3. we have solved the overlapping problem! XML Documents: Valid Versus Well-Formed In XML. well-formed.XML elements must be closed in the order they are opened.The XML document may only have one root element. every XML attribute must be set equal to something. These are generic rules that must be followed for a document to be well-formed. See our Nesting Lesson for more information.example. See our Entity Lesson for more information.

you know that CSS is a way of styling HTML. Bean</teacher> </class> . you can take an XML document and choose the elements and values you want.The first example below is incorrect. XSLT is referred to as the stylesheet for XML. but it sounds more complicated than it is. XML Code: <?xml version="1. With XSLT.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="class. Try to figure out the error in the first example. Garcia <body>Hello there! How are we today?</to> </body> </email> Well-Formed XML Code: <email> <to>Mr. and the second is well-formed. which is a mouthful to say. Garcia</to> <body>Hello there! How are we today?</body> </email> XSLT . then generate a new file with your choices. XSLT is used to style and transform XML. In a similar relationship.xsl"?> <class> <student>Jack</student> <student>Harry</student> <student>Rebecca</student> <teacher>Mr. simple XML document that gets transformed by a complicated looking XSLT file.Introduction XSLT is an XML-related technology that is used to manipulate and transform XML documents. Broken XML Code: <email> <to>Mr. The acronym XSLT stands for Extensible Stylesheet Language Transformations. Because of XSLT's ability to change the content of an XML document. If you have already heard about HTML and CSS.

xml. XSLT does not change an XML document. but this example shows how XSLT can be used to temporarily manipulate XML.org/1999/XSL/Transform"> <xsl:template match="teacher"> <p><u><xsl:value-of select=".xml is linked to the XSLT code by adding the xml-stylesheet reference. Bean</u></p> </body> </html> . This HTML was created from an XML document bring transformed by our XSLT code. XSLT Output (What you see in your browser): <html> <body> <p><b>Jack</b></p> <p><b>Harry</b></p> <p><b>Rebecca</b></p> <p><u>Mr. Below."/></u></p> </xsl:template> <xsl:template match="student"> <p><b><xsl:value-of select=". The XSLT code then applies its rules to transform the XML document.0" ?> <xsl:stylesheet version="1."/></b></p> </xsl:template> <xsl:template match="/"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> </xsl:stylesheet> The XML file class.xml However. if you were to "view the source" of these XML files in your browser.   Before XSLT: classoriginal.xml After XSLT rules are applied: class.w3. you would just see the XML document and not the transformed file.XSLT Code: <?xml version="1.0" xmlns:xsl="http://www. we have manually reconstructed the XSLT output that you see when you click class.

Make sure that both your XSLT and XML file are in the same directory. we used XSLT to convert the XML document into a simple webpage. you can pretty much do anything with XSLT! XSLT . your XSLT file should be named class. Place this after your XML declaration to link your XML file to your XSLT code. Displaying your XML Files with CSS? It is possible to use CSS to format an XML document. xml-stylesheet has two attributes: 1. width: 100%.xml. XML Code: <?xml version="1. 2. If you have been following along with this tutorial. all of our XSLT lessons will be focusing on browser ready XSLT output.xsl. and your XML file will be linked to your XSLT file. If you saved your XSLT and XML file in the same directory. Bean</teacher> </class> Save this XML file as class. Because we are an internet-related website.xml-stylesheet xml-stylesheet is a special declaration in XML for linking XML with stylesheets.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="class. We will be using the value text/xsl to specify XSLT.xsl"?> <class> <student>Jack</student> <student>Harry</student> <student>Rebecca</student> <teacher>Mr. type: the type of file being linked to. .As you can see. Below is an example of how to use a CSS style sheet to format an XML document: The CSS file CATALOG { background-color: #ffffff. href: the location of the file. However. you can simply use the XSLT filename.

font-size: 20pt. } .} CD { display: block.COMPANY { display: block. font-size: 20pt.YEAR.PRICE. margin-left: 20pt. } TITLE { color: #FF0000. margin-bottom: 30pt. color: #000000. margin-left: 0. } ARTIST { color: #0000FF. } COUNTRY.

xml. It will accept information that is organized in a certain way and will manipulate it with its own database engine. At the same time this file is loaded. The async="false" attribute is added to make sure all the XML data is loaded before any other HTML processing takes place. view: The CD catalog formatted with the CSS file Below is a fraction of the XML file.xml" async="false"></xml> The simple HTML code creates an XML DSO with a DOM object and loads it with the file equip. .xml is validated and all the external entities are expanded.Finally. and you can manipulate the data stored in the object using these methods.90</PRICE> <YEAR>1988</YEAR> </CD> </CATALOG> Formatting XML with CSS is not the most common method.css"?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10. equip.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/css" href="cd_catalog. <xml id="equipdet" src="equip. The second line links the XML file to the CSS file: The CD catalog <?xml version="1. The default behavior of XML DSO is to validate the document and to resolve external entities as the XML document is loaded. Like any object it has an interface with its own properties and methods.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9. DSO DSO is an object that operates like a database on the client side.

Using this object. .0" encoding="iso-8859-1"?> <equipment> <details> <name>Hard Disk</name> <rate>2800</rate> <manufacturer>SeaGate</manufacturer> </details> <details> <name>Motherboard</name> <rate>10000</rate> <manufacturer>Intel</manufacturer> </details> <details> <name>Monitor</name> <rate>8000</rate> <manufacturer>Samsung</manufacturer> </details> <details> <name>Rajadurai</name> <rate>Tuticorin</rate> <manufacturer>Tamilnad</manufacturer> </details> </equipment> The XML Data Source Object (DSO) is a Microsoft ActiveX control that’s built into Microsoft Internet Explorer 4+. Implementation We can initialize an XML-DSO object using the <OBJECT> tag. or XML data embedded in an HTML file. but the XML-DSO does not require any such parameters.<?xml version="1. And we initialize this control in a Web page as follows: <OBJECT ID="SomeID" CLASSID="CLSID:550dda30-054111d2-9ca9-0060b0ec3d39"></OBJECT> Most OBJECTs have a number of parameters associated with them. it is possible to extract content from an external XML file. into an HTML page. The CLASSID for the XML-DSO is: CLSID:550dda30-0541-11d2-9ca9-0060b0ec3d39 The above ID uniquely identifies the XML-DSO.

or. Let’s take a look at both these solutions.htm --> <html> <head> <title>XML DSO-example1.example1.htm</title> </head> <body bgcolor="#FFFFFF"> <xml id="xmldb"> <db> <member> <name>Premshree Pillai<name> <sex>male</sex> </member> <member> <name>Vinod</name> <sex>male</sex> </member> </db> </xml> <span datasrc="#xmldb" datafld="name"<</span> <br> <span datasrc="#xmldb" datafld="sex"></span> . Examples First. where we embed XML code in the HTML page itself. we’ll take a look at how to extract data from XML data islands (XML data that’s included in the HTML page itself).Now. we can use XML Data Islands. Take a look at the following code: <!-. we can either extract the data from an external XML file.

</body> </html> The output of the above is: Premshree Pillai male Note that. when you use a XML data island.htm. As you can see. Thus.example2. name in first <SPAN> and sex in second <SPAN>). xmldb. but that. Note that we have two <name> and <sex> tags in our XML data island.htm --> <html> <head> <title>XML DSO-example2.htm</title> </head> <body bgcolor="#FFFFFF"> <xml id="xmldb"> <db> <member> <name>Premshree Pillai<name> <sex>male</sex> </member> <member> <name>Vinod</name> . we have not initialised an XML-DSO object. in the code for example1. for use later. we can extract only the first instances of these tags. <SPAN>. using the above method. the object is implicitly created. datafld is used to specify the XML tag you want to extract the data from (here. Now. Note the attributes datasrc and datafld in the <SPAN> tag. we have to use the <TABLE> tag. datasrc is used to specify the ID of the data island you want to extract data from. we’ve included an XML data island using the <XML> tag. In the above code. We have assigned it an ID. <DIV> etc. Take a look at the following example: <!-. we can extract data from the XML data island using HTML tags like <A>. we have extracted data here using the <SPAN> tag. To extract all instances.

Consider the following XML file: <!-. within the HTML column tag. Now.example3. we can display all the names and ages in a formatted way. we’ll take a look at how to extract contents from an external XML file using XML-DSO. we’ve used the <TABLE> tag and extracted the contents using the HTML tag. thus. <DIV>.<sex>male</sex> </member> </db> </xml> <table datasrc="#xmldb" border="1"> <thead> <th>Name</th> <th>Sex</th> </thead> <tr> <td><div datafld="name"></div></td> <td><div datafld="sex"></div></td> </tr> </table> </body> </html> The output of the above is: Here.xml --> . The table will automatically iterate through each instance of <member> (the parent of <name> and <sex>). <TD>.

com</URL> </item> </ticker> Now.htm</title> <script language="JavaScript"> function load() { var xmlDso=myXML.<?xml version="1.example3. consider the following HTML page: <!-.load("example3.xml"). } </script> </head> <body bgcolor="#FFFFFF" onLoad="load()"> <object id="myXML" CLASSID="clsid:550dda30-0541-11d2-9ca90060b0ec3d39" width="0" height="0"> </object> <table datasrc="#myXML" border="1"> <thead> <th>Message</th> .XMLDocument.0" ?> <ticker> <item> <message>JavaScript Ticker using XML DSO</message> <URL>http://someURL.htm --> <html> <head> <title>XML DSO-example3. xmlDso.

<th>URL</th> </thead> <tr> <td><div datafld="message"></div></td> <td><div datafld="URL"></div></td> </tr> </table> </body> </html> The output of the above is: Observe the code of example3. Note that we have added the width and height attributes to the <OBJECT> tag and set their values to 0. when we want to load an external XML file using XML-DSO. A more generic script is as follows: <script language="JavaScript"> var xmlDso. First.htm. but we don’t want it to occupy any space in the Web page Next. function load(xmlFile. As you can see in the script. myXML.xml using the XML-DSO’s load()method. we’ve created a XML-DSO object with id as myXML. which refers to the object we have created.XMLDocument. The additional code here is the <SCRIPT> we’ve added. objName) { . we have to explicitly include the object. as well as a small bit of JavaScript to load the external XML file. we’ve set the variable xmlDso to myXML. we load example3. This is because we want to create an XML-DSO object. We have extracted the content using <DIV> tags (within TD tags) with datafld as message for the first column and URL for the second column. The above script is very specific and cannot be used to load just any XML file. Now the file example3. Thus. we have created a table with datasrc as myXML.xml is bound to the object. Everything else is similar to the previous examples. Next. similar to example 2.

use: load("SomeXMLFile.htm --> .xml --> <?xml version="1. consider the following HTML file: <!-.example4.example4. to load any XML file.xml".0" ?> <myDB> <member> <name>Premshree Pillai</name> <sex>male</sex> </member> <member> <name>Vinod</name> <sex>male</sex> </member> <member> <name>Santhosh</name> <sex>male</sex> </member> </myDB> Now.load(xmlFile).eval('xmlDso='+objName+'. } </script> And. Consider the following XML file: <!-.XMLDocument')."anyXmlDsoObject"). xmlDso. XML DSO and JavaScript It’s also possible to manipulate the XML DSO object using JavaScript.

} </script> </head> <body bgcolor="#FFFFFF" onLoad="load()"> <object id="myDB" CLASSID="clsid:550dda30-0541-11d2-9ca90060b0ec3d39" width="0" height="0"> </object> <span datasrc="#myDB" datafld="name"></span> </body> </html> Now.moveNext().XMLDocument. /* Get the complete record set */ var memberSet=myDB.xml"). xmlDso.recordset.load("example4. /* Go to next data */ memberSet. the output of the above will be: Vinod .<html> <head> <title>XML DSO-example4.htm</title> <script language="JavaScript"> function load() { var xmlDso=myDB.

like HTML and XHTML. The <xsl:template> element is used to build templates. or another type of document that is recognized by a browser. XSLT uses XPath to define parts of the source document that should match one or more predefined templates. The <xsl:value-of> element can be used to extract the value of an XML element and add it to the output stream of the transformation: The <xsl:for-each> element allows you to do looping in XSLT. A template contains rules to apply when a specified node is matched. What is XSLT?      XSLT stands for XSL Transformations XSLT is the most important part of XSL XSLT transforms an XML document into another XML document XSLT uses XPath to navigate in XML documents XSLT is a W3C Recommendation XSLT = XSL Transformations XSLT is used to transform an XML document into another XML document. The match attribute can also be used to define a template for the entire XML document. With XSLT you can add/remove elements and attributes to or from the output file. and a lot more. When a match is found. XPath is used to navigate through elements and attributes in XML documents.XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. . The value of the match attribute is an XPath expression (i. In the transformation process. match="/" defines the whole document). An XSL style sheet consists of one or more set of rules that are called templates. Normally XSLT does this by transforming each XML element into an (X)HTML element. XSLT uses XPath to find information in an XML document. A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.e. You can also rearrange and sort elements. The match attribute is used to associate a template with an XML element. perform tests and make decisions about which elements to hide and display. XSLT will transform the matching part of the source document into the result document.