SlideShare a Scribd company logo
1 of 19
Download to read offline
XSL
Dr.S.Roselin Mary
HOD/CSE
ANAND INSTITUTE OF HIGHER TECHNOLOGY
• XSL which stands for EXtensible Stylesheet Language. It is similar to
XML as CSS is to HTML.
Need for XSL
• In case of HTML document, tags are predefined such as table, div,
and span; and the browser knows how to add style to them and
display those using CSS styles.
• But in case of XML documents, tags are not predefined. In order to
understand and style an XML document, World Wide Web
Consortium (W3C) developed XSL which can act as XML based
Stylesheet Language.
• An XSL document specifies how a browser should render an XML
document.
• Following are the main parts of XSL −
– XSLT − used to transform XML document into various other types of
document.
– XPath − used to navigate XML document.
– XSL-FO − used to format XML document. 2Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
What is XSLT
• XSLT, Extensible Stylesheet Language Transformations, provides the ability
to transform XML data from one format to another automatically.
How XSLT Works
• An XSLT stylesheet is used to define the transformation rules to be applied
on the target XML document.
• XSLT stylesheet is written in XML format. XSLT Processor takes the XSLT
stylesheet and applies the transformation rules on the target XML
document and then it generates a formatted document in the form of
XML, HTML, or text format.
• This formatted document is then utilized by XSLT formatter to generate
the actual output which is to be displayed to the end-user.
Advantages
• Independent of programming. Transformations are written in a separate
xsl file which is again an XML document.
• Output can be altered by simply modifying the transformations in xsl file.
No need to change any code. So Web designers can edit the stylesheet
and can see the change in the output quickly. 3
Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
4
Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
students.xml
<?xml version = "1.0"?>
<class>
<student rollno = "393">
<firstname>Dinkar</firstname>
<lastname>Kad</lastname>
<nickname>Dinkar</nickname>
<marks>85</marks>
</student>
<student rollno = "493">
<firstname>Vaneet</firstname>
<lastname>Gupta</lastname>
<nickname>Vinni</nickname>
<marks>95</marks>
</student>
<student rollno = "593">
<firstname>Jasvir</firstname>
<lastname>Singh</lastname>
<nickname>Jazz</nickname>
<marks>90</marks>
</student>
</class>
We need to define an XSLT style sheet document for the above XML document to
meet the following criteria −
•Page should have a title Students.
•age should have a table of student details.
•Columns should have following headers: Roll No, First Name, Last
Name, Nick Name, Marks
5
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
Step 1: Create XSLT document
Create an XSLT document to meet the above requirements, name it as students.xsl and save it in the same location
where students.xml lies.
students.xsl
<?xml version = "1.0" encoding = "UTF-8"?>
<!-- xsl stylesheet declaration with xsl namespace:
Namespace tells the xlst processor about which
element is to be processed and which is used for output purpose only
-->
<xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<!-- xsl template declaration:
template tells the xlst processor about the section of xml
document which is to be formatted. It takes an XPath expression.
In our case, it is matching document root element and will
tell processor to process the entire document with this template.
-->
<xsl:template match = "/">
<!-- HTML tags
Used for formatting purpose. Processor will skip them and browser
will simply render them.
-->
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
6
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
<!-- for-each processing instruction
Looks for each element matching the XPath expression
-->
<xsl:for-each select="class/student">
<tr>
<!-- value-of processing instruction
process the value of the element matching the XPath expression
-->
<td><xsl:value-of select = "@rollno"/></td>
<td><xsl:value-of select = "firstname"/></td>
<td><xsl:value-of select = "lastname"/></td>
<td><xsl:value-of select = "nickname"/></td>
<td><xsl:value-of select = "marks"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
7
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
Step 2: Link the XSLT Document to the XML Document
Update student.xml document with the following xml-stylesheet tag. Set href value to students.xsl
<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "students.xsl"?>
<class>
...
</class>
8
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
Step 3: View the XML Document in Internet Explorer
students.xml
<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "students.xsl"?>
<class>
<student rollno = "393">
<firstname>Dinkar</firstname>
<lastname>Kad</lastname>
<nickname>Dinkar</nickname>
<marks>85</marks>
</student>
<student rollno = "493">
<firstname>Vaneet</firstname>
<lastname>Gupta</lastname>
<nickname>Vinni</nickname>
<marks>95</marks>
</student>
<student rollno = "593">
<firstname>Jasvir</firstname>
<lastname>Singh</lastname>
<nickname>Jazz</nickname>
<marks>90</marks>
</student>
</class>
9
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
XSLT <template>
Name & Description
1
name
Name of the element on which template is to be applied.
2
match
Pattern which signifies the element(s) on which template is to be applied.
3
priority
Priority number of a template. Matching template with low priority is not considered in from in front of high priority
template.
4
mode
Allows element to be processed multiple times to produce a different result each time.
<xsl:template> defines a way to reuse templates in order to generate the desired output for nodes
of a particular type/context.
Declaration
Following is the syntax declaration of <xsl:template> element.
<xsl:template
name = Qname
match = Pattern
priority = number
mode = QName >
</xsl:template>
Attributes
10
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
Number of occurrences Unlimited
Parent elements xsl:stylesheet, xsl:transform
Child elements
xsl:apply-imports,xsl:apply-templates,xsl:attribute, xsl:call-template, xsl:choose,
xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:fallback, xsl:for-each, xsl:if,
xsl:message, xsl:number, xsl:param, xsl:processing-instruction, xsl:text, xsl:value-
of, xsl:variable, output elements
Elements
students_imports.xsl
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nick Name</th>
<th>Marks</th>
</tr>
11
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
<xsl:for-each select = "class/student">
<tr>
<td><xsl:value-of select = "@rollno"/></td>
<td><xsl:value-of select = "firstname"/></td>
<td><xsl:value-of select = "lastname"/></td>
<td><xsl:value-of select = "nickname"/></td>
<td><xsl:value-of select = "marks"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
12
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
XSLT <value-of>
Sr.No Name & Description
1
Select
XPath Expression to be evaluated in current context.
2
disable-outputescaping
Default-"no". If "yes", output text will not escape xml characters from text.
<xsl:value-of> tag puts the value of the selected node as per XPath expression, as text.
Declaration
Following is the syntax declaration of <xsl:value-of> element.
<xsl:value-of
select = Expression
disable-output-escaping = "yes" | "no" >
</xsl:value-of>
Attributes
Number of Occurrences Unlimited
Parent elements xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if,
xsl:message, xsl:otherwise, xsl:param, xsl:processing instruction, xsl:template,
xsl:variable, xsl:when, xsl:with-param, output elements
Child elements None
Elements
13
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nick Name</th>
<th>Marks</th>
</tr>
<xsl:for-each select = "class/student">
<tr>
<td><xsl:value-of select = "@rollno"/></td>
<td><xsl:value-of select = "firstname"/></td>
<td><xsl:value-of select = "lastname"/></td>
<td><xsl:value-of select = "nickname"/></td>
<td><xsl:value-of select = "marks"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
14
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
XSLT <sort>
Sr.No Name & Description
1
select
Sorting key of the node.
2
lang
Language alphabet used to determine sort order.
3
data-type
Data type of the text.
4
order
Sorting order. Default is "ascending".
5
case-order
<xsl:sort> tag specifies a sort criteria on the nodes.
Declaration
Following is the syntax declaration of <xsl:sort> element.
<xsl:sort
select = string-expression
lang = { nmtoken }
data-type = { "text" | "number" | QName }
order = { "ascending" | "descending" }
case-order = { "upper-first" | "lower-first" } >
</xsl:sort>
Attributes
15
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
Number of occurrences Unlimited
Parent elements xsl:apply-templates, xsl:for-each
Child elements None
Elements
16
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
students.xsl
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nick Name</th>
<th>Marks</th>
</tr>
<xsl:for-each select = "class/student">
<xsl:sort select = "firstname"/>
<tr>
<td><xsl:value-of select = "@rollno"/></td>
<td><xsl:value-of select = "firstname"/></td>
<td><xsl:value-of select = "lastname"/></td>
<td><xsl:value-of select = "nickname"/></td>
<td><xsl:value-of select = "marks"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
17
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
XSLT <if>
Sr.No Name & Description
1
test
The condition in the xml data to test.
Number of Occurrences Unlimited
Parent elements
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if,
xsl:message, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template,
xsl:variable, xsl:when, xsl:with-param, output elements
Child elements
xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy,
xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text,
xsl:value-of, xsl:variable, output elements
<xsl:if> tag specifies a conditional test against the content of nodes.
Declaration
Following is the syntax declaration of <xsl:if> element.
<xsl:if
test = boolean-expression >
</xsl:if>
Attributes
Elements
18
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<h2>Students</h2>
<table border = "1">
<tr bgcolor = "#9acd32">
<th>Roll No</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nick Name</th>
<th>Marks</th>
</tr>
<xsl:for-each select = "class/student">
<xsl:if test = "marks > 90">
<tr>
<td><xsl:value-of select = "@rollno"/></td>
<td><xsl:value-of select = "firstname"/></td>
<td><xsl:value-of select = "lastname"/></td>
<td><xsl:value-of select = "nickname"/></td>
<td><xsl:value-of select = "marks"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet> 19
Dr.S.ROSELIN MARY, HOD/CSE, ANAND
INSTITUTE OF HIGHER TECHNOLOGY

More Related Content

What's hot (17)

Introduction to XSLT
Introduction to XSLTIntroduction to XSLT
Introduction to XSLT
 
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
 
Xml part4
Xml part4Xml part4
Xml part4
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Xml schema
Xml schemaXml schema
Xml schema
 
Schemas 2 - Restricting Values
Schemas 2 - Restricting ValuesSchemas 2 - Restricting Values
Schemas 2 - Restricting Values
 
Xml schema
Xml schemaXml schema
Xml schema
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Language
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Object Based Databases
Object Based DatabasesObject Based Databases
Object Based Databases
 
sql statements & joins
sql statements & joinssql statements & joins
sql statements & joins
 
Xml schema
Xml schemaXml schema
Xml schema
 
XML DTD and Schema
XML DTD and SchemaXML DTD and Schema
XML DTD and Schema
 
Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Service Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML SchemaService Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML Schema
 

Similar to Service Oriented Architecture- UNIT 2- XSL

eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)Serhii Kartashov
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!Bertrand Delacretaz
 
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaIntegrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaVijiPriya Jeyamani
 
In Pursuit of the Grand Unified Template
In Pursuit of the Grand Unified TemplateIn Pursuit of the Grand Unified Template
In Pursuit of the Grand Unified Templatehannonhill
 
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Allison Jai O'Dell
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xsltTUSHAR VARSHNEY
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsAnton Keks
 
"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slidesRussell Ward
 

Similar to Service Oriented Architecture- UNIT 2- XSL (20)

Xml p5 Lecture Notes
Xml p5 Lecture NotesXml p5 Lecture Notes
Xml p5 Lecture Notes
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriyaIntegrative Programming and Technology Chapter 4- Dr. J. VijiPriya
Integrative Programming and Technology Chapter 4- Dr. J. VijiPriya
 
Xml PPT
Xml PPTXml PPT
Xml PPT
 
In Pursuit of the Grand Unified Template
In Pursuit of the Grand Unified TemplateIn Pursuit of the Grand Unified Template
In Pursuit of the Grand Unified Template
 
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
 
XPATH_XSLT-1.pptx
XPATH_XSLT-1.pptxXPATH_XSLT-1.pptx
XPATH_XSLT-1.pptx
 
XSLT.ppt
XSLT.pptXSLT.ppt
XSLT.ppt
 
Xsl xslt
Xsl  xsltXsl  xslt
Xsl xslt
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
 
XSL- XSLT.pdf
XSL- XSLT.pdfXSL- XSLT.pdf
XSL- XSLT.pdf
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & Servlets
 
"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides
 
26xslt
26xslt26xslt
26xslt
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 

More from Roselin Mary S

Unit 2 hci in software process
Unit 2   hci in software processUnit 2   hci in software process
Unit 2 hci in software processRoselin Mary S
 
Unit1 17-08-2020 HUMAN COMPUTER INTERACTION
Unit1  17-08-2020 HUMAN COMPUTER INTERACTIONUnit1  17-08-2020 HUMAN COMPUTER INTERACTION
Unit1 17-08-2020 HUMAN COMPUTER INTERACTIONRoselin Mary S
 
Unit 1 defects classes
Unit 1 defects classesUnit 1 defects classes
Unit 1 defects classesRoselin Mary S
 
IT 8076 Software Testing Unit1
IT 8076 Software Testing Unit1IT 8076 Software Testing Unit1
IT 8076 Software Testing Unit1Roselin Mary S
 
Service Oriented Architecture -Unit II - Modeling databases in xml
Service Oriented Architecture -Unit II - Modeling databases in xml Service Oriented Architecture -Unit II - Modeling databases in xml
Service Oriented Architecture -Unit II - Modeling databases in xml Roselin Mary S
 
Service Oriented Architecture - Unit II - Sax
Service Oriented Architecture - Unit II - Sax Service Oriented Architecture - Unit II - Sax
Service Oriented Architecture - Unit II - Sax Roselin Mary S
 
Service oriented architeture Unit 1
Service oriented architeture  Unit 1Service oriented architeture  Unit 1
Service oriented architeture Unit 1Roselin Mary S
 

More from Roselin Mary S (8)

Unit 2 hci in software process
Unit 2   hci in software processUnit 2   hci in software process
Unit 2 hci in software process
 
Unit1 17-08-2020 HUMAN COMPUTER INTERACTION
Unit1  17-08-2020 HUMAN COMPUTER INTERACTIONUnit1  17-08-2020 HUMAN COMPUTER INTERACTION
Unit1 17-08-2020 HUMAN COMPUTER INTERACTION
 
Unit 1 defects classes
Unit 1 defects classesUnit 1 defects classes
Unit 1 defects classes
 
Unit 1 part 2
Unit 1 part 2Unit 1 part 2
Unit 1 part 2
 
IT 8076 Software Testing Unit1
IT 8076 Software Testing Unit1IT 8076 Software Testing Unit1
IT 8076 Software Testing Unit1
 
Service Oriented Architecture -Unit II - Modeling databases in xml
Service Oriented Architecture -Unit II - Modeling databases in xml Service Oriented Architecture -Unit II - Modeling databases in xml
Service Oriented Architecture -Unit II - Modeling databases in xml
 
Service Oriented Architecture - Unit II - Sax
Service Oriented Architecture - Unit II - Sax Service Oriented Architecture - Unit II - Sax
Service Oriented Architecture - Unit II - Sax
 
Service oriented architeture Unit 1
Service oriented architeture  Unit 1Service oriented architeture  Unit 1
Service oriented architeture Unit 1
 

Recently uploaded

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 

Recently uploaded (20)

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 

