-
-
Save creativedutchmen/4702108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<data> | |
<products> | |
<entry id="01"> | |
<title>product 01</title> | |
</entry> | |
<entry id="02"> | |
<title>product 02</title> | |
</entry> | |
<entry id="03"> | |
<title>product 03</title> | |
</entry> | |
<entry id="04"> | |
<title>product 04</title> | |
</entry> | |
<entry id="05"> | |
<title>product 05</title> | |
</entry> | |
<entry id="06"> | |
<title>product 06</title> | |
</entry> | |
<entry id="07"> | |
<title>product 07</title> | |
</entry> | |
<entry id="08"> | |
<title>product 08</title> | |
</entry> | |
<entry id="09"> | |
<title>product 09</title> | |
</entry> | |
<entry id="10"> | |
<title>product 10</title> | |
</entry> | |
<entry id="11"> | |
<title>product 11</title> | |
</entry> | |
<entry id="12"> | |
<title>product 12</title> | |
</entry> | |
</products> | |
</data> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="data/products"/> | |
</xsl:template> | |
<xsl:template match="products"> | |
<xsl:apply-templates select="entry[position() mod 3 = 1]" mode="row"/> | |
</xsl:template> | |
<xsl:template match="products/entry" mode="row"> | |
<div class="row"> | |
<xsl:apply-templates select=". | following-sibling::entry[position() < 3]" mode="entry"/> | |
</div> | |
</xsl:template> | |
<xsl:template match="products/entry" mode="entry"> | |
<div class="product"> | |
<xsl:value-of select="title"/> | |
</div> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment