SlideShare a Scribd company logo
1 of 54
XSLT
Introduction
Extensible Stylesheet Language
Transformations.
XSLT transforms an XML document into
another XML document(generally more
expressive)
XSLT uses XPath to navigate in XML
documents
Itself is an XML document with a root
element stylesheet.
Example-01
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<?xml-stylesheet type="text/xsl" href="ex1.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.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.90</price>
<year>1988</year>
</cd>
<cd><title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
<cd><title>Still got the blues</title>
<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
<cd><title>Eros</title>
<artist>Eros Ramazzotti</artist>
<country>EU</country>
<company>BMG</company>
<price>9.90</price>
<year>1997</year>
</cd>
<cd><title>Maggie May</title>
<artist>Rod Stewart</artist>
<country>UK</country>
<company>Pickwick</company>
<price>8.50</price>

<cd>
<title>Romanza</title>
<artist>Andrea Bocelli</artist>
<country>EU</country>
<company>Polydor</company>
<price>10.80</price>
<year>1996</year>
</cd>
<cd>
<title>Black angel</title>
<artist>Savage Rose</artist>
<country>EU</country>
<company>Mega</company>
<price>10.90</price>
<year>1995</year>
</cd>
<cd>
<title>1999 Grammy Nominees</title>
<artist>Many</artist>
<country>USA</country>
<company>Grammy</company>
<price>10.20</price>
<year>1999</year>
</cd>
<cd>
<title>For the good times</title>
<artist>Kenny Rogers</artist>
<country>UK</country>
<company>Mucik Master</company>
<price>8.70</price>
<year>1995</year>
</cd>
Effect of Applying Stylesheet
Using CSS
The information can not be
rearranged(sorting etc.)
Information encoded in attributes can not
be exploited.
Additional structures can not be
introduced.
<?xml-stylesheet type="text/css"
href="ex_css.css"?>
ex_css.css
title{font-size:10;color:red;fontfamily:tahoma}
artist{font-size:24;color:blue}
XSLT
To transform an XML document into
another XML document, or another type of
document that is recognized by a browser,
like HTML and XHTML
Overcomes the limitations of the CSS





can add(remove) elements and attributes to (
from) the output file.
can also rearrange elements
can perform tests and make decisions about
which elements to hide and display
Declaration
Root element is “stylesheet”
Namespace:


http://www.w3.org/1999/XSL/Transform

To use this namespace, it is required to
include the attribute version="1.0".
Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Linking XSLT to XML Doc.
<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/xsl" href=“abc.xsl"?>
<root_element>
….
….
….

</root_element>
Template Element
Template is set of rules
The rules defined by template are applied when the
specified node is matched
Syntax:
 <xsl:template>
Attribute:
 The match attribute is used to associate a template
with an XML element.
 Value of match is an XPath expression.
 Eg: <xsl:template match="/">
For root element


<xsl:template match=" catalog/cd /title">
To select title element
Sample Template
<xsl:template match="title">
Title: <span style="color:blue">
<xsl:value-of select="."/></span>
<br />
</xsl:template>
value-of Element
to extract the value of a selected node and
add it to the output stream of the
transformation
Eg:


<xsl:value-of select="catalog/cd/title"/>

select attribute:



Value is “XPath Expression”
text contents of the node-set returned by the
XPath expression are placed in the result
tree.
for-each Element
Loop construct in XSLT
Eg:
<xsl:for-each select="catalog/cd">
…..
</xsl:for-each>
<xsl:for-each select="catalog/cd">
<xsl:value-of select="title"/>
<xsl:value-of select="artist"/>
</xsl:for-each>
The above piece of code will loop over all
the “cd” elements of “catalog” element.
For each of the cd elements the value of
element “title” and element “artist” will be
placed in the result tree.
ex1.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html> <body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body> </html>
</xsl:template>
</xsl:stylesheet>
Effect of Applying Stylesheet
apply-template Element
applies a template to the current element
or to the current element's child nodes.
select attribute:




it will process only the child element that
matches the value of the attribute.
It can be used to specify the order in which
child nodes are processed.
ex_apply.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0“ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html> <body>
<h2>My CD Collection</h2>
<xsl:apply-templates/>
</body> </html>
</xsl:template>
<xsl:template match="cd">
<p>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="artist"/>
</p>
</xsl:template>
<xsl:template match="title">
Title: <span style="color:blue">
<xsl:value-of select="."/></span> <br />
</xsl:template>
<xsl:template match="artist">
Artist: <span style="color:#00ff00">
<xsl:value-of select="."/></span> <br />
</xsl:template> </xsl:stylesheet>
sort Element
Sorts the output
Eg:
<xsl:for-each select="catalog/cd">
<xsl:sort select="artist“
order=“ascending”/>
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>

The result tree will have cd elements in the
ascending order of element artist.
if Element
put a conditional test against the content
of the XML file
Syntax:
<xsl:if test=“test_expression">
...some output if the expression is true...
</xsl:if>

test attribute:


Specifies the expression to be evaluated.
ex_if.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html> <body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<xsl:if test="price &gt; 10">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body> </html>
</xsl:template>
</xsl:stylesheet>
Multiple Conditional Tests
Apply “when”, “otherwise” and “choose”
element
ex_2.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0“ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<xsl:choose>
<xsl:when test="price &gt; 10">
<td bgcolor="yellow">
<xsl:value-of select="artist"/></td>
</xsl:when>
<xsl:when test="price &gt; 9">
<td bgcolor="green">
<xsl:value-of select="artist"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="artist"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each> </table>
</body> </html>
</xsl:template> </xsl:stylesheet>
Creating
Element/Attribute
Element “element” is used to create an
element.
Attribute “name” is used to specify the
name of the newly created element.
Value of attribute name is an XPath
expression.
Example
<?xml version = "1.0"?>
<sports>
<game title = "cricket">
<id>243</id>
<para> More popular among commonwealth nations. </para>
</game>
<game title = "baseball">
<id>431</id>
<para> More popular in America. </para>
</game>
<game title = "soccer">
<id>123</id>
<para>28 Most popular sport in the world. </para>
</game>
</sports>
stylesheet
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match = "sports">
<sports>
<xsl:apply-templates/>
</sports>
</xsl:template>
<xsl:template match = "game">
<xsl:element name = "{@title}">
<xsl:attribute name = "id">
<xsl:value-of select = "id"/>
</xsl:attribute>
<comment>
<xsl:value-of select = "para"/>
</comment>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
result.xml
<?xml version = "1.0" encoding = "UTF-8"?>
<sports>
<cricket id = "243">
<comment> More popular among commonwealth nations. </comment>
</cricket>
<baseball id = "431">
<comment> More popular in America. </comment>
</baseball>
<soccer id = "123">
<comment> Most popular sport in the world. </comment>
</soccer>
</sports>
Copying
To duplicate nodes from the source tree
into the result tree
Element “copy” is used to produce a
copy of the context node and place it in
the result tree.



Syntax: <xsl:copy>
child nodes and attributes of the current node
are not automatically copied!
Intro.xml
<?xml version = "1.0"?>
<?xml:stylesheet type = "text/xsl" href = "intro.xsl"?>
<myMessage>
<message>Welcome to XSLT!</message>
</myMessage>
Intro.xsl
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0“ xmlns:xsl = “http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "myMessage">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match = "message">
<xsl:copy>
How about &apos;Hi World&apos; for a change!
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Result.xml
<?xml version = "1.0"?>
<?xml:stylesheet type = "text/xsl" href = "intro.xsl"?>
<myMessage>
<message> How about „Hi World‟ for a change! </message>
</myMessage>
copy-of Element
creates a copy of the current node.
Namespace nodes, child nodes, and
attributes of the current node are
automatically copied as well
This element can be used to insert
multiple copies of the same node into
different places in the output.
stylesheet
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0”
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "myMessage">
<xsl:copy-of select = "."/>
</xsl:template>
</xsl:stylesheet>
result.xml
<?xml version = "1.0"?>
<?xml:stylesheet type = "text/xsl" href = "intro.xsl"?>
<myMessage>
<message>Welcome to XSLT!</message>
</myMessage>
Combining Stylesheets
import Element
local template has higher precedence than
the imported template
usage2.xsl
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0” xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "book">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match = "title">
<xsl:value-of select = "."/>
</xsl:template>
<xsl:template match = "author"><br/>
<p>Author:
<xsl:value-of select = "lastName"/>,
<xsl:value-of select = "firstName"/>
</p>
</xsl:template>
<xsl:template match = "*|text()"/>
</xsl:stylesheet>
usage1.xsl
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0”
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href = "usage2.xsl"/>
<xsl:template match = "title">
<h2>
<xsl:value-of select = "."/>
</h2>
</xsl:template>
</xsl:stylesheet>
Transformed xml
<html>
<body>
<h2>Deitel's XML Primer</h2>
<br>
<p>
Author: Deitel, Paul
</p>
</body>
</html>
include Element
Include element can be used to refer to
another xslt doc.
The attribute “href” specifies the path of
the xsl doc to be included.
The local and the included both the
templates have the same precedence.
If any conflict arises, the template that last
occurs is used.
usage.xsl
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<xsl:apply-templates select = "book"/>
</body>
</html>
</xsl:template>
<xsl:template match = "book">
<h2> <xsl:value-of select = "title"/> </h2>
<xsl:apply-templates/>
</xsl:template>
<xsl:include href = "author.xsl"/>
<xsl:include href = "chapters.xsl"/>
<xsl:template match = "*|text()"/>
</xsl:stylesheet>
author.xsl
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "author">
<p>Author:
<xsl:value-of select = "lastName"/>,
<xsl:value-of select = "firstName"/>
</p>
</xsl:template>
</xsl:stylesheet>
chapters.xsl
<?xml version = "1.0"?>
<xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "chapters">
Chapters:
<ul>
<xsl:apply-templates select = "chapter"/>
</ul>
</xsl:template>
<xsl:template match = "chapter">
<li>
<xsl:value-of select = "."/>
</li>
</xsl:template>
</xsl:stylesheet>
result.xml
<html>
<body>
<h2>Deitel‟s XML Primer</h2>
<p>Author:
Deitel, Paul</p>
Chapters:
<ul>
<li>Easy XML</li>
<li>XML Elements?</li>
</ul>
</body>
</html>
Variables
variable element is used to declare a local
or global variable.



global variable: declared as a top-level element
local variable: declared within a template

Once variable's value is set,it cannot be
changed or modifued
set value to a variable by the content of the
<xsl:variable> element or by the select
attribute

More Related Content

What's hot (20)

Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
Xslt
XsltXslt
Xslt
 
Xml p5 Lecture Notes
Xml p5 Lecture NotesXml p5 Lecture Notes
Xml p5 Lecture Notes
 
XML XSLT
XML XSLTXML XSLT
XML XSLT
 
Xml 2
Xml  2 Xml  2
Xml 2
 
XMLT
XMLTXMLT
XMLT
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
 
Xml Lecture Notes
Xml Lecture NotesXml Lecture Notes
Xml Lecture Notes
 
Xml part5
Xml part5Xml part5
Xml part5
 
Xml part4
Xml part4Xml part4
Xml part4
 
Xml p2 Lecture Notes
Xml p2 Lecture NotesXml p2 Lecture Notes
Xml p2 Lecture Notes
 
Xml schema
Xml schemaXml schema
Xml schema
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
Xml part3
Xml part3Xml part3
Xml part3
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
 
Xsd
XsdXsd
Xsd
 

Viewers also liked (20)

An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
eXtensible Markup Language APIs in Java 1.6 - Simple and efficient XML parsin...
eXtensible Markup Language APIs in Java 1.6 - Simple and efficient XML parsin...eXtensible Markup Language APIs in Java 1.6 - Simple and efficient XML parsin...
eXtensible Markup Language APIs in Java 1.6 - Simple and efficient XML parsin...
 
XML and XPath details
XML and XPath detailsXML and XPath details
XML and XPath details
 
Jaxb
JaxbJaxb
Jaxb
 
Xml material
Xml materialXml material
Xml material
 
Xml processors
Xml processorsXml processors
Xml processors
 
Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
 
XML SAX PARSING
XML SAX PARSING XML SAX PARSING
XML SAX PARSING
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
Xpath
XpathXpath
Xpath
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
XPath - XML Path Language
XPath - XML Path LanguageXPath - XML Path Language
XPath - XML Path Language
 
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOOverview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Xml dom
Xml domXml dom
Xml dom
 
Dtd
DtdDtd
Dtd
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
DOM ( Document Object Model )
DOM ( Document Object Model )DOM ( Document Object Model )
DOM ( Document Object Model )
 
XML Document Object Model (DOM)
XML Document Object Model (DOM)XML Document Object Model (DOM)
XML Document Object Model (DOM)
 

Similar to XSLT

Xml transformation language
Xml transformation languageXml transformation language
Xml transformation languagereshmavasudev
 
Week 12 xml and xsl
Week 12 xml and xslWeek 12 xml and xsl
Week 12 xml and xslhapy
 
"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
 
Service Oriented Architecture- UNIT 2- XSL
Service Oriented Architecture- UNIT 2- XSLService Oriented Architecture- UNIT 2- XSL
Service Oriented Architecture- UNIT 2- XSLRoselin Mary S
 
Service Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIService Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIRoselin Mary S
 
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld BookNet Canada
 
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
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Languageelliando dias
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureGarann Means
 

Similar to XSLT (20)

XSLT.ppt
XSLT.pptXSLT.ppt
XSLT.ppt
 
Xslt
XsltXslt
Xslt
 
DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
Xml transformation language
Xml transformation languageXml transformation language
Xml transformation language
 
Xml and xslt
Xml and xsltXml and xslt
Xml and xslt
 
Week 12 xml and xsl
Week 12 xml and xslWeek 12 xml and xsl
Week 12 xml and xsl
 
"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides"Getting Started with XSLT" presentation slides
"Getting Started with XSLT" presentation slides
 
Service Oriented Architecture- UNIT 2- XSL
Service Oriented Architecture- UNIT 2- XSLService Oriented Architecture- UNIT 2- XSL
Service Oriented Architecture- UNIT 2- XSL
 
Service Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIService Oriented Architecture - Unit II
Service Oriented Architecture - Unit II
 
XSLT presentation
XSLT presentationXSLT presentation
XSLT presentation
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 
Xsl xslt
Xsl  xsltXsl  xslt
Xsl xslt
 
XML for bioinformatics
XML for bioinformaticsXML for bioinformatics
XML for bioinformatics
 
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
 
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
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Language
 
Session 4
Session 4Session 4
Session 4
 
XSL- XSLT.pdf
XSL- XSLT.pdfXSL- XSLT.pdf
XSL- XSLT.pdf
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 

More from Surinder Kaur

More from Surinder Kaur (12)

Lucene
LuceneLucene
Lucene
 
Agile
AgileAgile
Agile
 
MapReduce
MapReduceMapReduce
MapReduce
 
Apache Hive
Apache HiveApache Hive
Apache Hive
 
JSON Parsing
JSON ParsingJSON Parsing
JSON Parsing
 
Analysis of Emergency Evacuation of Building using PEPA
Analysis of Emergency Evacuation of Building using PEPAAnalysis of Emergency Evacuation of Building using PEPA
Analysis of Emergency Evacuation of Building using PEPA
 
Skype
SkypeSkype
Skype
 
NAT
NATNAT
NAT
 
Dom
Dom Dom
Dom
 
java API for XML DOM
java API for XML DOMjava API for XML DOM
java API for XML DOM
 
intelligent sensors and sensor networks
intelligent sensors and sensor networksintelligent sensors and sensor networks
intelligent sensors and sensor networks
 
MPI n OpenMP
MPI n OpenMPMPI n OpenMP
MPI n OpenMP
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

