0% found this document useful (0 votes)
2 views49 pages

XSLT

The document provides an overview of eXtensible Stylesheet Language (XSL) and its transformation capabilities using XSLT, which is a language for transforming XML documents into formats like XHTML and PDF. It details the components of XSL, including XSLT, XPath, and XSL-FO, and explains how to create and apply XSL stylesheets to XML documents. Additionally, it covers various elements and functions within XSLT, such as templates, loops, sorting, filtering, and conditional statements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views49 pages

XSLT

The document provides an overview of eXtensible Stylesheet Language (XSL) and its transformation capabilities using XSLT, which is a language for transforming XML documents into formats like XHTML and PDF. It details the components of XSL, including XSLT, XPath, and XSL-FO, and explains how to create and apply XSL stylesheets to XML documents. Additionally, it covers various elements and functions within XSLT, such as templates, loops, sorting, filtering, and conditional statements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

eXtensible Stylesheet Language

Transformation

Ahmed ZELLOU
[email protected]
Sup-MTI, 2024-2025.
XSLT
XSL

n XSL (Extensible Stylesheet Language) is a style sheet language


for XML.
n It describes how an XML document will be displayed on a
device.
n Used primarily to transform XML documents into other
formats, such as XHTML.
n XSL contains three parts:
n XSLT: to transform an XML document into other
formats, such as XHTML.
n Xpath: to navigate within an XML document.

n XSL-FO (formatting objects) : to transform an XML

document into PDF.


2
@ A.ZELLOU, XML Technology
XSLT
Introduction

n XSLT is a language for transforming XML documents into


XHTML or other XML documents.
n Means XSL transformation

n The most important part of XSL

n Use Xpath to navigate through XML documents


n A W3C Recommendation.

n Three versions: 1.0 (1999), 2.0 (2007) and 3.0 since

2017.

n XSLT transforms an XML source tree into an XML result tree.

3
@ A.ZELLOU, XML Technology
XSLT
Introduction

n Xpath is used to navigate through XML document elements and


attributes .

n XSLT allows to:


n Add/remove elements and attributes from the resulting
file.
n Rearrange the elements in the resulting file.

n Apply tests on the source file

n Loop over elements and attributes

n Sort the items in the resulting file.

n Create new elements, attributes, variables, comments, etc.

4
@ A.ZELLOU, XML Technology
XSLT
XSLT Transformation

n Namespace
n xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Let's take an XML document


<?xml version="1.0" encoding="ISO-8859-1"?>
<Library>
<Book num="B1">
<title>The World of Web Services</title>
<author>Ahmed ZELLOU</author>
<country>Morocco</country>
<editor>Eyrolles</editor>
<price>120.00</price>
<year>2011</year>
</Book>
..
</Library>
5
@ A.ZELLOU, XML Technology
XSLT
XSLT Transformation

n Linking to the XML file:


n Add the XSL reference into the XML document
("library.xml") and display the result using a browser

<?xml version="1.0 » encoding="ISO-8859-1"?>


<?xml-stylesheet type="text/xsl" href= "library.xsl"?>
<Library>
<Book num="B1">
<title>The World of Web Services</title>
<author>Ahmed ZELLOU</author>
<country>Morocco</country>
<editor>Eyrolles</editor>
<price>120.00</price>
<year>2011</year>
</Book>
..
</Library> 6
@ A.ZELLOU, XML Technology
XSLT
XSLT Interpretation

n Most browsers support XSLT.


n In Oxygen, create an execution scenario.
n xsltproc is (command line) tool to perform the
transformation
n xsltproc file.xsl file.xml > test.html

7
@ A.ZELLOU, XML Technology
XSLT
XSLT Transformation

n To transform an XML file to XHTML through XSLT:

n Add a a style sheet declaration


n The root element of an XSL document is :
<xsl:stylesheet> Or <xsl:transform>.
n Note: <xsl:stylesheet> And <xsl:transform> are
completely synonymous.

n To declare an XSL stylesheet according to the W3C XSLT


recommendation:
n <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
n Or:
n <xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
8
@ A.ZELLOU, XML Technology
XSLT
XSLT Transformation

n An XSL stylesheet consists of one or more named rules


templates (Models).
n The element <xsl:template> is used to build a display model.
n The template contains rules that apply when a specific node is
found.
n The match attribute is used to associate the model with an XML
element.
n This attribute can also be used to define a template for the
whole XML document.(match = "/").

9
@ A.ZELLOU, XML Technology
XSLT
The <xsl:template> element

n Let's take a simplified version of the XSL file:


<?xml version="1.0" encoding="ISO-8859-1"?> An XSL stylesheet is an
<xsl:stylesheet version="1.0" XML document, it always
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> starts with the prologue
<xsl:template match="/">
<html> <xsl:stylesheet> indicates
<body> that this document is an
XSLT stylesheet.
<h2>My Book Collection</h2>
<table border="1"> <xsl:template> defines a
<tr bgcolor="#9acd32"> template, the match="/" attribute
<th>Title</th> associates the template with the
<th>Author</th> root of the XML document source.
</tr>
<tr>
<td>.</td> The content inside the
<td>.</td> <xsl:template> element defines
</tr> HTML tags for the resulting
</table> document.
</body>
</html> Define the end of the template
</xsl:template> and the end of10the style sheet.
</xsl:stylesheet> @ A.ZELLOU, XML Technology
XSLT
The <xsl:value-of> element

n Input
<note>He teaches<mat>XML</mat></note>
n Script
<xsl:template match="note">
<xsl:value-of select="."/>
</xsl:template>
n Output
He teaches XML

11
@ A.ZELLOU, XML Technology
XSLT
The text() element

n Input
<note>He teaches<mat>XML</mat></note>

n Script
<xsl:template match="note">
<xsl:value-of select="text()"/>
</xsl:template>

n Output
He teaches

n Only the first item is selected


12
@ A.ZELLOU, XML Technology
XSLT
The <xsl:value-of> element

n Used to extract the value of a node:


<?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="/Library">
<html> <body>
<h2>My Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32"> The value of the select attribute is
<th>Title</th> an XPath expression.
<th>Author</th>
</tr>
<tr>
<td><xsl:value-of select="Book/title"/></td>
<td><xsl:value-of select="Book/author"/></td>
</tr>
</table>
An XPath expression is like navigating file
</body> </html> system, where slash (/) selects
</xsl:template> subdirectories.
</xsl:stylesheet>
13
@ A.ZELLOU, XML Technology
XSLT
The <xsl:for-each> element

n Used to loop over XML elements in a node-set.


<?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 Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th> <th>Author</th>
</tr>
<xsl:for-each select="Library/Book">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
</tr>
</xsl:for-each>
</table> </body> </html>
</xsl:template> </xsl:stylesheet>

14
@ A.ZELLOU, XML Technology
XSLT
The <xsl:sort> element

n Used to sort the result inside the element <xsl:for-each>


<?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 Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th> <th>Author</th>
</tr>
<xsl:for-eachselect="Library/Book">
<xsl:sort select="author"/>
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
</tr>
</xsl:for-each>
</table></body> </html>
</xsl:template>
</xsl:stylesheet> 15
@ A.ZELLOU, XML Technology
XSLT
The <xsl:sort> element

n Some attributes of <xsl:sort> :

n order: the sorting direction (ascending or descending)

n lang: the language of the sorting criterion

n data-type: the nature of the sort key (text, number)

n case-order (upper-first, lower-first)

16
@ A.ZELLOU, XML Technology
XSLT
Tests

n Filter the result


n To filter the result, we add a criterion to select the

attribute in the element <xsl:for-each>.

n Example :
n <xsl:for-each select="Library/Book[author='Choukri']">

n The authorized filtering operators are:


n = (equal)

n ! = (Different)

n < less than

n > greater than

17
@ A.ZELLOU, XML Technology
XSLT
Tests

n Filter the result: Example


<?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 Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th> <th>Author</th>
</tr>
<xsl:for-each select="Library/Book[author='Choukri']"><tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet> 18
@ A.ZELLOU, XML Technology
XSLT
The <xsl:if> element

n Used to put a conditional test on the contents of the XML file.

n Syntax
<xsl:if test="expression">
... result if the test is true ...
</xsl:if>

