Search

Hey guys, another quick question. I'm trying to group product entries into slides, which themselves contain groups of rows of products. Here's some the data:

<products>
<section id="1" handle="products">Products</section>
<entry id="1">
  <name handle="batman-bar">Batman Bar</name>
</entry>
<entry id="13">
  <name handle="birthday-party-ice-cream-sandwich">Birthday Party Ice Cream Sandwich</name>
</entry>
<entry id="15">
  <name handle="bubblegum-bar">Bubblegum Bar</name>
</entry>
<entry id="8">
  <name handle="bubblegum-snow-cone">Bubblegum Snow Cone</name>
</entry>
<entry id="17">
  <name handle="champ-king-size-bunny-tracks-cone">Champ! King Size Bunny Tracks Cone</name>
</entry>
<entry id="31">
  <name handle="chill-double-lemon-cup">Chill Double Lemon Cup</name>
</entry>
<entry id="19">
  <name handle="chips-galore">Chips Galore!</name>
</entry>
<entry id="11">
  <name handle="chips-galore">Chocolate Lover’s Big Dipper</name>
</entry>
</products>

And I'd like to output this:

<ul class="slides">
  <li>
    <div class="row">
      <div class="colSpan6 product">
         Batman Bar
      </div>
      <div class="colSpan6 product">
         Birthday Party Ice Cream Sandwich
      </div>
    </div>
    <div class="row">
      <div class="colSpan6 product">
         Bubblegum Bar
      </div>
      <div class="colSpan6 product">
         Bubblegum Snow Cone
      </div>
    </div>
  </li>
  <li>
    <div class="row">
      <div class="colSpan6 product">
         Champ! King Size Bunny Tracks Cone
      </div>
      <div class="colSpan6 product">
         Chill Double Lemon Cup
      </div>
    </div>
    <div class="row">
      <div class="colSpan6 product">
         Chips Galore!
      </div>
      <div class="colSpan6 product">
         Chocolate Lover’s Big Dipper
      </div>
    </div>
  </li>
</ul>

I've searched for quite a few hours and just haven't been able to find a solution. I came up with some code to group them fine, by couldn't figure out how to get them to group into slides. Any help would be greatly appreciated :)

Max

Take a look at this: http://xpathr.com/view/3121455

Hey alpacaaa, thanks a lot for taking the time to write that! Would it be possible to have a slide contain ten products, so I can plug in as many products as I have and it will spit out the correct markup?

Ok, this is getting complicated :)

http://xpathr.com/view/3130526/

This template is the most flexible I can think of, but might be a bit hard to understand. Basically, you need to change the value of the parameters on lines 8-9 to make the template behave as you prefer, so that the markup would update accordingly.

I haven't tested it deeply, but it should work.

alpacaaa: Thanks a ton! Works like a charm :)

Awesome!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details