I am trying to create a gap between rows everytime the value of ‘column3’ changes. At the moment the gap is set to appear every 2 rows which is not what i need.
For example the value of ‘column3’ in the first 10 rows is 1,1,3,3,3,3,5,5,5,5
And i want a gap between the last ‘1’ and first ‘3’ etc.
<xsl:for-each select="Market">
<tr>
<td>
<xsl:value-of select="Column1"/>
</td>
<td>
<xsl:value-of select="Column2"/>
</td>
<td>
<xsl:value-of select="Column3"/>
</td>
</tr>
<xsl:if test="(position() mod 2 = 0)">
<tr>
<td colspan="5" height="25px" />
</tr>
</xsl:if>
You could make use of the following-sibling axis in XPath to do this.
i.e. Does the very next Market element have a Column3 element with a different value.
For example, given the following XML
When you apply the following XSLT
Then the following is output
(Note, I missed out Column2 just for some brevity).