ESPD validation tool based on Schematron rules
Audience
This is a technical repository and is intended to be used as a tool that has as input:
- Code Lists,
- ESPD Request and ESPD Response, and
- UBL
- Schematron rules specific to ESPD business rules
and produces the XSL files that can be used to either validate locally any ESPD Request and/or ESPD Response or as the online service on ISAITB testbed site. You can see the validation files on the associated GitHub repository.
This repository is a processing tool that implements ESPD business rules in Schematron format in order to validate ESPD Request and ESPD Response files in XML format. ESPD is based on UBL with a couple of extra business rules. Thus the validation of an ESPD document is based on UBL Documents QualificationApplicationRequest for ESPD Request and QualificationApplicationResponse for ESPD Response.
All ESPD-specific business rules are described in terms of Schematron rules. Those rules are processed and transformed into XSL files.
The espd-schematron.bat file which is used to generate the schematron and XSL validation files is a Windows Batch file, and can only be run in a Windows environment.
You need to have installed the following tools on your machine before starting to use the ESPD Validation tool:
- Git client (GitBash or GitHub Desktop on Windows, native on OSX and Linux)
- Java JDK v1.8 or higher, you can use OpenJDK
- IDE tool of your choice (e.g. Visual Studio Code)
Get the current repository on your local computer:
git clone https://github.com/OP-TED/espd-validation-schematron.git
This will create the folder espd-validation-schematron on your local computer. You may use your preferred IDE to edit the specific files. You need a Windows terminal, either the Windows Command Prompt, or in an IDE, to run the commands and tools.
The folder structure is standard and contains:
espd-schematron-gc.bata Windows batch executable that is present in the root of the folderESPDRequestthe folder containing the necessary input and output files for ESPD Request validationESPDResponsethe folder containing the necessary input and output files for ESPD Response validationcommonthe folder containing all common artefacts, libraries, and XSD files necessary to validate and produce extra validatorsgcthe folder contains all Code List files- the
logsfolder contains the output of the execution of internal pipelines and should be checked for errors. If any errors occur during processing they are in the log files after each execution.
This tool is provided as is and is intended to be used as an intermediary step in the entire chain of the ESPD validation process. Any contributions, suggestions and improvements are more than welcome. Please feel free to open a GitHub issue for your feedback.
The tool will validate:
- Code Lists
- ESPD Request
- ESPD Response
all files are in XML format.
External data sources
Please update the files in the ESPD-EDM repository first and then proceed.
The following files should be copied from the ESPD-EDM repository
| from ESPD-EDM | to espd-validation-schematron | comments |
|---|---|---|
codelists/gc |
gc |
Update both external and technical Code Lists in ESPD-EDM and then copy the content of the folder to espd-validation-schematron |
xml-examples/ESPD-criterion.xml |
ESPDRequest/xsl and ESPDResponse/xsl |
This is the same file as ESPD-Request.xml from ESPD-EDM repository. Copy the same file to 2 different folders |
xml-examples/ESPD-Request.xml |
common/xml/ESPD-Request-BASE.xml and common/xml/validation_samples/ESPD-Request.xml |
Copy the same file to 2 different folders |
xml-examples/ESPD-Response.xml |
common/xml/ESPD-Response-BASE.xml and common/xml/validation_samples/ESPD-Response.xml |
Copy the same file to 2 different folders |
ubl-2.4/xsdrt |
common/xsdrt |
Update the UBL distribution file in ESPD-EDM and then copy the content of the folder to espd-validation-schematron |
External Code Lists are provided by EU Vocabularies. The ESPD example files are generated from the Excel Criterion file or from the ESPD Demo site. The UBL files are directly downloaded from the UBL distribution site. Once the external files are in place we can proceed to modifying the internal files.
Internal files
Please use only relative paths inside the files so that the pipelines can be run independently on the local file location specific to the user's computer.
The following internal files must be updated after all external files have been copied:
common/cva/01-ESPD-codelist-values.cvacontains the updated list with all codelist files, seegcfolder for a complete list of codelist files, and ESPD-specific business rules associated to each codelist.common/libcontains all Java libraries. Please update the libraries so that the version are mutually compatible with both the JDK installed version and each other.common/schcontains the Schematron rules specific to the ESPD. Those rules must be updated according to changes implemented in the ESPD model.01-ESPD-common-cl-attributes.schcontains the common criterion business rules for attributes that get their values from codelists.01-ESPD-common-cl-values-restrictions.schcontains the restrictions for common criterion business rules for attributes that get their values from codelists - no restrictions for the moment.03-ESPD-common-criterion-br.schcontains the set of rules associated to thecac:TenderingCriterionelement for both ESPD Request and ESPD Response.04-ESPD-common-other-br.schcontains the cardinality constraints and other general business rules
common/xmlcontains the base examples that will be used as input for validation. Specific examples can be found in subfoldervalidation_samplesand can be used for specific validation. This has to be configured manually. Only the base example files are used in the processing chain.common/xsdcontains the general XSD files used for XML validation.ContextValueAssociation.xsdis currently not used, but could be used to validate the.cvafiles.genericode.xsdis used to validate Code Lists fromgcxml.xsdis used by the above.xsdfiles to validate the XML namespace.
common/xsdrtcontains the XSD run-time files for UBL documents validation. ESPD documents are based on UBL DocumentsQualificationApplicationRequestfor Request andQualificationApplicationResponsefor Responsecommon/xsl/contains generic XSL transformation tools used to transform schematron files, cva files and for internal pipelines. Those files should be updated only if necessary.Crane-cva2schXSLT.xsl- used to transform the CVA to SCHCrane-Constraints2SchematronXSLT.xsl- used byCrane-cva2schXSLT.xslCrane-genericode-CodeList.xsl- used byCrane-cva2schXSLT.xslMessage-Schematron-terminator.xsl- not usediso_svrl_for_xslt2.xsl- used to transform Schematron.schfiles into XSLT.xslfilesiso_schematron_skeleton_for_saxon.xsl- used byiso_svrl_for_xslt2.xslwhen using the Saxon libraryiso_schematron_skeleton_for_xslt1.xsl- not used
ESPDRequestcontains ESPD Request validation related files.schcontains Schematron business rules that have to be considered for full validation of the ESPD Request. Some of the files are generated automatically, some are managed manuallyxslcontains the result of transforming Schematron files to XSL. ThecriterionList.xmlfile is maintained manually andESPD-criterion.xmlis from ESPD-EDM.outputcontains the results produced by the steps within the internal pipelines. Those files are automatically generated.
ESPDResponsecontains ESPD Response validation related files.schcontains Schematron business rules that have to be considered for full validation of the ESPD Response. Some of the files are generated automatically, some are managed manually.xslcontains the result of transfoming Schmematron files to XSL. ThecriterionList.xmlfile is maintained manually andESPD-criterion.xmlis from ESPD-EDM.outputcontains the results produced by the steps within the internal pipelines. Those files are automatically generated.
The 3 .bat files which comprised the tool in previous releases have been combined into one espd-schematron.bat file in the root folder. You must have a Java environment (JAVA_HOME, Path) set up for the command line execution.
This bat file uses the common/lib/xjparse.jar and common/lib/saxon9he.jar libraries.
The order of execution of the bat files in previous releases was: all phases for the ESPD Request, then all phases for the ESPD Response. This order has been changed in the single bat file in this release to be per phase, with both ESPD Request and ESPD Response processed in some phases.
Phase 0 - Code List XML validation against the Genericode schema
All Code List files *.gc are parsed against the Genericode schema common\xsd\genericode.xsd using common\lib\xjparse-app-3.0.0.jar, output is sent to logs\gc\00-GC_Files.txt.
Phase 1 - Code List schematron generation
This phase converts the codelist value constraints document into schematron files (one each for ESPDRequest and ESPDResponse). For each ESPD, the file common\cva\01-ESPD-codelist-values.cva is converted into an XSLT document using common\xsl\Crane-cva2schXSLT.xsl. Then the XSLT documents is run against itself to produce the schematron ESPDRequest\sch\01-ESPD-codelist-values.sch and ESPDResponse\sch\01-ESPD-codelist-values.sch files.
Phase 1: ESPD Request / ESPD Response codelist value schematron generation
-
source common/cva/01-ESPD-codelist-values.cvatransform common/xsl/Crane-cva2schXSLT.xsloutput logs/ESPDRequest/output/01-ESPD-codelist-values.xsllog logs/ESPDRequest/01-CVAtoSCH.txt -
source logs/ESPDRequest/output/01-ESPD-codelist-values.xsltransform logs/ESPDRequest/output/01-ESPD-codelist-values.xsloutput ESPDRequest/sch/01-ESPD-codelist-values.schlog logs/ESPDRequest/01-CVAtoSCH.txt -
source common/cva/01-ESPD-codelist-values.cvatransform common/xsl/Crane-cva2schXSLT.xsloutput logs/ESPDResponse/output/01-ESPD-codelist-values.xsllog logs/ESPDResponse/01-CVAtoSCH.txt -
source logs/ESPDResponse/output/01-ESPD-codelist-values.xsltransform logs/ESPDResponse/output/01-ESPD-codelist-values.xsloutput ESPDResponse/sch/01-ESPD-codelist-values.schlog logs/ESPDResponse/01-CVAtoSCH.txt
Phase 2: ESPD Request transform SCH to XSL
-
source ESPDRequest/sch/01-ESPD-codelist-values.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/01-ESPD-codelist-values.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source ESPDRequest/sch/02-ESPD-req-cardinality-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/02-ESPD-req-cardinality-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source common/sch/04-ESPD-common-other-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/04-ESPD-common-other-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source ESPDRequest/sch/05-ESPD-req-procurer-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/05-ESPD-req-procurer-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source ESPDRequest/sch/04-ESPD-req-other-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/04-ESPD-req-other-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source common/sch/03-ESPD-common-criterion-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/03-ESPD-common-criterion-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source ESPDRequest/sch/03-ESPD-req-criterion-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/03-ESPD-req-criterion-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source common/sch/01-ESPD-common-cl-attributes.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/01-ESPD-common-cl-attributes.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source ESPDRequest/sch/05-ESPD-req-specific-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/05-ESPD-req-specific-br.xsllog logs/ESPDRequest/02-SCHtoXSL.txt -
source common/sch/01-ESPD-common-cl-values-restrictions.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDRequest/xsl/01-ESPD-common-cl-values-restrictions.xsllog logs/ESPDRequest/02-SCHtoXSL.txt
Phase 3: ESPD Response transform SCH to XSL
-
source ESPDResponse/sch/01-ESPD-codelist-values.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/01-ESPD-codelist-values.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/02-ESPD-resp-cardinality-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/02-ESPD-resp-cardinality-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source common/sch/04-ESPD-common-other-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/04-ESPD-common-other-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/05-ESPD-resp-eo-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/05-ESPD-resp-eo-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/04-ESPD-resp-other-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/04-ESPD-resp-other-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source common/sch/03-ESPD-common-criterion-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/03-ESPD-common-criterion-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/05-ESPD-resp-role-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/05-ESPD-resp-role-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/03-ESPD-resp-criterion-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/03-ESPD-resp-criterion-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/05-ESPD-resp-qualification-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/05-ESPD-resp-qualification-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source ESPDResponse/sch/05-ESPD-resp-specific-br.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/05-ESPD-resp-specific-br.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source common/sch/01-ESPD-common-cl-attributes.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/01-ESPD-common-cl-attributes.xsllog logs/ESPDResponse/02-SCHtoXSL.txt -
source common/sch/01-ESPD-common-cl-values-restrictions.schtransform common/xsl/iso_svrl_for_xslt2.xsloutput ESPDResponse/xsl/01-ESPD-common-cl-values-restrictions.xsllog logs/ESPDResponse/02-SCHtoXSL.txt
Phase 3: ESPD Response validation vs UBL and XSL
-
source common/xml/ESPD-Request-BASE.xmltransform common/xsdrt/maindoc/UBL-QualificationApplicationRequest-2.3.xsdoutput logs/ESPDRequest/output/result-xsd.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/01-ESPD-codelist-values.xsloutput logs/ESPDRequest/output/01-ESPD-codelist-values.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/02-ESPD-req-cardinality-br.xsloutput logs/ESPDRequest/output/02-ESPD-req-cardinality-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/04-ESPD-common-other-br.xsloutput logs/ESPDRequest/output/04-ESPD-common-other-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/05-ESPD-req-procurer-br.xsloutput logs/ESPDRequest/output/05-ESPD-req-procurer-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/04-ESPD-req-other-br.xsloutput logs/ESPDRequest/output/04-ESPD-req-other-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/03-ESPD-common-criterion-br.xsloutput logs/ESPDRequest/output/03-ESPD-common-criterion-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/03-ESPD-req-criterion-br.xsloutput logs/ESPDRequest/output/03-ESPD-req-criterion-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/01-ESPD-common-cl-attributes.xsloutput logs/ESPDRequest/output/01-ESPD-common-cl-attributes.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/05-ESPD-req-specific-br.xsloutput logs/ESPDRequest/output/05-ESPD-req-specific-br.xmllog logs/ESPDRequest/03-validation.txt -
source common/xml/ESPD-Request-BASE.xmltransform ESPDRequest/xsl/01-ESPD-common-cl-values-restrictions.xsloutput logs/ESPDRequest/output/01-ESPD-common-cl-values-restrictions.xmllog logs/ESPDRequest/03-validation.txt
Phase 3: ESPD Response validation vs UBL and XSL
-
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/01-ESPD-codelist-values.xsloutput logs/ESPDResponse/output/01-ESPD-codelist-values.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/02-ESPD-resp-cardinality-br.xsloutput logs/ESPDResponse/output/02-ESPD-resp-cardinality-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/04-ESPD-common-other-br.xsloutput logs/ESPDResponse/output/04-ESPD-common-other-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/05-ESPD-resp-eo-br.xsloutput logs/ESPDResponse/output/05-ESPD-resp-eo-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/04-ESPD-resp-other-br.xsloutput logs/ESPDResponse/output/04-ESPD-resp-other-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/03-ESPD-common-criterion-br.xsloutput logs/ESPDResponse/output/03-ESPD-common-criterion-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/05-ESPD-resp-role-br.xsloutput logs/ESPDResponse/output/05-ESPD-resp-role-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/03-ESPD-resp-criterion-br.xsloutput logs/ESPDResponse/output/03-ESPD-resp-criterion-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/05-ESPD-resp-qualification-br.xsloutput logs/ESPDResponse/output/05-ESPD-resp-qualification-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/05-ESPD-resp-specific-br.xsloutput logs/ESPDResponse/output/05-ESPD-resp-specific-br.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/01-ESPD-common-cl-attributes.xsloutput logs/ESPDResponse/output/01-ESPD-common-cl-attributes.xmllog logs/ESPDResponse/03-validation.txt -
source common/xml/ESPD-Response-BASE.xmltransform ESPDResponse/xsl/01-ESPD-common-cl-values-restrictions.xsloutput logs/ESPDResponse/output/01-ESPD-common-cl-values-restrictions.xmllog logs/ESPDResponse/03-validation.txt
- for Code List files validation errors please check
logs/gc/00-GC_Files.txt - for ESPD Request validation errors please check:
logs/ESPDRequest/outputfiles for each step in the pipeline - for ESPD Response validation errors please check:
logs/ESPDResponse/outputfiles for each step in the pipeline
Please consult the input source file and the transformation file in order to fix the errors.
Once the validation is executed successfully (check for any errors in the log files, especially validation errors), we can use the files produced in ESPDRequest and ESPDResponse folders to copy to the ESPD-EDM repository validation folder. The files from the ESPD-EDM repository should be copied to validation-resources-espd repository.
| from espd-validation-schematron | to ESPD-EDM |
|---|---|
ESPDRequest/sch/ |
validation/ESPDRequest/sch/ |
ESPDRequest/xsl/ |
validation/ESPDRequest/xsl/ |
ESPDResponse/sch/ |
validation/ESPDResponse/sch/ |
ESPDResponse/xsl/ |
validation/ESPDResponse/xsl/ |
common/cva/ |
validation/common/cva/ |
common/sch/ |
validation/common/sch/ |
| from ESPD-EDM | to validator-resources-espd |
|---|---|
validation/ESPDRequest/xsl/ |
resources/vX.X.X/ESPDRequest/ |
validation/ESPDResponse/xsl/ |
resources/vX.X.X/ESPDResponse/ |
codelists/gc/ |
resources/vX.X.X/gc/ |
ubl-2.3/xsdrt/ |
resources/vX.X.X/xsdrt/ |
The project is developed and distributed under the European Union Public Licence (EUPL) version 1.2.