Hi all,
This is a small issue to make things prettier, but we all know how important that can be!
I had an xsl:if to check if a node was the last one in a collection of nodes and if it was a horizontal divider would not be displayed underneath it. This worked a treat but now I'm trying to sort my data using xsl:sort. The if statement technically still works but now the node identified by last() could be anywhere in the output order. I only want to remove the horizontal divider at the end.
Does anyone have any suggestions on how I can alter my if statement to reflect this? I imagine it is going to have to check that it is the latest year/month/day against every other sibling but I can't figure out how to do this properly.
My sort:
My xsl:if that worked before:
Any suggestions?
This is a small issue to make things prettier, but we all know how important that can be!
I had an xsl:if to check if a node was the last one in a collection of nodes and if it was a horizontal divider would not be displayed underneath it. This worked a treat but now I'm trying to sort my data using xsl:sort. The if statement technically still works but now the node identified by last() could be anywhere in the output order. I only want to remove the horizontal divider at the end.
Does anyone have any suggestions on how I can alter my if statement to reflect this? I imagine it is going to have to check that it is the latest year/month/day against every other sibling but I can't figure out how to do this properly.
My sort:
Code:
<xsl:apply-templates select="primarycontent" mode="_1"> <!-- Break down into components and sort ascending as a number --> <xsl:sort data-type="number" select="substring(detaildate,7,4)"/> <!-- year --> <xsl:sort data-type="number" select="substring(detaildate,4,2)"/> <!-- month --> <xsl:sort data-type="number" select="substring(detaildate,1,2)"/> <!-- day --> </xsl:apply-templates>
Code:
<xsl:if test=".!=/page/primarycontent[last()]"> <div class="divider2"></div> </xsl:if>
Comment