n Where to put it?


n Inside the element <xsl:for-each> in the XSL file.

19
@ A.ZELLOU, XML Technology
XSLT
The <xsl:if> element

n The value of the attribute test contains the expression to be evaluated.


<?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 Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th> <th>Author</th>
</tr>
<xsl:for-each select="Library/Book">
<xsl:if test="price > 10">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
</tr> The example displays the title
</xsl:if> and author of books that have
</xsl:for-each> a price greater than 10.
</table></body> </html>
</xsl:template> 20
</xsl:stylesheet> @ A.ZELLOU, XML Technology
XSLT
The <xsl:if> element

Example
<?xmlversion="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th> <th>Author</th> This example adds a purple background to
</tr> the "Author" column when the book price is
<xsl:for-each select="Library/Book"> greater than 10.
<tr>
<td><xsl:value-of select="title"/></td>
<xsl:if test="price > 10">
<td bgcolor="#ff00ff"><xsl:value-of select="author"/></td>
</xsl:if>
<xsl:if test="price ≤ 10">
<td bgcolor="#00ff00"><xsl:value-of select="author"/></td>
</xsl:if>
</tr>
</xsl:for-each>
</table> </body> </html> 21
</xsl:template> </xsl:stylesheet> @ A.ZELLOU, XML Technology
XSLT
The <xsl:choose> element

n Used with <xsl:when> And <xsl:otherwise> to express multiple


conditional tests.

n Syntax
<xsl:choose>
<xsl:when test="expression">
... Output elements ...
</xsl:when>
<xsl:otherwise>
... Output elements ....
</xsl:otherwise>
</xsl:choose>

22
@ A.ZELLOU, XML Technology
XSLT
The <xsl:choose> element

n Example with when and otherwise:


<?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 Books Collection</h2>
<table border="1">
<tr bgcolor="#9acd32"> The example adds a purple background to
<th>Title</th> <th>Artist</th> </tr> the "Author" column when the book price is
<xsl:for-each select="Library/Book"> greater than 10, and a blue background
<tr> when the book price is greater than 9 and
<td><xsl:value-of select="title"/></td> less than or equal to 10. Otherwise, it is
<xsl:choose> without background.
<xsl:when test="price > 10">
<td bgcolor="#ff00ff"> <xsl:value-of select="author"/></td>
</xsl:when>
<xsl:when test="price > 9">
<td bgcolor="#0000ff"> <xsl:value-of select="author"/></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> 23
@ A.ZELLOU, XML Technology
XSLT
The <xsl:text> element

n XSL does not support whitespace characters:


n Only five predefined entities, not &nbsp;
n Allows to inject spaces, tabs or break line into
the output document
n Also to inject free texts into an output

<xsl:text disable-output-escaping="yes"> </xsl:text>

24
@ A.ZELLOU, XML Technology
XSLT
Output Types
n Three types of output document:
n xml: default output
<xsl:output method="xml">

n html :
<xsl:output method="html">

n text: native code, RTF, LaTex


<xsl:output method="text">

n By default, xml, unless the first tag in the result tree is <html>.

25
@ A.ZELLOU, XML Technology
XSLT
The <xsl:element> element

n Allows to create an element (Transformation)

<xsl:output method="xml" indent="yes"/>

<xsl:template match="path">
<xsl:element name="name">
<xsl:value-of select="value"/>
</xsl:element>
</xsl:template>

26
@ A.ZELLOU, XML Technology
XSLT
The <xsl:attribute> element
n Allows to create an attribute
<xsl:output method="xml" indent="yes"/>

<xsl:template match="path">
<xsl:element name="name">
<xsl:value-of select="value"/>
<xsl:attribute name="name">
<xsl:value-of select="value"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

27
@ A.ZELLOU, XML Technology
XSLT
The element { }

n Input
<a href="file.txt"/>
n Script
<xsl:template match="a">
<b id="{@href}"/>
</xsl:template>
n Output
<b id="file.txt"/>

n Other script
<xsl:template match="a">
<b><xsl:attribut name="id">
<xsl:value-of select="@href"/>
</xsl:attribut</b>
28
</xsl:template> @ A.ZELLOU, XML Technology
XSLT
The name() element

n Input
<note>He teaches
<mat>XML</mat>
</note>

n Script
<xsl:template match=".">
<xsl:value-of select="name()"/>
</xsl:template>

n Output Shaft
note
29
@ A.ZELLOU, XML Technology
XSLT
The <xsl:variable> element

n Variable 1st Declaration


<xsl:variable name="backcolor" select="'#FFFFCC'" />

n Variable 2nd Declaration


<xsl:variable name="backcolor">#FFFFCC</xsl:variable>

n Reference to a variable
<BODY BGCOLOR='{$backcolor}'>

n NB
n A variable cannot be reassigned (constants)

30
@ A.ZELLOU, XML Technology
XSLT
Passing parameters

n Declaration (formal parameter)


<xsl:template match=".">
<xsl:param name="p" select="0"/>
... use of p ...
</xsl:template>

n Get the value of a parameter


select="$p"

n Call (effective parameter)


<xsl:apply-templates>
<xsl:with-param name="p" select="$p+1"/>
</xsl:apply-templates>

31
@ A.ZELLOU, XML Technology
XSLT
Passing parameters

n Direct descendant parameters of an <xsl:stylesheet>


element are allowed

<xsl:stylesheet>
<xsl:param name="dir" select="'myDir'"/>
...
</xsl:stylesheet>

n Equivalent to

dir='myDir'

32
@ A.ZELLOU, XML Technology
XSLT
The <xsl:number> element

n To number nodes in a document based on their


position in the source tree:

n level: to specify the level in the tree


n from: starting point of the numbering
n format: numbering display format

33
@ A.ZELLOU, XML Technology
XSLT
The <xsl:message> element

n Input
<xsl:message>
code= <xsl:value-of select="$code"/>
</xsl:message>

n Output

code = 25

34
@ A.ZELLOU, XML Technology
XSLT
The <xsl:copy-of> element

n Creates a copy of a node


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="header">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
</xsl:variable>
<xsl:template match="/">
<html>
<body>
<h2>My Book Collection</h2>
<table border="1">
<xsl:copy-of select="$header"/>
<xsl:for-each select="Biblio/Book/Title">

35
@ A.ZELLOU, XML Technology
XSLT
<xsl:comment> & <xsl:import>
n To get the comments out
<xsl:template match="comment()">
<xsl:comment>
<xsl:value-of select="."/>
</xsl:comment>
</xsl:template>

n Modularity of style sheets


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="ISO-8859-1" indent="yes"/>
<xsl:import href="sheet1.xsl"/>
...
</xsl:stylesheet> 36
@ A.ZELLOU, XML Technology
XSLT
Others

n Modularize the stylesheet


n <xsl:include>
n Includes the referenced stylesheet.
n <xsl:include href="uri-reference"/>
n Same as the precedence: the templates behave
like those of the stylesheet.

n Manage spaces
n <xsl:strip-space>
n does not preserve spaces in elements
n <xsl:preserve-space>
n preserves spaces in elements

37
@ A.ZELLOU, XML Technology
XSLT
Others

n <xsl:key>
n Associate an identifier to a node

n <xsl:decimal-format>
n Define a model for representing decimal numbers
(useful if internationalization)

n <xsl:attribute-set>
n Declares a set of reusable attributes

38
@ A.ZELLOU, XML Technology
XSLT
The Templates

n Two Programming Styles

n Iterative via the select attribute


<xsl:for-each>

n Recursive
<xsl:apply-templates>

n Statement
<xsl:template name="...">
...
</xsl:template>
n Call
<xsl:call-template> or <xsl:apply-templates>
39
@ A.ZELLOU, XML Technology
XSLT

<xsl:apply-templates> element
n The element <xsl:apply-templates> applies a template.

n The select attribute <xsl:apply-templates>, specifies the source


to apply the model.

n We can use the attributeselectto specify the order in which child


nodes will be processed.

40
A.ZELLOU
XSLT
The Templates
n Example
<xsl:template name="navbar">
<a href="index.htm">Home</a>|
<a href="help.htm">Help</a> |
<a href="toc.htm">Contents</a>
</xsl:template>

<xsl:template match="mainblock">
<body>
<xsl:call-template name="navbar"/>
<xsl:apply-templates/>
<xsl:call-template name="navbar"/>
</body>
</xsl:template>
41
@ A.ZELLOU, XML Technology
XSLT

<xsl:apply-templates> element
n Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" Which gives as a result
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My Books Collection</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="Biblio/Book">
<p>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="author"/>
</p>
</xsl:template>
<xsl:template match="title">
Title: <span style="color:#ff0000">
<xsl:value-of select="."/></span>
<br />
</xsl:template>
<xsl:template match="author">
Artist: <span style="color:#00ff00">
<xsl:value-of select="."/></span>
<br /> 42
</xsl:template></xsl:stylesheet>
A.ZELLOU
XSLT

XSLT - reference
Element Description
apply-imports Applies a template rule from an imported style sheet
apply-templates Applies a template rule to the current element or to the child node of the
current element
attribute Add an attribute
attribute-set Defines a named set of attributes
call template Calls a named model
choose Used with <when> and <otherwise> to express multiple conditional tests
comment Creates a comment node in the result tree
copy Creates a copy of the current node (without child nodes and without attributes)
copy-of Creates a copy of the current node (with child nodes and attributes)
decimal-format Defines the characters and symbols to use when converting numbers to strings
with the format-number() function.
element Creates an element node in the resulting document
fallback Specifies an alternative code to execute if the processor
43
does not support an
XSLT element.
A.ZELLOU
XSLT

XSLT - reference
Element Description
for-each Loop through each node in a specified node set
if Contains a template that will be applied if a specified condition is true
import Imports the contents of one style sheet into another. Note: An
imported style sheet has lower priority than the main style sheet.
include Include the contents of one style sheet within another. Note: An
included style sheet has the same priority as the main style sheet.
key Declares a named key that can be used in the stylesheet with the key()
function
message Writes a message on exit (used to report errors)
namespace-alias Replaces a namespace in the stylesheet with another namespace in the
result
number Determines the position of the current node (returns a number)
otherwise Specifies a default action for the <choose> element
output Sets the format of the result document
44
A.ZELLOU
XSLT

XSLT - reference
Element Description
param Declares a parameter
preserve-space Defines the elements for which spaces should be preserved
processing Write a processing instruction
instruction
sort Sort
strip space Defines the elements for which white spaces should be removed
stylesheet Defines the root element of the style sheet
template Rules to apply when a specified node is found
text Write a literal text
transform Sets the root element of the style sheet
value-of Extracts the value of a selected node
variable Declare a variable
when Specifies an action for the <choose> element
with-param Sets the value of a parameter to pass to a template 45
A.ZELLOU
XSLT

Some XSLT functions

Name Description
current() Returns the current node
document() Used to access nodes in an external XML document
element- Tests if an element is supported by the XSLT processor
available()
format-number() Converts a number to a string
function- Tests if a function is supported by the XSLT processor
available()
generate-id() Returns a string that uniquely identifies a specified node
key() Returns a set of nodes using the index specified by an <xsl:key> element
system-property() Returns system properties
unparsed-entity- Returns the URI of an unparsed entity
uri()

46
A.ZELLOU
XSLT

Conclusion
n XSLT is a language for transforming XML documents
into XHTML or other XML documents.
n The most important part of XSL.
n Uses XPath to navigate XML documents
n Allows to show, hide, reorganize, sort, perform tests
on elements and attributes of the resulting file.
n XSLT is a real programming language
n XSLT has no equivalent language for tree
transformation
n But, developing XSLT programs can be "hard"
47
A.ZELLOU
XSLT

Workshop
1. Create an XML file "books.xml" containing a collection of
books.
a. A Library contains multiple books. A book contain a title,
an author, a year, a price and an ISBN attribute.
2. Write an XSLT stylesheet to transform the books.xml file into
an HTML document. The output should contain a table where:
a. Each book is a row.
b. The columns should include Title, ISBN, Author and Price.
c. Sort by Year.
d. Add an additional column for a formatted Discount Price
(e.g., 90% of the price).

48
A.ZELLOU
End

You might also like