-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37b23c2
commit 0f8283c
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<?xml-stylesheet type="text/xsl" href="examen.xsl"?> | ||
|
||
<concesionario codigo_unico="965874"> | ||
<coches> | ||
<coche codigo="A1"> | ||
<matricula disponible="true">1234-BBB</matricula> | ||
<plazas>4</plazas> | ||
<marca nombre="SEAT"/> | ||
<nombre_modelo>ALTEA</nombre_modelo> | ||
</coche> | ||
<coche codigo="B2"> | ||
<matricula disponible="false">5678-CCC</matricula> | ||
<plazas>5</plazas> | ||
<marca nombre="AUDI"/> | ||
<nombre_modelo>A4</nombre_modelo> | ||
</coche> | ||
<coche codigo="C3"> | ||
<matricula disponible="true">9067-DYC</matricula> | ||
<plazas>7</plazas> | ||
<marca nombre="RENAULT"/> | ||
<nombre_modelo>LAGUNA</nombre_modelo> | ||
</coche> | ||
</coches> | ||
</concesionario> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | ||
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" /> | ||
<!-- Plantilla raíz --> | ||
<xsl:template match="/concesionario"> | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<h1>CONCESIONARIO 965874</h1> | ||
<h2>Disponibilidad de automoviles</h2> | ||
<table cellpadding="10" border="3" style="solid" bordercolor="black"> | ||
<tr bgcolor="gray"> | ||
<th>Codigo</th> | ||
<th>Marca</th> | ||
<th>Modelo</th> | ||
<th>Matricula</th> | ||
<th>Plazas</th> | ||
</tr> | ||
<!-- recorremos todos los coche de coches --> | ||
<xsl:for-each select="coches/coche"> | ||
<!-- ordenamos por plazas --> | ||
<xsl:sort data-type="number" select="plazas" order="descending"/> | ||
<!-- realizamos una seleccion de los que tengan atributo disponible true | ||
en caso afirmativo creamos la fila de la columna y en cada celda metemos los parametros que nos piden | ||
en casode que no sea true lo mandamos a otherwise pues solo se supone que hay dos parametros true o false | ||
por lo crearemos la fila y cambiamos el fonso a rojo --> | ||
<xsl:choose> | ||
<xsl:when test="matricula/@disponible = 'true'"> | ||
<tr bgcolor="white"> | ||
<td> | ||
|
||
<xsl:value-of select="@codigo"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="marca/@nombre"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="nombre_modelo"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="matricula"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="plazas"/> | ||
</td> | ||
</tr> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<tr bgcolor="red"> | ||
<td> | ||
|
||
<xsl:value-of select="@codigo"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="marca/@nombre"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="nombre_modelo"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="matricula"/> | ||
</td> | ||
<td> | ||
<xsl:value-of select="plazas"/> | ||
</td> | ||
</tr> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:for-each> | ||
</table> | ||
</body> | ||
</html> | ||
</xsl:template> | ||
</xsl:stylesheet> |