I generated an HTML table with 2 cells per row following instructions according to this post from StackOverflow
But I want to distribute my data in an HTML table with three cells per row. I changed the numbers for sibling and the calculation for position in the XSLT stylesheet from the post but it doesn't seem to work.
This is my XML source:
<?xml version="1.0" encoding="UTF-8"?>
<report>
<frontmatter>
<title>Relatório da 4ª Sessão Intercalar</title>
<subtitle>Projecto Integrado de Engenharia de Linguagens</subtitle>
<authors>
<author>
<name>Marina Mac</name>
<nident>pg999</nident>
<email>pg999@minho.pt</email>
<url>https://www.linkedin.com</url>
<affil>Universidade do Minho</affil>
<photo>source/img/authors/marina.png</photo>
</author>
<author>
<name>Nuno Vie</name>
<nident>pg998</nident>
<email>pg998@minho.pt</email>
<url>https://www.linkedin.com</url>
<photo>source/img/authors/nuno.jpg</photo>
<affil>Universidade do Minho</affil>
</author>
<author>
<name>Damien Va</name>
<nident>pg997</nident>
<photo>source/img/authors/damien.jpg</photo>
<url>https://www.linkedin.com</url>
<email>pg997@minho.pt</email>
<affil>Universidade do Minho</affil>
</author>
<author>
<name>Tiago Mach</name>
<nident>pg996</nident>
<email>pg996@minho.pt</email>
<url>https://www.linkedin.com</url>
<affil>Universidade do Minho</affil>
<photo>source/img/authors/marina.png</photo>
</author>
<author>
<name>Manuel Vie</name>
<nident>pg995</nident>
<email>pg995@minho.pt</email>
<url>https://www.linkedin.com</url>
<photo>source/img/authors/nuno.jpg</photo>
<affil>Universidade do Minho</affil>
</author>
<author>
<name>Damien Vim</name>
<nident>pg994</nident>
<photo>source/img/authors/damien.jpg</photo>
<url>https://www.linkedin.com</url>
<email>pg994@alunos.uminho.pt</email>
<affil>Universidade do Minho</affil>
</author>
</authors>
</frontmatter>
</report>
And this is my XSLT code which does not do what I want:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs" version="2.0">
<xsl:output indent="yes"/>
<xsl:template match="/report">
<html>
<head>
<meta charset="utf-8"/>
<title><xsl:value-of select="frontmatter/title"/></title>
</head>
<body>
<xsl:apply-templates select="frontmatter"/>
</body>
</html>
</xsl:template>
<xsl:template match="frontmatter" >
<table width="100%">
<tr align="center">
<td>
<h1><xsl:value-of select="title"/></h1>
</td>
</tr>
<xsl:if test="subtitle != '' ">
<tr align="center">
<td>
<xsl:value-of select="subtitle"/>
</td>
</tr>
</xsl:if>
</table>
<hr width="90%"/>
<h2>Autores</h2>
<table width="90%" align="center">
<xsl:apply-templates select="authors/author[position() mod 2 = 1]"/>
</table>
</xsl:template>
<xsl:template match="authors/author">
<tr>
<xsl:for-each select=". | following-sibling::author[1]" >
<td>
<p><xsl:value-of select="name"></xsl:value-of></p>
</td>
</xsl:for-each>
<xsl:if test="not(following-sibling::author)">
<td/>
<td/>
</xsl:if>
</tr>
</xsl:template>
</xsl:stylesheet>
How could I fix my stylesheet so that it generates an HTML table with 3 cells per row?