Skip to content

Instantly share code, notes, and snippets.

@andrewminton
Forked from nilshoerrmann/master.xml
Created September 19, 2012 14:51
Show Gist options
  • Save andrewminton/3750091 to your computer and use it in GitHub Desktop.
Save andrewminton/3750091 to your computer and use it in GitHub Desktop.
<data>
<smorgasbord-portfolio>
<pagination total-entries="19" total-pages="3" entries-per-page="7" current-page="1" />
<section id="27" handle="smorgasbord-portfolio">Smorgasbord Portfolio</section>
<entry id="416">
<title handle="twenty8twelve-new">Twenty8Twelve/NEW</title>
<description mode="formatted" handle="twenty8twelve-is-a-global-fashion-brand-with-three-stand-alone-boutiques-in-london-the-brand-is-also-sold-in-over-300-carefully-selected-retailers-in-more-than-20-countries-worldwide-each-season-new-characters-inspire-the-designers-to-evolve-the-collectio" word-count="45"><p>Twenty8Twelve is a global fashion brand with three stand-alone boutiques in London. The brand is also sold in over 300 carefully selected retailers in more than 20 countries worldwide. Each season new characters inspire the designers to evolve the collection to a new level, offering wardrobe.</p></description>
<images field-id="122" subsection-id="26" items="4">
<item id="471">
<title handle="blue">Blue</title>
<image size="63 KB" path="/uploads/images" type="image/jpeg">
<filename>03-t8t_web.jpg</filename>
<meta creation="2012-09-12T14:10:47+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="959" y1="0" y2="540" width="959" height="540" ratio="1.778" />
</item>
<item id="470">
<title handle="pink">Pink</title>
<image size="24 KB" path="/uploads/images" type="image/jpeg">
<filename>02-t8t_web.jpg</filename>
<meta creation="2012-09-12T14:05:54+01:00" width="480" height="540" />
</image>
<crop cropped="yes" x1="0" x2="480" y1="0" y2="540" width="480" height="540" ratio="0.889" />
</item>
<item id="462">
<title handle="green">Green</title>
<image size="39 KB" path="/uploads/images" type="image/jpeg">
<filename>01-t8t_web.jpg</filename>
<meta creation="2012-09-12T11:38:49+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="4" x2="960" y1="2" y2="540" width="956" height="538" ratio="1.778" />
</item>
<item id="537">
<title handle="clear-space">Clear space</title>
<image size="3 KB" path="/uploads/images" type="image/jpeg">
<filename>11-gorilla_web.jpg</filename>
<meta creation="2012-09-19T08:38:25+01:00" width="480" height="540" />
</image>
<crop cropped="yes" x1="0" x2="479" y1="1" y2="540" width="479" height="539" ratio="0.889" />
</item>
</images>
<videos field-id="129" subsection-id="28" items="1" >
<item>
<oembed>
<video_id>8900987</video_id>
</oembed>
</item>
</videos>
</entry>
<entry id="421">
<title handle="otley">Otley</title>
<description mode="formatted" handle="x-7" word-count="1"><p>x</p></description>
<images field-id="122" subsection-id="26" items="10">
<item id="474">
<title handle="otley-marque">Otley Marque</title>
<image size="21 KB" path="/uploads/images" type="image/jpeg">
<filename>01b-otley_web.jpg</filename>
<meta creation="2012-09-17T15:38:06+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="5" x2="960" y1="0" y2="537" width="955" height="537" ratio="1.778" />
</item>
<item id="535">
<title handle="bottle-1">Bottle 1</title>
<image size="22 KB" path="/uploads/images" type="image/jpeg">
<filename>10-otley_web.jpg</filename>
<meta creation="2012-09-18T21:41:40+01:00" width="965" height="549" />
</image>
<crop cropped="yes" x1="0" x2="965" y1="0" y2="543" width="965" height="543" ratio="1.778" />
</item>
<item id="536">
<title handle="bottle-2">Bottle 2</title>
<image size="26 KB" path="/uploads/images" type="image/jpeg">
<filename>11-otley_web.jpg</filename>
<meta creation="2012-09-18T21:42:30+01:00" width="965" height="549" />
</image>
<crop cropped="yes" x1="0" x2="965" y1="2" y2="545" width="965" height="543" ratio="1.778" />
</item>
<item id="487">
<title handle="beer-mats">Beer Mats</title>
<image size="53 KB" path="/uploads/images" type="image/jpeg">
<filename>03-otley_web.jpg</filename>
<meta creation="2012-09-17T21:32:39+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="488">
<title handle="drip-mat">Drip mat</title>
<image size="91 KB" path="/uploads/images" type="image/jpeg">
<filename>02-otley_web.jpg</filename>
<meta creation="2012-09-17T21:33:28+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="489">
<title handle="card-01">Card 01</title>
<image size="23 KB" path="/uploads/images" type="image/jpeg">
<filename>08-otley_web.jpg</filename>
<meta creation="2012-09-17T21:34:07+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="490">
<title handle="card-02">Card 02</title>
<image size="38 KB" path="/uploads/images" type="image/jpeg">
<filename>09-otley_web.jpg</filename>
<meta creation="2012-09-17T21:34:41+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="491">
<title handle="brochure-01">Brochure 01</title>
<image size="17 KB" path="/uploads/images" type="image/jpeg">
<filename>06-otley_web.jpg</filename>
<meta creation="2012-09-17T21:35:21+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="492">
<title handle="brochure-02">Brochure 02</title>
<image size="72 KB" path="/uploads/images" type="image/jpeg">
<filename>07-otley_web.jpg</filename>
<meta creation="2012-09-17T21:36:09+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="538">
<title handle="clear-space">Clear space</title>
<image size="3 KB" path="/uploads/images" type="image/jpeg">
<filename>12-otley_web.jpg</filename>
<meta creation="2012-09-19T08:45:10+01:00" width="480" height="540" />
</image>
</item>
</images>
<videos field-id="129" subsection-id="28" items="0" />
</entry>
<entry id="417">
<title handle="adain-avion">Adain Avion</title>
<description mode="formatted" handle="x-5" word-count="1"><p>x</p></description>
<images field-id="122" subsection-id="26" items="5">
<item id="532">
<title handle="logo">Logo</title>
<image size="50 KB" path="/uploads/images" type="image/jpeg">
<filename>aa_web_logo.jpg</filename>
<meta creation="2012-09-18T21:22:53+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="520">
<title handle="postcards">Postcards</title>
<image size="73 KB" path="/uploads/images" type="image/jpeg">
<filename>06-adain-avion.jpg</filename>
<meta creation="2012-09-18T16:59:27+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="469">
<title handle="48-sheet">48 Sheet </title>
<image size="101 KB" path="/uploads/images" type="image/jpeg">
<filename>06-adain-avion_web.jpg</filename>
<meta creation="2012-09-12T12:26:43+01:00" width="961" height="542" />
</image>
<crop cropped="yes" x1="0" x2="947" y1="0" y2="532" width="947" height="532" ratio="1.778" />
</item>
<item id="534">
<title handle="celyn">Celyn</title>
<image size="82 KB" path="/uploads/images" type="image/jpeg">
<filename>08-adain-avion_web.jpg</filename>
<meta creation="2012-09-18T21:32:01+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="533">
<title handle="image-1">Image 1</title>
<image size="139 KB" path="/uploads/images" type="image/jpeg">
<filename>07-adain-avion_web.jpg</filename>
<meta creation="2012-09-18T21:31:13+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="5" x2="960" y1="0" y2="538" width="955" height="538" ratio="1.778" />
</item>
</images>
<videos field-id="129" subsection-id="28" items="0" />
</entry>
<entry id="422">
<title handle="kings-arms">Kings Arms</title>
<images field-id="122" subsection-id="26" items="3">
<item id="498">
<title handle="logo">Logo</title>
<image size="52 KB" path="/uploads/images" type="image/jpeg">
<filename>02-kings_web.jpg</filename>
<meta creation="2012-09-18T13:18:55+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="959" y1="0" y2="540" width="959" height="540" ratio="1.778" />
</item>
<item id="499">
<title handle="cards">Cards</title>
<image size="147 KB" path="/uploads/images" type="image/jpeg">
<filename>03-kings_web.jpg</filename>
<meta creation="2012-09-18T13:20:06+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="500">
<title handle="clipboard">Clipboard</title>
<image size="49 KB" path="/uploads/images" type="image/jpeg">
<filename>04-kings_web.jpg</filename>
<meta creation="2012-09-18T13:20:43+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="2" x2="960" y1="1" y2="540" width="958" height="539" ratio="1.778" />
</item>
</images>
<videos field-id="129" subsection-id="28" items="0" />
</entry>
<entry id="411">
<title handle="gorilla">Gorilla</title>
<description mode="formatted" handle="x-6" word-count="1"><p>x</p></description>
<images field-id="122" subsection-id="26" items="9">
<item id="412">
<title handle="marque">Marque</title>
<image size="43 KB" path="/uploads/images" type="image/jpeg">
<filename>01_gorilla_web.jpg</filename>
<meta creation="2012-09-11T14:17:58+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="476">
<title handle="02-big-g">02 Big G</title>
<image size="70 KB" path="/uploads/images" type="image/jpeg">
<filename>02-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T17:13:21+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="956" y1="2" y2="540" width="956" height="538" ratio="1.778" />
</item>
<item id="477">
<title handle="booklet-2">Booklet 2</title>
<image size="49 KB" path="/uploads/images" type="image/jpeg">
<filename>05-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T20:47:00+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="475">
<title handle="booket-1">Booket 1</title>
<image size="54 KB" path="/uploads/images" type="image/jpeg">
<filename>01-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T17:04:14+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="5" x2="960" y1="3" y2="540" width="955" height="537" ratio="1.778" />
</item>
<item id="478">
<title handle="booklet-3">Booklet 3</title>
<image size="45 KB" path="/uploads/images" type="image/jpeg">
<filename>04-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T20:47:49+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="2" x2="960" y1="1" y2="540" width="958" height="539" ratio="1.778" />
</item>
<item id="479">
<title handle="booklet-4">Booklet 4</title>
<image size="56 KB" path="/uploads/images" type="image/jpeg">
<filename>03-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T20:48:41+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="480">
<title handle="business-card">Business card</title>
<image size="42 KB" path="/uploads/images" type="image/jpeg">
<filename>05-gorilla-web-2.jpg</filename>
<meta creation="2012-09-17T20:49:52+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="481">
<title handle="sticker">Sticker</title>
<image size="40 KB" path="/uploads/images" type="image/jpeg">
<filename>07-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T20:50:42+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="2" x2="960" y1="0" y2="539" width="958" height="539" ratio="1.778" />
</item>
<item id="482">
<title handle="envelope">Envelope</title>
<image size="43 KB" path="/uploads/images" type="image/jpeg">
<filename>06-gorilla_web-2.jpg</filename>
<meta creation="2012-09-17T20:51:17+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="2" x2="958" y1="2" y2="540" width="956" height="538" ratio="1.778" />
</item>
</images>
<videos field-id="129" subsection-id="28" items="0" />
</entry>
<entry id="420">
<title handle="lucid">Lucid</title>
<description mode="formatted" handle="x-4" word-count="1"><p>x</p></description>
<images field-id="122" subsection-id="26" items="1">
<item id="531">
<title handle="logo">Logo</title>
<image size="19 KB" path="/uploads/images" type="image/jpeg">
<filename>02-lucid_web.jpg</filename>
<meta creation="2012-09-18T21:17:36+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="4" x2="960" y1="2" y2="540" width="956" height="538" ratio="1.778" />
</item>
</images>
<videos field-id="129" subsection-id="28" items="0" />
</entry>
<entry id="419">
<title handle="hyde-hyde">Hyde + Hyde</title>
<description mode="formatted" handle="x-3" word-count="1"><p>x</p></description>
<images field-id="122" subsection-id="26" items="5">
<item id="529">
<title handle="logo">Logo</title>
<image size="22 KB" path="/uploads/images" type="image/jpeg">
<filename>04-hyde_web.jpg</filename>
<meta creation="2012-09-18T21:13:01+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="530">
<title handle="logo-2">Logo 2</title>
<image size="32 KB" path="/uploads/images" type="image/jpeg">
<filename>05-hyde_web.jpg</filename>
<meta creation="2012-09-18T21:13:35+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="956" y1="2" y2="540" width="956" height="538" ratio="1.778" />
</item>
<item id="517">
<title handle="business-cards">Business cards</title>
<image size="51 KB" path="/uploads/images" type="image/jpeg">
<filename>01-hyde_web.jpg</filename>
<meta creation="2012-09-18T16:29:25+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="518">
<title handle="folder-1">Folder 1</title>
<image size="22 KB" path="/uploads/images" type="image/jpeg">
<filename>02-hyde_web.jpg</filename>
<meta creation="2012-09-18T16:32:05+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
<item id="519">
<title handle="brochure-02">Brochure 02</title>
<image size="41 KB" path="/uploads/images" type="image/jpeg">
<filename>03-hyde_web.jpg</filename>
<meta creation="2012-09-18T16:32:47+01:00" width="960" height="540" />
</image>
<crop cropped="yes" x1="0" x2="960" y1="0" y2="540" width="960" height="540" ratio="1.778" />
</item>
</images>
<videos field-id="129" subsection-id="28" items="0" />
</entry>
</smorgasbord-portfolio>
</data>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="root" value="http://mydomain.com"/>
<xsl:output method="xml" indent="yes" />
<xsl:template match="data">
<xsl:apply-templates select="smorgasbord-portfolio/entry"/>
</xsl:template>
<xsl:template match="smorgasbord-portfolio/entry">
<div class="contentbox" id="{title/@handle}">
<xsl:apply-templates select="images/item | videos/item" />
</div>
</xsl:template>
<xsl:template match="item">
<div class="item">
<xsl:choose>
<xsl:when test="name(parent::*) = 'images'">
<xsl:call-template name="images"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="videos"/>
</xsl:otherwise>
</xsl:choose>
<p>
<xsl:value-of select="position()"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="count(ancestor::entry//item)"/>
<xsl:if test="position() = '1'"> / <xsl:value-of select="../../title"/></xsl:if>
</p>
</div>
</xsl:template>
<xsl:template match="videos" name="videos">
<div class="video">
<iframe id="{position()}" src="http://player.vimeo.com/video/{videos/oembed/video_id}?api=1&amp;player_id={position()}" frameborder="0" />
<div class="controls"><div class="playhead"></div></div>
<div class="simple">
<button class="play">Play</button>
<button class="pause">Pause</button>
</div>
<div class="credits">
<xsl:value-of select="tune"/>
</div>
</div>
</xsl:template>
<xsl:template match="images" name="images">
<xsl:choose>
<xsl:when test="crop/@ratio ='0.889'">
<xsl:choose>
<xsl:when test="crop/@cropped ='yes'">
<img class="foureighty" src="{$root}/image/5/{crop/@width}/{crop/@height}/{crop/@x1}/{crop/@y1}/480/540{image/@path}/{image/filename}"/>
</xsl:when>
<xsl:otherwise>
<img class="foureighty" src="{$root}/image/2/480/540/5{image/@path}/{image/filename}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="crop/@cropped ='yes'">
<img src="{$root}/image/5/{crop/@width}/{crop/@height}/{crop/@x1}/{crop/@y1}/930/603{image/@path}/{image/filename}"/>
</xsl:when>
<xsl:otherwise>
<img src="{$root}/image/2/960/603/5{image/@path}/{image/filename}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment