Skip to content

Instantly share code, notes, and snippets.

@farmerbradllc
Created January 18, 2012 00:25
Show Gist options
  • Select an option

  • Save farmerbradllc/1629989 to your computer and use it in GitHub Desktop.

Select an option

Save farmerbradllc/1629989 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="vimeo">
<xsl:param name="vimeo-element"/>
<xsl:param name="color"/>
<xsl:if test="$vimeo-element/@clip-id and $vimeo-element/@duration and $vimeo-element/@plays">
<xsl:variable name="custom_color">
<xsl:text>&amp;color=</xsl:text>
<xsl:choose>
<xsl:when test="$color"><xsl:value-of select="$color"/></xsl:when>
<xsl:otherwise>00adef</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="title">
<xsl:text>&amp;show_title=</xsl:text>
<xsl:choose>
<xsl:when test="$show_title">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="byline">
<xsl:text>&amp;show_byline=</xsl:text>
<xsl:choose>
<xsl:when test="$show_byline">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="description">
<xsl:if test="$show_description">
<p>
<xsl:value-of select="$vimeo-element/caption"/>
</p>
</xsl:if>
</xsl:variable>
<xsl:variable name="portrait">
<xsl:text>&amp;show_portrait=</xsl:text>
<xsl:choose>
<xsl:when test="$show_portrait">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="url">
<xsl:value-of select="concat('http://vimeo.com/moogaloop.swf?clip_id=', $vimeo-element/@clip-id)"/>
<xsl:value-of select="concat($title, $byline, $portrait, $custom_color, '&amp;server=vimeo.com&amp;fullscreen=1')"/>
</xsl:variable>
<object width="{$vimeo-element/@width}" height="{$vimeo-element/@height}">
<param name="allowfullscreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<param name="movie" value="{$url}"/>
<embed src="{$url}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{$vimeo-element/@width}" height="{$vimeo-element/@height}"></embed>
</object>
<xsl:copy-of select="$text"/>
<xsl:copy-of select="$description"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment