mirror of
https://gitlab.com/tutorial-java-rafa-munoz/tutorial-java-2024-25/LMSGI-2024-25.git
synced 2025-11-09 18:03:06 +01:00
feat(ch 6 & 7): added
This commit is contained in:
99
Unidad_06_XSL/Tutorial/xml-xsl-ejercicicio14.xsl
Normal file
99
Unidad_06_XSL/Tutorial/xml-xsl-ejercicicio14.xsl
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
|
||||
<xsl:output method="html" encoding="iso-8859-1"/>
|
||||
<xsl:template match="/marvel">
|
||||
<html>
|
||||
<head>
|
||||
<title>Superheroes</title>
|
||||
<xsl:call-template name="css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Superhéroes de Marvel</h1>
|
||||
<table border="1" with="90%">
|
||||
<xsl:call-template name="bucleForFila">
|
||||
<xsl:with-param name="i">1</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template name="bucleForFila">
|
||||
<xsl:param name="i"/>
|
||||
<xsl:if test="$i <= 11">
|
||||
<tr>
|
||||
<xsl:call-template name="bucleForColumna">
|
||||
<xsl:with-param name="i"><xsl:value-of select="$i"/></xsl:with-param>
|
||||
<xsl:with-param name="j">1</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</tr>
|
||||
<xsl:call-template name="bucleForFila">
|
||||
<xsl:with-param name="i"><xsl:value-of select="$i + 1"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="bucleForColumna">
|
||||
<xsl:param name="i"/>
|
||||
<xsl:param name="j"/>
|
||||
<xsl:if test="$j <= 8">
|
||||
<xsl:call-template name="celda">
|
||||
<xsl:with-param name="x"><xsl:value-of select="$j"/></xsl:with-param>
|
||||
<xsl:with-param name="y"><xsl:value-of select="$i"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="bucleForColumna">
|
||||
<xsl:with-param name="i"><xsl:value-of select="$i"/></xsl:with-param>
|
||||
<xsl:with-param name="j"><xsl:value-of select="$j + 1"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="celda">
|
||||
<xsl:param name="x"/>
|
||||
<xsl:param name="y"/>
|
||||
<td>
|
||||
<xsl:for-each select="/marvel/superheroe">
|
||||
<xsl:if test="@x = $x and @y = $y">
|
||||
<xsl:value-of select="@nombre"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template name="css">
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 50px;
|
||||
padding: 0px;
|
||||
background: #2372DE;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 11pt;
|
||||
color: #FFFFFF;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.tituloTabla {
|
||||
text-align:center;
|
||||
padding:15px;
|
||||
background-color:#330099;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
</style>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Reference in New Issue
Block a user