Author:
rainerborene
Version:
1.0
Release Date:
3 Dec 2009
Category:
Output

Description

This is a utility that provides a embed HTML snippet and you can optionally set some properties of Vimeo player.

XSLT

View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
Name: Vimeo Embed
Version: 1.0
Author: Rainer Borene <rainerborene@gmail.com>
URL: http://www.getsymphony.com/download/xslt-utilities/view/34817/

Parameters:
* vimeo-element (required) XPath to the vimeo element
* color (optional) Color
* show_title (optional) Show title
* show_byline (optional) Show byline
* show_text (optional) Show text link below video
* show_description (optional) Show video description below video
* show_portrait (optional) Show portrait
-->

<xsl:template name="vimeo">
	<xsl:param name="vimeo-element"/>
	<xsl:param name="color"/>
	<xsl:param name="show_title"/>
	<xsl:param name="show_byline"/>
	<xsl:param name="show_text"/>
	<xsl:param name="show_description"/>
	<xsl:param name="show_portrait"/>

	<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="text">
			<xsl:if test="$show_text">
				<p>
					<a href="{concat('http://vimeo.com/', $vimeo-element/@clip-id)}">
						<xsl:value-of select="$vimeo-element/title"/>
					</a>
					from 
					<a href="{$vimeo-element/user/url}">
						<xsl:value-of select="$vimeo-element/name"/>
					</a> 
					on 
					<a href="http://vimeo.com">Vimeo</a>.
				</p>
			</xsl:if>
		</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>

Discuss this XSLT Utility

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