Extensible Stylesheet Language (XSL)

Estudies4you
Extensible Stylesheet Language
XSL
XSL stands for Extensible Stylesheet Language. An XSL stylesheet is a program that transforms an XML document into another XML document. XSL is a high-level, functional language.
For example:
Transforming XML to XHTML (HTML that conforms to XML syntax)
Transforming an XML document to WML (a format of XML that cellular phones can display)

XSL consists of three ip arts:
  • XSLT - a language for transforming XML documents
  • XPath - a language for navigating in XML documents
  • XSL-FO - a language for formatting XML documents
Using an XSL Processor
XSL Processor


Example 1 - XSL
<xs1:stylesheet xmlns:xs1="http://www.w3.org/TR/WD-xs1">
<xsl:template match="/">
<HTML>
<HEAD><TITLE>Authors</TITLE></HEAD>
<BODY>
<H1>Composers from India </H1>
<TABLE BORDER=”1”><TR><TH>Nmae</TH></TR>
<xsl:for-each
select="/authors/author[nationality='India']">
<TR><TD><xs1:value-of select="name" /></TD></TR>
</xsl: for each> 
</TABLE> <
/BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
 <authors>
<author period="Classical">
<name>Ilaiyaraaja</name>
<nationality>India</nationality>
</author>
<authors>
<author period="Romance">
<name>Rachmanioff</name>
<nationality>Russian</nationality>
</author>
<authors> <author period="Classical">
<name>Mozart</name>
<nationality>Austrian</nationality>
</author> <authors>
<author period="Classical">
<name>Beethoven</name>
<nationality>German</nationality>
</author>
<authors>
<author period="Baroque"›
<name>Bach</name>
<nationality>German</nationality>
</author>
<authors>
<author period="Baroche">
<name>vavaldi</name>
<nationality>Italian</nationality>
</author> <author period="Romance">
<name>MM Keeravani</name>
<nationality>India</nationality>
</author>
<authors>
 <author period="Romance">
<name>Chopin</name>
<nationality>Poland</nationality>
</author>
<authors>
<author period="Romance">
<name>mahler</name>
<nationality>Austrian</nationality>
 </author>


OUTPUT:
Composers From India

XSL Processor



To Top