Skip to content

Instantly share code, notes, and snippets.

@bauhouse
Created February 21, 2013 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bauhouse/5009329 to your computer and use it in GitHub Desktop.
Save bauhouse/5009329 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8" ?>
<data>
<slider-background>
<section id="11" handle="background-images">background images</section>
<entry id="18">
<images size="1.46 MB" path="" type="image/jpeg">
<filename>combines.jpg</filename>
<meta creation="2013-02-20T15:02:56-07:00" width="2300" height="1533" />
</images>
</entry>
<entry id="17">
<images size="276 KB" path="" type="image/jpeg">
<filename>cbp0009340_veer.jpg</filename>
<meta creation="2013-02-20T15:02:41-07:00" width="640" height="426" />
</images>
</entry>
<entry id="16">
<images size="261 KB" path="" type="image/jpeg">
<filename>bxp0004862_veer.jpg</filename>
<meta creation="2013-02-20T15:02:11-07:00" width="640" height="425" />
</images>
</entry>
</slider-background>
</data>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
encoding="UTF-8"
indent="yes" />
<xsl:param name="workspace" select="'http://example.com/workspace'" />
<xsl:template match="/data/slider-background">
<script>
<xsl:text>
<![CDATA[$.backstretch([
]]></xsl:text>
<xsl:apply-templates select="entry" mode="backstretch" />
<xsl:text><![CDATA[
], {
fade: 750,
duration: 4000
});]]>
</xsl:text>
</script>
</xsl:template>
<xsl:template match="entry" mode="backstretch">
<xsl:text>"</xsl:text><xsl:value-of select="concat($workspace, '/images/', images/filename)" /><xsl:text>"</xsl:text>
<xsl:if test="position() != last()">
<xsl:text>,
</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment