Permalink
Browse files

IBAN tools web site

  • Loading branch information...
1 parent a3fb1c6 commit e425379d0b741fa7047b7288a8dc89de58c51146 @jvverde committed Sep 6, 2011
View
@@ -1,125 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:df="http://serprest.pt/ht5ifv1.0">
- <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
- <!-- which: $('#controls input[name="control_which"]:checked').val(),
- IorB: $('#controls input[name="control_IorB"]:checked').val(),
- pattern: $('#controls input[name="control_pattern"]:checked').val(),
- spaces: $('#controls input[name="control_spaces"]:checked').val(),
- dots: $('#controls input[name="control_dots"]:checked').val(),
- slashes: $('#controls input[name="control_slashes"]:checked').val(),
- checksum: $('#controls input[name="control_checksum"]:checked').val(),
- -->
- <xsl:param name="global" select="false()"/>
- <xsl:param name="perCountry" select="false()"/>
- <xsl:param name="IBAN" select="false()"/>
- <xsl:param name="BBAN" select="false()"/>
- <xsl:param name="checksum" select="false()"/>
- <xsl:variable name="IBANchecksum">
- <xsl:text>function isValidIBAN($v){ //This function check if the checksum if correct
- $v = $v.replace(/^(.{4})(.*)$/,"$2$1"); //Move the first 4 chars from left to the right
- $v = $v.replace(/[A-Z]/g,function($e){return $e.charCodeAt(0) - 'A'.charCodeAt(0) + 10}); //Convert A-Z to 10-25
- var $sum = 0;
- var $ei = 1; //First exponent
- for(var $i = $v.length - 1; $i >= 0; $i--){
- $sum += $ei * parseInt($v.charAt($i),10); //multiply the digit by it's exponent
- $ei = ($ei * 10) % 97; //compute next base 10 exponent in modulus 97
- };
- return $sum % 97 == 1;
- }</xsl:text>
- </xsl:variable>
- <xsl:variable name="BBANchecksum">
- <xsl:text>
- function isValidBBAN($v){ //This function check if the checksum if correct
- $v = $v.replace(/[A-Z]/g,function($e){return $e.charCodeAt(0) - 'A'.charCodeAt(0) + 10}); //Convert A-Z to 10-25
- var $sum = 0;
- var $ei = 1; //First exponent
- for(var $i = $v.length - 1; $i >= 0; $i--){
- $sum += $ei * parseInt($v.charAt($i),10); //multiply the digit by it's exponent
- $ei = ($ei * 10) % 97; //compute next base 10 exponent in modulus 97
- };
- return $sum % 97 == 1;
- }
- </xsl:text>
- </xsl:variable>
- <xsl:template match="node()|@*">
- <xsl:apply-templates select="node()|@*"/>
- </xsl:template>
- <xsl:template match="/">
- <df:ibano>
- <df:r><xsl:apply-templates select="node()|@*"/></df:r>
- </df:ibano>
- </xsl:template>
- <xsl:template match="country">
- <xsl:if test="$IBAN">
- <xsl:text>
- IBAN-</xsl:text><xsl:value-of select="@cc"/><xsl:text>: function($v){
- $v = $v.replace(/[^\dA-Z]/g,''); //removes any other characters
- return /</xsl:text><xsl:value-of select="@ibanstructpat"/>
- <xsl:text>/.test($v)</xsl:text>
- <xsl:if test="$checksum">
- <xsl:text> &amp;&amp; isValidIBAN($v);</xsl:text>
- </xsl:if>
- <xsl:text>
- },</xsl:text>
- </xsl:if>
- <xsl:if test="$BBAN">
- <xsl:text>
- BBAN-</xsl:text><xsl:value-of select="@cc"/><xsl:text>: function($v){
- $v = $v.replace(/[^\dA-Z]/g,''); //removes any other characters
- return /</xsl:text><xsl:value-of select="@bbanstructpat"/>
- <xsl:text>/.test($v)</xsl:text>
- <xsl:if test="$checksum">
- <xsl:text> &amp;&amp; isValidBBAN($v);</xsl:text>
- </xsl:if>
- <xsl:text>
- },</xsl:text>
- </xsl:if>
- </xsl:template>
- <xsl:template match="countries">
- <xsl:if test="$checksum and $IBAN">
- <xsl:attribute name="isValidIBAN" >
- <xsl:value-of select="$IBANchecksum"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="$checksum and $BBAN">
- <xsl:value-of select="$BBANchecksum"/>
- </xsl:if>
- <xsl:text>var $patterns:{ //Map automatic generated by IBAN-Patterns Online Tool</xsl:text>
- <xsl:if test="$perCountry">
- <xsl:apply-templates select="country"/>
- </xsl:if>
- <xsl:if test="$global and $IBAN">
- <xsl:text>
- IBAN: function($v){
- $v = $v.replace(/[^\dA-Z]/g,'');
- return /</xsl:text>
- <xsl:for-each select ="country[position() &lt; last()]/@ibanstructpat">
- <xsl:value-of select="."/><xsl:text>|</xsl:text>
- </xsl:for-each>
- <xsl:value-of select="country[last()]/@ibanstructpat"/>
- <xsl:text>/.test($v)</xsl:text>
- <xsl:if test="$checksum">
- <xsl:text> &amp;&amp; isValidIBAN($v);</xsl:text>
- </xsl:if>
- <xsl:text>
- },</xsl:text>
- </xsl:if>
- <xsl:if test="$global and $BBAN">
- <xsl:text>
- BBAN: function($v){
- $v = $v.replace(/[^\dA-Z]/g,'');
- return /</xsl:text>
- <xsl:for-each select ="country[position() &lt; last()]/@bbanstructpat">
- <xsl:value-of select="."/><xsl:text>|</xsl:text>
- </xsl:for-each>
- <xsl:value-of select="country[last()]/@bbanstructpat"/>
- <xsl:text>/.test($v)</xsl:text>
- <xsl:if test="$checksum">
- <xsl:text> &amp;&amp; isValidBBAN($v);</xsl:text>
- </xsl:if>
- <xsl:text>
- },</xsl:text>
- </xsl:if>
- <xsl:text>
- };</xsl:text>
- </xsl:template>
-</xsl:stylesheet>
View
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" type="text/css" media="screen" href="../../3rd-party/jquery-ui/css/sunny/jquery-ui-1.8.9.custom.css"/>
- <script src="../../3rd-party/jquery/jquery.js" type="text/javascript" charset="UTF-8"> </script>
- <script src="../../3rd-party/jquerytransform/js/jquery.transform.js" type="text/javascript" charset="UTF-8"> </script>
-
- <script type="text/javascript" charset="UTF-8">
- $(document).ready(function(){
- function load($by){
- $('#result').transform({
- xml: "iban.xhtml",
- xsl: "iban.xsl",
- success:function(){
- //console.log('success ->',arguments);
- },
- error:function(){
- //console.log('error ->',arguments);
- },
- complete:function(){
- //console.log('complete ->',arguments);
- },
- xslParams: {
- by: $by
- }
- })
- };
- load(1);
- $('#col').keyup(function(){
- $('#result').empty();
- load(parseInt($(this).val()));
- });
- });
- </script>
- <style type="text/css" media="screen">
-
- </style>
- </head>
- <body>
- <label for="col">Order by:
- <input type="text" id="col" val="1"/>
- <br/>
- <div id="result"></div>
- </body>
-</html>
View
@@ -1,16 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use LWP::UserAgent;
-
-# parametro de entrada
-my $ua = LWP::UserAgent->new(agent => '');
-my $remot_page = 'http://en.wikipedia.org/wiki/International_Bank_Account_Number';
-my $response = $ua->get($remot_page);
-$response->is_success || die $response->status_line;
-
-my $html = $response->decoded_content;
-open FILE, ">iban.xhtml";
-print FILE $html;
-exit;
-
-
Oops, something went wrong.

0 comments on commit e425379

Please sign in to comment.