-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from OpenPEPPOL/POACC-735
POACC-735 updated COMMON-049 and release notes
- Loading branch information
Showing
5 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Function for Swedish organisation numbers (0007) --> | ||
<function xmlns="http://www.w3.org/1999/XSL/Transform" name="u:checkSEOrgnr" as="xs:boolean"> | ||
<param name="number" as="xs:string"/> | ||
<choose> | ||
<!-- Check if input is numeric --> | ||
<when test="not(matches($number, '^\d+$'))"> | ||
<sequence select="false()"/> | ||
</when> | ||
<otherwise> | ||
<!-- verify the check number of the provided identifier according to the Luhn algorithm--> | ||
<variable name="mainPart" select="substring($number, 1, 9)"/> | ||
<variable name="checkDigit" select="substring($number, 10, 1)"/> | ||
<variable name="sum" as="xs:integer"> | ||
<value-of select="sum( | ||
for $pos in 1 to string-length($mainPart) return | ||
if ($pos mod 2 = 1) | ||
then (number(substring($mainPart, string-length($mainPart) - $pos + 1, 1)) * 2) mod 10 + | ||
(number(substring($mainPart, string-length($mainPart) - $pos + 1, 1)) * 2) idiv 10 | ||
else number(substring($mainPart, string-length($mainPart) - $pos + 1, 1)) | ||
)"/> | ||
</variable> | ||
<variable name="calculatedCheckDigit" select="(10 - $sum mod 10) mod 10"/> | ||
<sequence select="$calculatedCheckDigit = number($checkDigit)"/> | ||
</otherwise> | ||
</choose> | ||
</function> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters