diff options
Diffstat (limited to 'xsl/url-decode.xsl')
-rw-r--r-- | xsl/url-decode.xsl | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/xsl/url-decode.xsl b/xsl/url-decode.xsl deleted file mode 100644 index 6e3db40..0000000 --- a/xsl/url-decode.xsl +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- Obtained from http://skew.org/xml/stylesheets/url-encode/url-decode.xsl --> - -<xsl:stylesheet version="1.0" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - <xsl:output method="text" indent="no" encoding="iso-8859-1"/> - -<!-- <xsl:param name="url" select="'urn:check%20out%20my%20r%E9sum%E9'"/>--> - - <xsl:variable name="hex" select="'0123456789ABCDEF'"/> - <xsl:variable name="ascii"> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable> - <xsl:variable name="latin1"> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:variable> - -<!-- <xsl:template match="/"> - <xsl:call-template name="decode"> - <xsl:with-param name="encoded" select="$url"/> - </xsl:call-template> - </xsl:template> --> - - <xsl:template name="decode"> - <xsl:param name="encoded"/> - <xsl:choose> - <xsl:when test="contains($encoded,'%')"> - <xsl:value-of select="substring-before($encoded,'%')"/> - <xsl:variable name="hexpair" select="translate(substring(substring-after($encoded,'%'),1,2),'abcdef','ABCDEF')"/> - <xsl:variable name="decimal" select="(string-length(substring-before($hex,substring($hexpair,1,1))))*16 + string-length(substring-before($hex,substring($hexpair,2,1)))"/> - <xsl:choose> - <xsl:when test="$decimal < 127 and $decimal > 31"> - <xsl:value-of select="substring($ascii,$decimal - 31,1)"/> - </xsl:when> - <xsl:when test="$decimal > 159"> - <xsl:value-of select="substring($latin1,$decimal - 159,1)"/> - </xsl:when> - <xsl:otherwise>?</xsl:otherwise> - </xsl:choose> - <xsl:call-template name="decode"> - <xsl:with-param name="encoded" select="substring(substring-after($encoded,'%'),3)"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$encoded"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - -</xsl:stylesheet> |