I am not using XML. In sharepoint (A Microsoft CMS application), it uses xsl stylesheets to render a display of items in a list.
In my case, this list is a directory structure, with folders and sub folders (representing categories and sub-categories).
Basically where it runs :
Code:
<xsl:when test="normalize-space($thirdTier)">
<xsl:value-of select="$thirdTier" />
<xsl:text> THIS IS A SUB CATEGORY - </xsl:text>
<xsl:text> Current Position = </xsl:text><xsl:value-of select="$CurPos"></xsl:value-of><![CDATA[<br></br>]]>
</xsl:when>
I need to implement something so that it doesn't increment the current position parameter.
Here is my current XSLT:
Code:
<xsl:template name="MulticolumnBusinessDirectory" match="Row[@Style='MulticolumnBusinessDirectory']" mode="itemstyle">
<xsl:param name="CurPos" />
<xsl:param name="Last" />
<xsl:variable name="thirdTier">
<xsl:value-of select="substring-after(substring-after(substring-after(@LinkUrl, 'Community Directory'),'/'),'/')" />
</xsl:variable>
<xsl:variable name="tableStart">
<xsl:if test="$CurPos = 1">
<![CDATA[<table width="100%" border="1" cellpadding="0" cellspacing="0">]]>
</xsl:if>
</xsl:variable>
<xsl:variable name="tableEnd">
<xsl:if test="$CurPos = $Last">
<![CDATA[</table>]]>
</xsl:if>
</xsl:variable>
<xsl:variable name="tableRowItem">
<xsl:choose>
<xsl:when test="normalize-space($thirdTier)">
<xsl:value-of select="$thirdTier" />
<xsl:text> THIS IS A SUB CATEGORY - </xsl:text>
<xsl:text> Current Position = </xsl:text><xsl:value-of select="$CurPos"></xsl:value-of><![CDATA[<br></br>]]>
</xsl:when>
<xsl:otherwise>
<![CDATA[</td><td>]]>
<a href="<xsl:value-of select="@Title"/>">
<xsl:value-of select="@Title"/>
</a>
<xsl:text> THIS IS A MAIN CATEGORY - </xsl:text>
<xsl:text> Current Position = </xsl:text><xsl:value-of select="$CurPos"></xsl:value-of><![CDATA[<br></br>]]>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="tableRow">
<xsl:choose>
<xsl:when test="$CurPos mod 3 = 1">
<![CDATA[<tr>]]>
<xsl:value-of select="$tableRowItem" disable-output-escaping="yes"/>
<xsl:if test="$CurPos = $Last">
<![CDATA[<td></td></tr>]]>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="normalize-space($thirdTier)">
<xsl:value-of select="$thirdTier" />
<xsl:text> THIS IS A SUB CATEGORY - </xsl:text>
<xsl:text> Current Position = </xsl:text><xsl:value-of select="$CurPos"></xsl:value-of><![CDATA[<br></br>]]>
</xsl:when>
<xsl:otherwise>
<![CDATA[</td><td>]]>
<a href="<xsl:value-of select="@Title"/>">
<xsl:value-of select="@Title"/>
</a>
<xsl:text> THIS IS A MAIN CATEGORY - </xsl:text>
<xsl:text> Current Position = </xsl:text><xsl:value-of select="$CurPos"></xsl:value-of><![CDATA[<br></br>]]>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$tableStart" disable-output-escaping="yes"/>
<xsl:value-of select="$tableRow" disable-output-escaping="yes"/>
<xsl:value-of select="$tableEnd" disable-output-escaping="yes"/>
</xsl:template>