Author:
rainerborene
Version:
0.1
Release Date:
7 Feb 2011
Category:
Third-Party Integration

Description

A simple utility that transforms Twitpic links into real images.

XSLT

View Raw
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:exsl="http://exslt.org/common"
	xmlns:str="http://exslt.org/strings"
	exclude-result-prefixes="exsl str">

<xsl:template name="twitpic">
	<xsl:param name="tweet"/>

	<xsl:if test="contains(tweet, 'http://twitpic.com/')">
		<xsl:param name="after" select="substring-after($tweet, 'http://twitpic.com/')"/>
		<xsl:param name="tokens" select="str:split($after, ' ')"/>
		<xsl:param name="uuid" select="exsl:node-set($tokens)/text()"/>

		<xsl:if test="$tokens">
			<div class="embed twitpic">
				<img src="http://twitpic.com/show/full/{$uuid}"/>
			</div>
		</xsl:if>
	</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