I'm relatively new to xslt and have been trying to create a table using an xml structure, but I am finding it difficult to limit the amount of fields in each row..
<report>
<status>
<statuscheck>
<node>node1</node>
<RAG>red</RAG>
<url>http://www.google.com</url>
<area>area1</area>
</statuscheck>
<statuscheck>
<node>node2</node>
<RAG>red</RAG>
<url>http://www.google.com</url>
<area>area1</area>
</statuscheck>
<statuscheck>
<node>node3</node>
<RAG>red</RAG>
<url>http://www.google.com</url>
<area>area1</area>
</statuscheck>
<statuscheck>
<node>node4</node>
<RAG>red</RAG>
<url>http://www.google.com</url>
<area>area1</area>
</statuscheck>
<statuscheck>
<node>node5</node>
<RAG>red</RAG>
<url>http://www.google.com</url>
<area>area1</area>
</statuscheck>
<statuscheck>
<node>node1</node>
<RAG>red</RAG>
<url>http://www.google.com</url>
<area>area2</area>
</statuscheck>
</status>
<area>
<area_name>area1</area_name>
<area_name>area2</area_name>
</area>
I have the following xslt but is there a way that I can get it to start a new row after every 4 items? the actual xml will have up to 20 components per area.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<style>
</style>
</head>
<body style="font-family: Sky Text;">
<xsl:for-each select="/report/area/area_name">
<div style="font-size: 20px; font-weight: bold; margin: 10px 0 10px 0;"><xsl:value-of select="."/></div>
<table style="font-family: Sky Text; border-collapse: collapse; width: 960px;">
<tbody>
<xsl:variable name="active_area" select="./text()"></xsl:variable>
<xsl:for-each select="/report/status/statuscheck[area/text() = $active_area]">
<td style="width: 240px; border: 1px solid black; text-align: center;" valign="middle">
<xsl:attribute name="class">
<xsl:value-of select="RAG"/>
</xsl:attribute>
<div style="margin: 10px; font-size: 16px;">
<a>
<xsl:attribute name="href">
<xsl:value-of select="url"/>
</xsl:attribute>
<xsl:value-of select="node"/>
</a>
</div>
</td>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
thanks in advance Gavin