Skip to content

Instantly share code, notes, and snippets.

@bzerangue
Created August 31, 2011 17:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzerangue/1184109 to your computer and use it in GitHub Desktop.
Save bzerangue/1184109 to your computer and use it in GitHub Desktop.
[XSLT] Twitter Button XSL Utility
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Twitter Button: XSL Utility
Created by Zerangue, Brian on 2011-08-31.
Copyright (c) 2011 Brian Zerangue. All rights reserved.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="twitter-button">
<xsl:param name="data-url" /> <!-- required -->
<xsl:param name="data-via" /> <!-- optional // use your screenname -->
<xsl:param name="data-text" /> <!-- optional -->
<xsl:param name="data-related" /> <!-- optional -->
<xsl:param name="data-count" select="'none'"/> <!-- options // horizontal, vertical, none -->
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<div>
<a href="http://twitter.com/share" class="twitter-share-button">
<xsl:attribute name="data-url">
<xsl:value-of select="$data-url" />
</xsl:attribute>
<xsl:if test="$data-via!=''">
<xsl:attribute name="data-via">
<xsl:value-of select="$data-via" />
</xsl:attribute>
</xsl:if>
<xsl:if test="$data-text!=''">
<xsl:attribute name="data-text">
<xsl:value-of select="$data-text" />
</xsl:attribute>
</xsl:if>
<xsl:if test="$data-related!=''">
<xsl:attribute name="data-related">
<xsl:value-of select="$data-related" />
</xsl:attribute>
</xsl:if>
<xsl:attribute name="data-count">
<xsl:value-of select="$data-count" />
</xsl:attribute>
<xsl:text>Tweet</xsl:text>
</a>
</div>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment