ordenar en una plantilla
Publicado por Mario (1 intervención) el 24/05/2013 20:26:55
Buenas, tenía este XSL que ordenaba una serie de libros nombre del autor, ahora tengo que hacer lo mismo pero sacándo en plantillas las diversas partes (segundo bloque de código), ¿Cómo lo puedo hacer?
Gracias
Gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<head>
<title></title>
</head>
<body>
<center>
<h1> MI BIBLIOTECA 2</h1>
<table border="1" align="center">
<tr bgcolor="LightSalmon">
<th>Título</th>
<th>Autor</th>
</tr>
<xsl:for-each select="Biblioteca/libro">
<xsl:sort select="autor/nombre"></xsl:sort>
<tr>
<td><xsl:value-of select="titulo"/></td>
<td><xsl:value-of select="autor/nombre"/> <xsl:value-of select="autor/apellidos"/></td>
</tr>
</xsl:for-each>
</table>
</center>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<body>
<center>
<h1> MI BIBLIOTECA p</h1>
<xsl:apply-templates />
</center>
</body>
</html>
</xsl:template>
<xsl:template match="Biblioteca">
<table border="1" align="center">
<tr bgcolor="LightSalmon">
<th>Título</th>
<th>Autor</th>
</tr>
<xsl:apply-templates select="libro"/>
</table>
</xsl:template>
<xsl:template match="libro">
<tr>
<xsl:apply-templates select="titulo"/>
<td><xsl:apply-templates select="autor"/></td>
</tr>
</xsl:template>
<xsl:template match="titulo">
<td align="center"><xsl:value-of select="."/></td>
</xsl:template>
<xsl:template match="autor">
<xsl:value-of select="nombre"/> <xsl:value-of select="apellidos"/>
</xsl:template>
</xsl:stylesheet>
Valora esta pregunta
0