Sign In/My Account | View Cart  
advertisement

Article:
 Comparing XML Schema Languages
Subject: ISBN checksum validation
Date: 2006-06-26 20:15:28
From: Conal

I found this article while searching for a way to validate ISBNs using Schematron. The article hints that this is possible, but doesn't give an example. For future reference, the following XPath expression can be used in schematron as the "test" attribute of an "assert" element:


substring(
'0123456789X',
11 + 1 - (
10 * substring(translate(., ' -', ''), 1, 1) +
9 * substring(translate(., ' -', ''), 2, 1) +
8 * substring(translate(., ' -', ''), 3, 1) +
7 * substring(translate(., ' -', ''), 4, 1) +
6 * substring(translate(., ' -', ''), 5, 1) +
5 * substring(translate(., ' -', ''), 6, 1) +
4 * substring(translate(., ' -', ''), 7, 1) +
3 * substring(translate(., ' -', ''), 8, 1) +
2 * substring(translate(., ' -', ''), 9, 1)
) mod 11,
1
) = substring(translate(., ' -', ''), 10, 1)


Previous Message Previous Message   Next Message No Next Message


Sponsored By: