Answer the question
In order to leave comments, you need to log in
How to stagger div in xslt?
There is a task to deduce elements in a checkerboard pattern.
I can't reproduce it in xslt.
So far I've only come up with this:
<xsl:choose>
<xsl:when test="position() mod 1 != 0 and position() mod 4 != 0">
<div class="pego-columns pego-columns3 fl single-service-image">
<xsl:if test="image_small != ''">
<img alt="{name}" src="{dir}{image_small}" class="attachment-full size-full" />
</xsl:if>
</div>
<div class="pego-columns pego-columns3 fl single-service">
<h1 class="service-title"><xsl:value-of disable-output-escaping="yes" select=" substring-before(name,' ')"/><span><xsl:value-of disable-output-escaping="yes" select=" substring-after(name,' ')"/></span></h1>
<p class="service-excerpt"><xsl:value-of select="description" disable-output-escaping="yes" /></p>
</div>
</xsl:when>
<xsl:otherwise>
<div class="pego-columns pego-columns3 fl single-service">
<h1 class="service-title"><xsl:value-of disable-output-escaping="yes" select=" substring-before(name,' ')"/><span><xsl:value-of disable-output-escaping="yes" select=" substring-after(name,' ')"/></span></h1>
<p class="service-excerpt"><xsl:value-of select="description" disable-output-escaping="yes" /></p>
</div>
<div class="pego-columns pego-columns3 fl single-service-image">
<xsl:if test="image_small != ''">
<img alt="{name}" src="{dir}{image_small}" class="attachment-full size-full" />
</xsl:if>
</div>
</xsl:otherwise>
</xsl:choose>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question