Hey guys,
writing xslt is some kind of special, isn’t it? As a original developer who started with php need to pay special attention to the xslt paradigm.
In my case I have a dropdown navigation with two columns after each 4 items where you need to split the current div tag into a new.
You can’t do something like this:
<xsl:if test=”position () = 4″>
</div><div class=”Submenu”>
</xsl:if>
Right?
The solution is some kind of “hack”, so only use this if you have tried to think over your code and another solution.
<xsl:variable name=”divider”>
<![CDATA[</div><div class=”Column”>]]>
</xsl:variable>
Now you can do:
<xsl:if test=”(position() mod 4) = 0″>
<xsl:value-of select=”$divider” disable-output-escaping=”yes”/>
</xsl:if>
Enjoy ![]()
Source:
http://blog.wojciech.org/?p=77
http://blog.wojciech.org/?p=77