What are XML and XSLT? Explain with an example.

Mumbai University > Information Technology > Sem 4 > Web Programming

Marks: 5M

Year: May 2014

1 Answer
  • Extensible Markup Language (XML) is meta markup language which means that it lets us create our own markup language.
  • XML is popular for following reasons:
    • It allows easy data exchange
    • It allows to customize markup languages
    • Makes the data in document self describing
    • Allows for structured and Integrated data
  • XML is case sensitive , which means <welcome> and <welcome> are treated differently
  • Each tag should have a relevant closing also.
  • Example:

    <?xml version=”1.0” encoding=”UFT-8”?>
    Welcome to XML
  • The xml document always starts with XML processing instruction

    <?xml version=”1.0” encoding=”UFT-8”?>
  • The above statement defines the XML version and UFT -8 is a 8 bit condensed version of Unicode


  • Extensible Stylesheet Language (XSL) is a family of recommendations for defining XML document, transforming and presenting it.
  • XSLT is a language for transforming XML documents into another XML documents.
  • XSL includes an XML vocabulary for specifying formatting.
  • XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.
  • With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more.
  • A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.


    The XML input file:

    <title>The Dilbert Principle</title>
    <author>Scott Adams</author>


<xsl:stylesheet version = '1.0'xmlns:xsl='https://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<xsl:value-of select="//title"/>
<xsl:value-of select="//author"/>


The Dilbert Principle

Scott Adams

Please log in to add an answer.