Skip to content

Instantly share code, notes, and snippets.

@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Convert XML-nodesets to string by iwyg
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!--
Converts a nodeset to string, especially useful for json conversions.
===================================================================================
Copyright 2011, Thomas Appel, http://thomas-appel.com, mail(at)thomas-appel.com
dual licensed under MIT and GPL license
http://dev.thomas-appel.com/licenses/mit.txt
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Converting decimal to hexadecimal by tarakanoff
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="ConvertDecToHex">
<xsl:param name="index" />
<xsl:if test="$index > 0">
<xsl:call-template name="ConvertDecToHex">
<xsl:with-param name="index" select="floor($index div 16)" />
</xsl:call-template>
<xsl:choose>
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Copyright by Nils
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="copyright">
<xsl:param name="start" select="2010" />
<xsl:value-of select="$start" />
<xsl:if test="$this-year != $start">
<xsl:text>&#8211;</xsl:text>
<xsl:value-of select="$this-year" />
</xsl:if>
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Currency Converter by phoque
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01"
xmlns:eurofxref="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
<!-- Example Call
<xsl:call-template name="currency-converter">
<xsl:with-param name="value" select="'1'" />
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Czech pluralizer by janiczek
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="sklonovani">
<xsl:param name="kolik" />
<xsl:param name="nula" />
<xsl:param name="jeden" />
<xsl:param name="dva" />
<xsl:param name="pet" />
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Data Source Pagination by nickdunn
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Name: DATA SOURCE PAGINATION
Version: 1.4
Author: Nick Dunn <nick@nick-dunn.co.uk>, extended by Nils Hörrmann <post@nilshoerrmann.de>
URL: http://symphony-cms.com/downloads/xslt/file/20482/
Required Parameters:
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Date utilities by eKoeS
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Description:
================================================
This utility consists of three templates:
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Decimal to Fraction by qnn
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- What is this utility all about? This utility converts a decimal number to a fraction.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.-->
<!-- Example Call
<xsl:call-template name="decimal-to-fraction">
<xsl:with-param name="decimalnum" select="0.5"/>
</xsl:call-template>
-->
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Dynamic RSS by kanduvisla
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:dyn="http://exslt.org/dynamic"
extension-element-prefixes="dyn">
@xpathr
xpathr / utility.xsl
Created May 10, 2012 14:40
Alphabet by tarakanoff
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="alphabet">
<!-- en -->
<xsl:param name="s" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="a">
<xsl:value-of select="substring($s,1,1)"/>
</xsl:variable>
<xsl:variable name="s0">