XSLT

  • 2. Introduction Extensible Stylesheet Language Transformations. XSLT transforms an XML document into another XML document(generally more expressive) XSLT uses XPath to navigate in XML documents Itself is an XML document with a root element stylesheet.
  • 3. Example-01 <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <?xml-stylesheet type="text/xsl" href="ex1.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.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.90</price> <year>1988</year> </cd>
  • 4. <cd><title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd><title>Still got the blues</title> <artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd><title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> <cd><title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> <company>Pickwick</company> <price>8.50</price> <cd> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company> <price>10.80</price> <year>1996</year> </cd> <cd> <title>Black angel</title> <artist>Savage Rose</artist> <country>EU</country> <company>Mega</company> <price>10.90</price> <year>1995</year> </cd> <cd> <title>1999 Grammy Nominees</title> <artist>Many</artist> <country>USA</country> <company>Grammy</company> <price>10.20</price> <year>1999</year> </cd> <cd> <title>For the good times</title> <artist>Kenny Rogers</artist> <country>UK</country> <company>Mucik Master</company> <price>8.70</price> <year>1995</year> </cd>
  • 5. Effect of Applying Stylesheet
  • 6. Using CSS The information can not be rearranged(sorting etc.) Information encoded in attributes can not be exploited. Additional structures can not be introduced. <?xml-stylesheet type="text/css" href="ex_css.css"?>
  • 8.
  • 9. XSLT To transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML Overcomes the limitations of the CSS    can add(remove) elements and attributes to ( from) the output file. can also rearrange elements can perform tests and make decisions about which elements to hide and display
  • 10. Declaration Root element is “stylesheet” Namespace:  http://www.w3.org/1999/XSL/Transform To use this namespace, it is required to include the attribute version="1.0". Example: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  • 11. Linking XSLT to XML Doc. <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href=“abc.xsl"?> <root_element> …. …. …. </root_element>
  • 12. Template Element Template is set of rules The rules defined by template are applied when the specified node is matched Syntax:  <xsl:template> Attribute:  The match attribute is used to associate a template with an XML element.  Value of match is an XPath expression.  Eg: <xsl:template match="/"> For root element  <xsl:template match=" catalog/cd /title"> To select title element
  • 13. Sample Template <xsl:template match="title"> Title: <span style="color:blue"> <xsl:value-of select="."/></span> <br /> </xsl:template>
  • 14. value-of Element to extract the value of a selected node and add it to the output stream of the transformation Eg:  <xsl:value-of select="catalog/cd/title"/> select attribute:   Value is “XPath Expression” text contents of the node-set returned by the XPath expression are placed in the result tree.
  • 15. for-each Element Loop construct in XSLT Eg: <xsl:for-each select="catalog/cd"> ….. </xsl:for-each>
  • 16. <xsl:for-each select="catalog/cd"> <xsl:value-of select="title"/> <xsl:value-of select="artist"/> </xsl:for-each> The above piece of code will loop over all the “cd” elements of “catalog” element. For each of the cd elements the value of element “title” and element “artist” will be placed in the result tree.
  • 17. ex1.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
  • 18. Effect of Applying Stylesheet
  • 19. apply-template Element applies a template to the current element or to the current element's child nodes. select attribute:   it will process only the child element that matches the value of the attribute. It can be used to specify the order in which child nodes are processed.
  • 20. ex_apply.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0“ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="cd"> <p> <xsl:apply-templates select="title"/> <xsl:apply-templates select="artist"/> </p> </xsl:template> <xsl:template match="title"> Title: <span style="color:blue"> <xsl:value-of select="."/></span> <br /> </xsl:template> <xsl:template match="artist"> Artist: <span style="color:#00ff00"> <xsl:value-of select="."/></span> <br /> </xsl:template> </xsl:stylesheet>
  • 21.
  • 22. sort Element Sorts the output Eg: <xsl:for-each select="catalog/cd"> <xsl:sort select="artist“ order=“ascending”/> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> The result tree will have cd elements in the ascending order of element artist.
  • 23.
  • 24. if Element put a conditional test against the content of the XML file Syntax: <xsl:if test=“test_expression"> ...some output if the expression is true... </xsl:if> test attribute:  Specifies the expression to be evaluated.
  • 25. ex_if.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <xsl:if test="price &gt; 10"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
  • 26.
  • 27. Multiple Conditional Tests Apply “when”, “otherwise” and “choose” element
  • 28. ex_2.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0“ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr>
  • 29. <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <xsl:choose> <xsl:when test="price &gt; 10"> <td bgcolor="yellow"> <xsl:value-of select="artist"/></td> </xsl:when> <xsl:when test="price &gt; 9"> <td bgcolor="green"> <xsl:value-of select="artist"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="artist"/></td> </xsl:otherwise> </xsl:choose> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
  • 30.
  • 32. Element “element” is used to create an element. Attribute “name” is used to specify the name of the newly created element. Value of attribute name is an XPath expression.
  • 33. Example <?xml version = "1.0"?> <sports> <game title = "cricket"> <id>243</id> <para> More popular among commonwealth nations. </para> </game> <game title = "baseball"> <id>431</id> <para> More popular in America. </para> </game> <game title = "soccer"> <id>123</id> <para>28 Most popular sport in the world. </para> </game> </sports>
  • 34. stylesheet <?xml version = "1.0"?> <xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <xsl:apply-templates/> </xsl:template> <xsl:template match = "sports"> <sports> <xsl:apply-templates/> </sports> </xsl:template> <xsl:template match = "game"> <xsl:element name = "{@title}"> <xsl:attribute name = "id"> <xsl:value-of select = "id"/> </xsl:attribute> <comment> <xsl:value-of select = "para"/> </comment> </xsl:element> </xsl:template> </xsl:stylesheet>
  • 35. result.xml <?xml version = "1.0" encoding = "UTF-8"?> <sports> <cricket id = "243"> <comment> More popular among commonwealth nations. </comment> </cricket> <baseball id = "431"> <comment> More popular in America. </comment> </baseball> <soccer id = "123"> <comment> Most popular sport in the world. </comment> </soccer> </sports>
  • 37. To duplicate nodes from the source tree into the result tree Element “copy” is used to produce a copy of the context node and place it in the result tree.   Syntax: <xsl:copy> child nodes and attributes of the current node are not automatically copied!
  • 38. Intro.xml <?xml version = "1.0"?> <?xml:stylesheet type = "text/xsl" href = "intro.xsl"?> <myMessage> <message>Welcome to XSLT!</message> </myMessage>
  • 39. Intro.xsl <?xml version = "1.0"?> <xsl:stylesheet version = "1.0“ xmlns:xsl = “http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "myMessage"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match = "message"> <xsl:copy> How about &apos;Hi World&apos; for a change! </xsl:copy> </xsl:template> </xsl:stylesheet>
  • 40. Result.xml <?xml version = "1.0"?> <?xml:stylesheet type = "text/xsl" href = "intro.xsl"?> <myMessage> <message> How about „Hi World‟ for a change! </message> </myMessage>
  • 41. copy-of Element creates a copy of the current node. Namespace nodes, child nodes, and attributes of the current node are automatically copied as well This element can be used to insert multiple copies of the same node into different places in the output.
  • 42. stylesheet <?xml version = "1.0"?> <xsl:stylesheet version = "1.0” xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "myMessage"> <xsl:copy-of select = "."/> </xsl:template> </xsl:stylesheet>
  • 43. result.xml <?xml version = "1.0"?> <?xml:stylesheet type = "text/xsl" href = "intro.xsl"?> <myMessage> <message>Welcome to XSLT!</message> </myMessage>
  • 45. import Element local template has higher precedence than the imported template
  • 46. usage2.xsl <?xml version = "1.0"?> <xsl:stylesheet version = "1.0” xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "book"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match = "title"> <xsl:value-of select = "."/> </xsl:template> <xsl:template match = "author"><br/> <p>Author: <xsl:value-of select = "lastName"/>, <xsl:value-of select = "firstName"/> </p> </xsl:template> <xsl:template match = "*|text()"/> </xsl:stylesheet>
  • 47. usage1.xsl <?xml version = "1.0"?> <xsl:stylesheet version = "1.0” xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href = "usage2.xsl"/> <xsl:template match = "title"> <h2> <xsl:value-of select = "."/> </h2> </xsl:template> </xsl:stylesheet>
  • 48. Transformed xml <html> <body> <h2>Deitel's XML Primer</h2> <br> <p> Author: Deitel, Paul </p> </body> </html>
  • 49. include Element Include element can be used to refer to another xslt doc. The attribute “href” specifies the path of the xsl doc to be included. The local and the included both the templates have the same precedence. If any conflict arises, the template that last occurs is used.
  • 50. usage.xsl <?xml version = "1.0"?> <xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <xsl:apply-templates select = "book"/> </body> </html> </xsl:template> <xsl:template match = "book"> <h2> <xsl:value-of select = "title"/> </h2> <xsl:apply-templates/> </xsl:template> <xsl:include href = "author.xsl"/> <xsl:include href = "chapters.xsl"/> <xsl:template match = "*|text()"/> </xsl:stylesheet>
  • 51. author.xsl <?xml version = "1.0"?> <xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "author"> <p>Author: <xsl:value-of select = "lastName"/>, <xsl:value-of select = "firstName"/> </p> </xsl:template> </xsl:stylesheet>
  • 52. chapters.xsl <?xml version = "1.0"?> <xsl:stylesheet version = "1.0“ xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "chapters"> Chapters: <ul> <xsl:apply-templates select = "chapter"/> </ul> </xsl:template> <xsl:template match = "chapter"> <li> <xsl:value-of select = "."/> </li> </xsl:template> </xsl:stylesheet>
  • 53. result.xml <html> <body> <h2>Deitel‟s XML Primer</h2> <p>Author: Deitel, Paul</p> Chapters: <ul> <li>Easy XML</li> <li>XML Elements?</li> </ul> </body> </html>
  • 54. Variables variable element is used to declare a local or global variable.   global variable: declared as a top-level element local variable: declared within a template Once variable's value is set,it cannot be changed or modifued set value to a variable by the content of the <xsl:variable> element or by the select attribute