Diazo rules split content in columns

I have to split my page content in columns with diazo rules, how can I do this?

from something like this

<div id="content">
    <div id="item1">content1</div>
    <div id="item2">content2</div>
    <div id="item3">content3</div>
    <div id="item4">content4</div>
    <div id="item5">content5</div>
    <div id="item6">content6</div>
    <div id="item7">content7</div>
    <div id="item8">content8</div>
    <div id="item9">content9</div>
</div>

to something like this

<div id="content">
    <div class="row">
        <div class="span3" id="item1">content1</div>
        <div class="span3" id="item2">content2</div>
        <div class="span3" id="item3">content3</div>
    </div>
    <div class="row">   
        <div class="span3" id="item4">content4</div>
        <div class="span3" id="item5">content5</div>
        <div class="span3" id="item6">content6</div>
    </div>
    <div class="row">           
        <div class="span3" id="item7">content7</div>
        <div class="span3" id="item8">content8</div>
        <div class="span3" id="item8">content8</div>        
    </div>
</div>

Answers


use something like the following:

<xsl:template match="div[@id='content']/div[position() mod 3 = 1]">
  <div class="row">
        <xsl:for-each select=". | following-sibling::div[position() &lt; 3]">
              <xsl:copy-of select="." />
        </xsl:for-each>
  </div>
</xsl:template>
<xsl:template match="div[@id='content']/div[position() mod 3 != 1]">
</xsl:template>

Code your theme file exactly as in "to something like". Rules to pull your content:

<rules css:if-content="#visual-portal-wrapper">
    <replace css:theme-children="#item1" css:content-children="#item1" />
    <replace css:theme-children="#item2" css:content-children="#item2" />
    <replace css:theme-children="#item3" css:content-children="#item3" />
    ... you get the idea
</rules>

If your application supports css3, then try multiple columns. http://www.w3schools.com/css/css3_multiple_columns.asp


Need Your Help

angularjs: passing value to custom filter to enable it on dropdown click

javascript angularjs drop-down-menu angularjs-filter

I have a some data. By default all data should be shown up but when user click on some value in the drop-down then only the filter should start filtering the data.