Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.



As indicated above, DDEX has published ISO/Schematron rules for recent ERN versions to its members. These Schematron files can be used to verify whether an ERN message conforms to the relevant profile.

They can be used in an XML editor in the same way as an XSD as long as the editor is able to handle XSLT2 and Xpath2 expressions. Most modern XML editors – such as Oxygen and XmlSpy[2] – are XSLT2/Xpath2 compatible. 




In Oxygen this can be done by clicking the downward triangle next to the XSD validation button (encircled in red in the diagram below), selecting “Validate with…” and entering the appropriate information into the relevant window:

  • The URL field needs to point to the Schematron file provided by DDEX; and
  • The Schema Type field needs to have “Schematron” selected.

Any Schematron error will, as with the XSD validation, allow the user to navigate to the offending location. And, as with XSD validation, a green box in the top right corner indicates that no Schematron errors were found.

Command Line (UNIX)

The Schematron validation can also be done from a command line or within an application. However, the process is a bit more complex and involves having a working XSLT processor capable of handling style sheets in version XSLT2 installed.

Below is the process for the Saxon processor. Schematron files are, in effect, XML Stylesheets (XSLTs) but they need to be prepared for the specific XSLT processor at hand. For Saxon this happens in three steps and involves calling a Java runtime environment as follows:

Code Block
> java -jar $saxon -xsl:iso_dsdl_include.xsl -o:tmp1.xml -s:ddex.sch
> java -jar $saxon -xsl:iso_abstract_expand.xsl -o:tmp2.xml -s:tmp1.xml
> java -jar $saxon -xsl:iso_svrl_for_xslt2.xsl -o:ddex.xsl -s:tmp2.xml


With $saxon pointing to the JAR file from the Saxon package and ddex.sch being the Schematron rules file provided by DDEX. The above three steps can be prepared and only the output from the last command, ddex.xsl, needs to be retained. This file can then be used to test a DDEX Message file as follows:

Code Block
> java -jar $saxon -xsl:ddex.xsl -s:test_file.xml > output.xml


The output will be an XML file that can be parsed, for example, by grep, and if the string role="Fatal Error" does not occur, the file passes the validation.
The Schematron rules are set up in a way, however, to also provide warnings and conditional errors that can equally be filtered out by role="Error", role="Conditional Error" and role="Conditional Fatal Error". In addition, the documentation of the errors provides information on the rule that has been violated.

Command Line (Windows)

For Windows systems the same procedure as for UNIX can be used and the two commands for generating the XSLT file ddex.xsl from the Schematron file and using it to test the file test_file.xml are as follows:

Code Block
c:/> java -jar %SAXON_PATH% -o:ddex.xsl -s:ddex.sch iso_svrl_for_xslt2.xsl
c:/> java -jar %SAXON_PATH% test_file.xml ddex.xsl > output.xml

Online tool

DDEX is in the process of developing and deploying an online tool that can be used to test messages. 


The two screen shots below show a successful and an unsuccessful test. In each case, a log file containing all findings is generated. The script is provided in Annex A.


titlePerl Script for DSRF Validator



This is a Perl script calling the DSRF Validator discussed in Clause 3 to test whether a DSR file is in accordance with the relevant profile. The script, written for OS X, expects the variables $validator to point to the location of the DSRF Validator. 

Code Block
use strict;
use warnings;
print "\ -- tool to check conformance of a DSRF file. \n"
print "(c) 2016 Digital Data Exchange, LLC, utilising Google's dsrf library\n\n";
# set variables (filelist being the alphabetical list of input files)
my $validator = "/Users/nrump/bin/dsrf";
my $parser = $validator . "/";
my $conformance = $validator . "/conformance/";
my $log = "/tmp/example.log";
my $log2 = "/tmp/example2.log";
my $usage = "Please use the script as follows:\n\ FILE [FILE*]\nProgram aborted";
my @filelist = sort (@ARGV);
my $filecount = $#ARGV + 1;
my $profile = "";
$/ = "\r";     # to support all kinds of CR/LF/CRLF combos
# see if at least one file has been given and that all files exist
die "No file to process. $usage" if ( $filecount < 1);
-f or die "File '$_' does not exist. $usage" foreach (@filelist);
# open the first file (which is ...1ofx... as the array is sorted) and obtain the profile
open (FILE, "<$filelist[0]");
  s/^\s+//; # make sure there are no leading spaces
  next unless (/^HEAD/);
  my @fields = split "\t";
close FILE;
# end validation if there is no profile
# if there is: remove all spaces from the profile name (as this is what the tool expects)
if ( $profile eq "") {
  print "    No profile given in $filelist[0]\n    Conformance cannot be tested\n";
  open FILE, $filelist[0].log; 
  print FILE "No profile given in $filelist[0]\n    Conformance cannot be tested\n";
  close FILE;
print "Checking input file(s) against the $profile:\n\n";
$profile =~ s/ //g;
system "python $parser @filelist | python $conformance > $log2";
system "cat $log $log2 > $filelist[0].log"; 
system "rm -f $log $log2";
print "\n\nAll done. Results are in $filelist[0].log\n";