I am trying to emulate table generation via xslt. I have these two class models.
Table entry contains rows:
@XmlRootElement(name = "table")
@XmlType(propOrder = { "header", "rows" })
public class TableEntry extends PropertyEntry {
private String header;
private final List<TableRowEntry> rows = new ArrayList<TableRowEntry>();
@XmlElement(name = "row", required = true)
public List<TableRowEntry> getRows() {
return rows;
}
public String getHeader() {
return header;
}
@XmlAttribute
public void setHeader(String header) {
this.header = header;
}
}
Then I have TableRowEntry model class:
@XmlRootElement(name = "tableRow")
public class TableRowEntry implements Reportable {
private List<String> cells = new ArrayList<String>();
@XmlElement(name = "cell")
public List<String> getCells() {
return cells;
}
public void setCells(List<String> cells) {
this.cells = cells;
}
}
and I have this in xsl template
<xsl:for-each select="table">
<table>
<xsl:if test="@header">
<th><xsl:value-of select="@header"/></th>
</xsl:if>
<xsl:for-each select="row">
<tr>
<xsl:for-each select="cell">
<td><xsl:value-of select="cell"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
Then I do this and I marshall it
TableEntry tableEntry = new TableEntry();
tableEntry.setHeader("This is my header");
TableRowEntry tableRow = new TableRowEntry();
tableRow.setCells(Arrays.asList("cell", "cell2", "cell3"));
TableRowEntry tableRow2 = new TableRowEntry();
tableRow2.setCells(Arrays.asList("cell4", "cell5", "cell6"));
tableEntry.getRows().add(tableRow);
tableEntry.getRows().add(tableRow2);
Whenever I marshall it into HTML, there are empty values in cells, why? When I marshall it into XML, these values in cells are there but I can not select that value in xsl template. Why?
There are two rows with three cells in each row in HTML file but these cells are empty.
I am using eclipse moxy
I need to use this to pick that value: