Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jacfpentester authored May 21, 2023
1 parent 37b23c2 commit 0f8283c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
Binary file added Examen/Captura.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions Examen/examen.xml
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>
75 changes: 75 additions & 0 deletions Examen/examen.xsl
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>

0 comments on commit 0f8283c

Please sign in to comment.