Service Oriented Architecture- UNIT 2- XSL

  • 2. • XSL which stands for EXtensible Stylesheet Language. It is similar to XML as CSS is to HTML. Need for XSL • In case of HTML document, tags are predefined such as table, div, and span; and the browser knows how to add style to them and display those using CSS styles. • But in case of XML documents, tags are not predefined. In order to understand and style an XML document, World Wide Web Consortium (W3C) developed XSL which can act as XML based Stylesheet Language. • An XSL document specifies how a browser should render an XML document. • Following are the main parts of XSL − – XSLT − used to transform XML document into various other types of document. – XPath − used to navigate XML document. – XSL-FO − used to format XML document. 2Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 3. What is XSLT • XSLT, Extensible Stylesheet Language Transformations, provides the ability to transform XML data from one format to another automatically. How XSLT Works • An XSLT stylesheet is used to define the transformation rules to be applied on the target XML document. • XSLT stylesheet is written in XML format. XSLT Processor takes the XSLT stylesheet and applies the transformation rules on the target XML document and then it generates a formatted document in the form of XML, HTML, or text format. • This formatted document is then utilized by XSLT formatter to generate the actual output which is to be displayed to the end-user. Advantages • Independent of programming. Transformations are written in a separate xsl file which is again an XML document. • Output can be altered by simply modifying the transformations in xsl file. No need to change any code. So Web designers can edit the stylesheet and can see the change in the output quickly. 3 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 4. 4 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 5. students.xml <?xml version = "1.0"?> <class> <student rollno = "393"> <firstname>Dinkar</firstname> <lastname>Kad</lastname> <nickname>Dinkar</nickname> <marks>85</marks> </student> <student rollno = "493"> <firstname>Vaneet</firstname> <lastname>Gupta</lastname> <nickname>Vinni</nickname> <marks>95</marks> </student> <student rollno = "593"> <firstname>Jasvir</firstname> <lastname>Singh</lastname> <nickname>Jazz</nickname> <marks>90</marks> </student> </class> We need to define an XSLT style sheet document for the above XML document to meet the following criteria − •Page should have a title Students. •age should have a table of student details. •Columns should have following headers: Roll No, First Name, Last Name, Nick Name, Marks 5 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 6. Step 1: Create XSLT document Create an XSLT document to meet the above requirements, name it as students.xsl and save it in the same location where students.xml lies. students.xsl <?xml version = "1.0" encoding = "UTF-8"?> <!-- xsl stylesheet declaration with xsl namespace: Namespace tells the xlst processor about which element is to be processed and which is used for output purpose only --> <xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <!-- xsl template declaration: template tells the xlst processor about the section of xml document which is to be formatted. It takes an XPath expression. In our case, it is matching document root element and will tell processor to process the entire document with this template. --> <xsl:template match = "/"> <!-- HTML tags Used for formatting purpose. Processor will skip them and browser will simply render them. --> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> 6 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 7. <!-- for-each processing instruction Looks for each element matching the XPath expression --> <xsl:for-each select="class/student"> <tr> <!-- value-of processing instruction process the value of the element matching the XPath expression --> <td><xsl:value-of select = "@rollno"/></td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><xsl:value-of select = "marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> 7 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 8. Step 2: Link the XSLT Document to the XML Document Update student.xml document with the following xml-stylesheet tag. Set href value to students.xsl <?xml version = "1.0"?> <?xml-stylesheet type = "text/xsl" href = "students.xsl"?> <class> ... </class> 8 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 9. Step 3: View the XML Document in Internet Explorer students.xml <?xml version = "1.0"?> <?xml-stylesheet type = "text/xsl" href = "students.xsl"?> <class> <student rollno = "393"> <firstname>Dinkar</firstname> <lastname>Kad</lastname> <nickname>Dinkar</nickname> <marks>85</marks> </student> <student rollno = "493"> <firstname>Vaneet</firstname> <lastname>Gupta</lastname> <nickname>Vinni</nickname> <marks>95</marks> </student> <student rollno = "593"> <firstname>Jasvir</firstname> <lastname>Singh</lastname> <nickname>Jazz</nickname> <marks>90</marks> </student> </class> 9 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 10. XSLT <template> Name & Description 1 name Name of the element on which template is to be applied. 2 match Pattern which signifies the element(s) on which template is to be applied. 3 priority Priority number of a template. Matching template with low priority is not considered in from in front of high priority template. 4 mode Allows element to be processed multiple times to produce a different result each time. <xsl:template> defines a way to reuse templates in order to generate the desired output for nodes of a particular type/context. Declaration Following is the syntax declaration of <xsl:template> element. <xsl:template name = Qname match = Pattern priority = number mode = QName > </xsl:template> Attributes 10 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 11. Number of occurrences Unlimited Parent elements xsl:stylesheet, xsl:transform Child elements xsl:apply-imports,xsl:apply-templates,xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:number, xsl:param, xsl:processing-instruction, xsl:text, xsl:value- of, xsl:variable, output elements Elements students_imports.xsl <?xml version = "1.0" encoding = "UTF-8"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> <th>Last Name</th> <th>Nick Name</th> <th>Marks</th> </tr> 11 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 12. <xsl:for-each select = "class/student"> <tr> <td><xsl:value-of select = "@rollno"/></td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><xsl:value-of select = "marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> 12 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 13. XSLT <value-of> Sr.No Name & Description 1 Select XPath Expression to be evaluated in current context. 2 disable-outputescaping Default-"no". If "yes", output text will not escape xml characters from text. <xsl:value-of> tag puts the value of the selected node as per XPath expression, as text. Declaration Following is the syntax declaration of <xsl:value-of> element. <xsl:value-of select = Expression disable-output-escaping = "yes" | "no" > </xsl:value-of> Attributes Number of Occurrences Unlimited Parent elements xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:processing instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements Child elements None Elements 13 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 14. <?xml version = "1.0" encoding = "UTF-8"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> <th>Last Name</th> <th>Nick Name</th> <th>Marks</th> </tr> <xsl:for-each select = "class/student"> <tr> <td><xsl:value-of select = "@rollno"/></td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><xsl:value-of select = "marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> 14 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 15. XSLT <sort> Sr.No Name & Description 1 select Sorting key of the node. 2 lang Language alphabet used to determine sort order. 3 data-type Data type of the text. 4 order Sorting order. Default is "ascending". 5 case-order <xsl:sort> tag specifies a sort criteria on the nodes. Declaration Following is the syntax declaration of <xsl:sort> element. <xsl:sort select = string-expression lang = { nmtoken } data-type = { "text" | "number" | QName } order = { "ascending" | "descending" } case-order = { "upper-first" | "lower-first" } > </xsl:sort> Attributes 15 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 16. Number of occurrences Unlimited Parent elements xsl:apply-templates, xsl:for-each Child elements None Elements 16 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 17. students.xsl <?xml version = "1.0" encoding = "UTF-8"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> <th>Last Name</th> <th>Nick Name</th> <th>Marks</th> </tr> <xsl:for-each select = "class/student"> <xsl:sort select = "firstname"/> <tr> <td><xsl:value-of select = "@rollno"/></td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><xsl:value-of select = "marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> 17 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 18. XSLT <if> Sr.No Name & Description 1 test The condition in the xml data to test. Number of Occurrences Unlimited Parent elements xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements Child elements xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable, output elements <xsl:if> tag specifies a conditional test against the content of nodes. Declaration Following is the syntax declaration of <xsl:if> element. <xsl:if test = boolean-expression > </xsl:if> Attributes Elements 18 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY
  • 19. <?xml version = "1.0" encoding = "UTF-8"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> <th>Last Name</th> <th>Nick Name</th> <th>Marks</th> </tr> <xsl:for-each select = "class/student"> <xsl:if test = "marks > 90"> <tr> <td><xsl:value-of select = "@rollno"/></td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><xsl:value-of select = "marks"/></td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> 19 Dr.S.ROSELIN MARY, HOD/CSE, ANAND INSTITUTE OF HIGHER TECHNOLOGY