- 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”?>
<DOCUMENT>
<WELCOME>
Welcome to XML
</WELCOME>
</DOCUMENT>
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
XSLT:
- 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.
Example:
The XML input file:
<book>
<title>The Dilbert Principle</title>
<author>Scott Adams</author>
</book>
XSLT:
<xsl:stylesheet version = '1.0'xmlns:xsl='https://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<h1>
<xsl:value-of select="//title"/>
</h1>
<h2>
<xsl:value-of select="//author"/>
</h2>
</xsl:template>
</xsl:stylesheet>
Output:
The Dilbert Principle
Scott Adams