2. Introduction
• Stands for Extensible Styles Language
Transformations
• enables to transform XML documents into
another form
• For example, we can take XML document,
combine it with HTML/CSS, and it will look
completely different when viewing it in your
user agent/browser
3. XSLT Documents
• Is a valid XML document
• Consists of a number of
elements/tags/attributes
• These can be XSL elements or elements from
another language (such as HTML)
4. Processing a Transformation
• A transformation can take place in one of
three locations:
– On the server
– On the client (for example, your web browser)
– With a standalone program
6. XML Version
• XSL documents are also XML documents and
so we should include the XML version
• We should also set the standalone attribute to
no
<?xml version="1.0" standalone="no"?>
7. XSL Root Element
• Root element needs to include the XSL version
as well as the XSL namespace
8. XSL Namespace Prefix
• All XSL elements in XSLT document must include
the XSL prefix
• Syntax:
<xsl:element_name>
• Example:
<xsl:template match="/">
....
</xsl:template>
9. XSLT <template> Element
• The <xsl:template> element is what we use to
select a node from XML document and
transform its contents
• To select an element, we use the match
attribute.
• To transform its contents, we simply place the
new content between the opening
(<xsl:template>) and closing (</xsl:template>)
tags
15. XSLT <apply-templates> Element
• <xsl:template> element allows us to select any
node in our XML document and transform its
contents
• We can also use this element to work with the
children of that node.
• <xsl:apply-templates/> element allows us to
determine where the content of its children
appear on our transformed document
18. XSLT <value-of> Element
• <xsl:value-of> element allows to retrieve the
value from a node
• When using the <xsl:value-of> element, we
use the select attribute to specify which node
we want to retrieve data from
21. XSLT <for-each> Element
• <xsl:for-each> element allows to loop through
multiple nodes that match the selection
criteria
• This in turn, enables to retrieve data from
these nodes
• <xsl:for-each> is used in conjunction with
<xsl:value-of>