Skip to content

Instantly share code, notes, and snippets.

@xpathr
Created May 10, 2012 14:42
Show Gist options
  • Save xpathr/2653575 to your computer and use it in GitHub Desktop.
Save xpathr/2653575 to your computer and use it in GitHub Desktop.
Twitpic by rainerborene
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment