Skip to content

Instantly share code, notes, and snippets.

Last active August 16, 2020 21:52
What would you like to do?
[XSLT] Google +1 XSL Utility
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
Name: Google +1 Utility
Version: 1.0.1
Author: Brian Zerangue <>
How to use:
Call the template name="google-plus-one" like so...
Required Parameter is url, all the other parameters are optional
EXAMPLE ONE (this will default to standard size)
<xsl:call-template name="google-plus-one">
<xsl:with-param name="url" select="''" />
EXAMPLE TWO (defining size, will use select another size other than standard)
<xsl:call-template name="google-plus-one">
<xsl:with-param name="url" select="''" />
<xsl:with-param name="size" select="'small'" />
<xsl:template name="google-plus-one">
<xsl:param name="url"/><!-- Required -->
<xsl:param name="size" select="'standard'"/><!-- Options (standard,small,medium,tall), defaults to Standard (24px) -->
<!-- Place this tag where you want the +1 button to render -->
<xsl:element name="g:plusone">
<xsl:attribute name="href">
<xsl:value-of select="$url" />
<xsl:if test="$size!='standard'">
<xsl:attribute name="size">
<xsl:when test="$size='small'">
<xsl:when test="$size='medium'">
<xsl:when test="$size='tall'">
<xsl:comment>Google +1 Button</xsl:comment>
<!-- Place this tag after the last plusone tag -->
<script type="text/javascript">
<xsl:text>(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment