Práctica Pokémon XSLT con Lenguaje de Marcas

Classified in Arts and Humanities

Written on in English with a size of 6.71 KB

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"><html><head><title>Práctica Pokémon XSLT</title><link rel="stylesheet" type="text/css" href="Practica5_OchandoRodriguezAdrian.css"/></head><body id="cuerpo"> <xsl:apply-templates/></body></html> </xsl:template> <xsl:template match="jugador"><div id="cabecera"><h2>Mi aplicación Pokémon</h2></div><div id="fondo"><div id="menu"><div id="playerData"><h3>Ficha del Entrenador</h3><div id="entrenador"> <xsl:choose> <xsl:when test="./chico"> <img src="files/chico.jpg" alt="Entrenador Chico"/> </xsl:when> <xsl:when test="./chica"> <img src="files/chica.jpg" alt="Entrenadora Chica"/> </xsl:when> </xsl:choose><p><b><xsl:value-of select="./nombre"/></b></p> <xsl:choose> <xsl:when test="./chico"><p>Chico</p> </xsl:when> <xsl:when test="./chica"><p>Chica</p> </xsl:when> </xsl:choose><p><xsl:value-of select="./fechaNacimiento"/></p><p><u><a href="#">Ver ficha de entrenador</a></u></p></div><h3>Estadísticas</h3> <xsl:apply-templates select="mochila"/><h3>Pokémon</h3><div id="menuPokemon"> <xsl:for-each select="mochila/pokemon"> <xsl:sort select="@especie"/><p><img src="files/pokeball.png" alt="Pokeball"/><a href="#{@especie}"><xsl:value-of select="@especie"/></a></p> </xsl:for-each></div></div></div><div id="pokedex"> <xsl:apply-templates select="mochila/pokemon"/></div><div id="copyright"><p>Lenguaje de Marcas - IES VILLAVERDE 2018/2019 &#169;</p></div></div> </xsl:template> <xsl:template match="mochila"><div id="estadisticas"><p>Pokécuartos: <xsl:value-of select="../pokecuartos"/></p><p>Pokéballs: <xsl:value-of select="./pokeball"/></p><p>Pokémon: <xsl:value-of select="count(./pokemon)"/></p><p>Su nombre tiene <xsl:value-of select="string-length(../nombre)"/> letras</p><p>Pokémon de mayor nivel: <xsl:for-each select="./pokemon/nivel"><xsl:sort select="." data-type="number" order="descending"/><xsl:if test="position() = 1"><xsl:value-of select="../@especie"/></xsl:if></xsl:for-each></p><p>Pokémon de tipo Fuego: <xsl:value-of select="count(./pokemon[contains(tipo, 'Fuego')])"/></p><p>Pokémon de tipo Agua: <xsl:value-of select="count(./pokemon[contains(tipo, 'Agua')])"/></p><p>Pokémon de tipo Insecto: <xsl:value-of select="count(./pokemon[contains(tipo, 'Bicho')])"/></p><p>Pokémon de tipo Oscuridad: <xsl:value-of select="count(./pokemon[contains(tipo, 'Siniestro')])"/></p><p>Pokémon de tipo Dragón: <xsl:value-of select="count(./pokemon[contains(tipo, 'Dragón')])"/></p><p>Pokémon de tipo Eléctrico: <xsl:value-of select="count(./pokemon[contains(tipo, 'Eléctrico')])"/></p><p>Pokémon de tipo Hada: <xsl:value-of select="count(./pokemon[contains(tipo, 'Hada')])"/></p><p>Pokémon de tipo Lucha: <xsl:value-of select="count(./pokemon[contains(tipo, 'Lucha')])"/></p><p>Pokémon de tipo Volador: <xsl:value-of select="count(./pokemon[contains(tipo, 'Volador')])"/></p><p>Pokémon de tipo Fantasma: <xsl:value-of select="count(./pokemon[contains(tipo, 'Fantasma')])"/></p><p>Pokémon de tipo Tierra: <xsl:value-of select="count(./pokemon[contains(tipo, 'Tierra')])"/></p><p>Pokémon de tipo Hielo: <xsl:value-of select="count(./pokemon[contains(tipo, 'Hielo')])"/></p><p>Pokémon de tipo Normal: <xsl:value-of select="count(./pokemon[contains(tipo, 'Normal')])"/></p><p>Pokémon de tipo Veneno: <xsl:value-of select="count(./pokemon[contains(tipo, 'Veneno')])"/></p><p>Pokémon de tipo Psíquico: <xsl:value-of select="count(./pokemon[contains(tipo, 'Psíquico')])"/></p><p>Pokémon de tipo Roca: <xsl:value-of select="count(./pokemon[contains(tipo, 'Roca')])"/></p><p>Pokémon de tipo Acero: <xsl:value-of select="count(./pokemon[contains(tipo, 'Acero')])"/></p></div> </xsl:template> <xsl:template match="mochila/pokemon"><div class="cajaPokemon"><h4 id="{@especie}"># <xsl:value-of select="@especie"/></h4><img src="pokesprites/{@especie}.png" alt="{@especie}"/><div id="dataPokemon"><p><xsl:value-of select="tipo"/></p><p>PS: <xsl:value-of select="ps"/> ATK: <xsl:value-of select="ataque"/> DEF: <xsl:value-of select="defensa"/></p> <xsl:choose> <xsl:when test="pokemontura"><p class="pokemontura">Pokemontura</p> </xsl:when> </xsl:choose></div><div id="selectMote"> <xsl:apply-templates select="mote"/></div></div> </xsl:template> <xsl:template match="mote"><p>Este pokémon <xsl:value-of select="../@especie"/> fue capturado el <b><xsl:value-of select="../@fecha_captura"/></b> y fue llamado <b><xsl:value-of select="."/></b> por su entrenador. <xsl:choose> <xsl:when test="."> Un mote único que refleja el inicio de una amistad llena de cariño mutuo. </xsl:when> <xsl:otherwise> El mote refleja la originalidad del entrenador. </xsl:otherwise> <xsl:choose> Actualmente <xsl:value-of select="."/> se encuentra en nivel: <b><xsl:value-of select="../nivel"/></b></p> </xsl:template></xsl:stylesheet></div>

Related entries: