TP DSS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

University of M'hamed Bouguerra Boumerdès

Faculty of Sciences - Department of Computer ScienceModule: DSS


Sector: L3 (ISIL)
Year: 2023-2024
Lab No. 3: XSLT
Objective: learn XSLT.
Noticed: Use the OXYGEN XML editor.

1. Provide the result of the transformation below on the document 'artiste.xml':


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:value-of select="//titre"/>
</xsl:template>
</xsl:stylesheet>
2. Modify it to obtain the list of all album titles and years of publications.
3. What does this transformation return?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
<xsl:template match="/">
<liste>
<xsl:apply-templates select="//artiste"/>
</liste>
</xsl:template>
</xsl:stylesheet>
4. Modify it to obtain the list of only artistes from Constantine country.
5. Provide the result of the transformation below.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html"
doctype-system="about:legacy-compat"
encoding="UTF-8"
indent="yes" />
<xsl:template match="CD">
<html>
<head> <title> <xsl:value-of select="@nom"/>
</title>
</head>
<body bgcolor="#ffffff">
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="artiste">
<h1 align="center"> <xsl:value-of select="@nom"/> </h1>
</xsl:template>
<xsl:template match="album">
<h1 align="left"> <xsl:value-of select="chansons/chanson"/> </h1>
</xsl:template>
</xsl:stylesheet>
6. Complete the following code to display the list of numbers, names, and cities of all artists.

<?xml version="1.0" encoding="UTF-8"?>


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="/">
<html>
<head><title>Liste des artistes</title></head>
<body>
<table border="1" > <tr><td>Numero</td><td>NOM</td><td>Ville</td></tr>
<xsl:apply-templates select="……."/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="artiste">
……..corps du template……………….
</xsl:template>
</xsl:stylesheet>

7. Modify this code to display the list of numbers, names, and cities of all artists, using “call template”.

8. Project to submit: You are asked to generate the HTML document that presents the list of all artists with
all their albums as shown in the image below. You are asked to use call-template