1

I am starting with Peppol Invoices based on XML. What I need is to be able to locally validate the XML of the invoice document. (I know that on-line validators do exist.) The next step will be the validation using the Schematron language -- and that requires XSLT 2.0. As Windows environment (without Java) is likely to be used, I have chosen XmlPrime tools -- their xslt.exe.

To avoid fiddling with paths, I have put all the needed .xsd files, and also the invoice.xml file to the same directory:

enter image description here

Looking at their reference page (https://www.xmlprime.com/xmlprime/doc/2.0/xslt-command-line-reference.htm), I am still not able to tell the xslt.exe "do the validation against the schema":

enter image description here

The Invoice xsd namespaces and version look like that:

enter image description here Using the option --xsd and the later -v (for validate) I thought the xslt.exe can be used for validating against the schema. It clearly says that it needs <xsl:stylesheet> or <xsl:transform> -- I know I do not want the transformation. I need the validation.

How can the XmlPrime's xslt.exe be used for validation against the XML Schema?

Update: I should better explain my goals. For that, here is more realistic content of my testing directory. The common/ contain the .xsd files for validation and one .xslt file that produces the HTML version of an XML invoice document. All of that is officially available as is. Then the samples/ are the real samples produced from an ERP system somehow (using some tools I do not know). My goal is to do: the validation of the invoice XML structure (a must), validation against the XML schema (here the UBL-Invoice-2.1.xsd), and the validation against Schematron rules (the validity of used values; here the peppol_schematron/PEPPOL-EN16931-UBL.sch). So, everything I am trying to do is to follow that path:

enter image description here

I am still considering XmlPrime and also Saxon. The task is solved for the third party, the license price matters, but need not to be free. It is still not clear what is a must and what will not be needed in near future. However, the decisions should be done and core of the solution should be ready, say, within 3 weeks.

4
  • .NET can do XSD 1.0 based validation, without the need for a third party library. Commented Oct 29 at 15:53
  • With XmlPrime, I think you can use serialize.exe to do dtd based or xsd 1.0 based validation Commented Oct 29 at 15:58
  • If you are using an XSLT processor for validation but do not want to perform any transformation you could use a stylesheet that contains only the identity transform template. There's probably a simpler way that doesn't involve XSLT. Commented Oct 29 at 16:00
  • @MartinHonnen: Well, I am also learning all the things around XSLT, XSD, ... And the goal is to use also the XSLT to generate transformed output. All of that is related to Peppol, and some of the tools require XSLT 2.0, and I have found only Saxon and XmlPrime for what I may have need in future. So, I am a bit lost in all the new area. Commented Oct 29 at 20:46

1 Answer 1

1

You could consider using XMLPrime's xquery command line tool, again using the --xsd and -v options, with a simple query of "." which returns the input document unchanged (after validation, of course).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, for the XQuery hint (up-voted). I probably understand the idea, but I was not able to make it work either. I have added the Update to the end of the question. It show indirectly that I consider a Python solution the first "quick hack" (XmlPrime or Saxon), possibly later using the library to write some dedicated C# solution. Things around the need/solution are still being clarified -- they depend not only on me (more decisions, things to learn, time pressure).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.