gap777 / SchemaTron

Native C#/.NET implementation of ISO schematron
Other
19 stars 7 forks source link

Trying to use SchemaTron for NEMSIS V3 #9

Closed calvin940 closed 9 years ago

calvin940 commented 9 years ago

Firstly, I apologize for using this forum to communicate with you but private messaging has been removed and there did not appear to be any other way to contact you.

Having a problem with trying to use the NEMSIS schematron file and I am getting an exception related to a <?DSDL_INCLUDE_START that defines a series of elements near the beginning of the file. it seems to be related to the iso_dsdl_include.xsl and corresponding transform but you indicated in a post on stack overflow that you don't have that process and that it is all done in memory. Admittedly I am very new to this whole process of SchemaTron and the XSLT transforms required for validation so I may have one or more things wrong or misunderstood about this process. The complete schematron file is available here:

http://nemsis.org/v3/downloads/schematron.html

The following is the section in question.

EMS Agency Unique State ID EMS Agency Number . . . /xsl:variable . . . So I am doing essentially this: ``` XDocument schema = XDocument.Load(schematronFile); XDocument document = XDocument.Load(documentFile); ValidatorSettings vs = new ValidatorSettings(); Validator validator = Validator.Create(schema); // the second parameter turns off the full validation ValidatorResults results = validator.Validate(document, true); ``` but I get the following exception in the create: The variable '$nemSch_lookup_elements' is not defined or is out of scope. at XmlPrime.Compilation.BindingVisitor.BindVariable(UnboundVariableReference expression, Boolean tunnelled) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitChild(Expression expression, Int32 child) at XmlPrime.Compilation.BindingVisitor.VisitBase(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.BindingVisitor.Visit(Expression expression) at XmlPrime.Compilation.RewritingVisitor.VisitBody(UserDefinedModule module) at XmlPrime.Compilation.BindingVisitor.Visit(UserDefinedModule module) at XmlPrime.Core.UserDefinedModule.Bind() at XmlPrime.XPath.CompileMainModule(XPathModule module) at XmlPrime.XPath.Compile(String expression, XPathSettings settings) at XRouter.SchemaTron.Validator.CompileXPathExpressions(Schema schema, Uri baseUri) in c:\MMT\Source\NV3 - Main\SES\Schematron\Validator.cs:line 335 Any light you can shed would be greatly appreciated. Cheers Andy
calvin940 commented 9 years ago

Hi Gary,

Not sure what happened here with your message or if there was an inadvertent send with no body etc.

I am sorry that I used the issues list to ask you a question, but I honestly couldn't figure out how to send you a message and was looking for some help.

Would you be amenable to continuing this conversation over email and helping me out? I can understand if you are too busy to provide some guidance in which case feel free to close the issue I created if you feel it is inappropriate.

If you can help, however, it would be very much appreciated.

Cheers Andy

On Thu, Apr 2, 2015 at 11:46 AM Gary Passero notifications@github.com wrote:

Andy,

— Reply to this email directly or view it on GitHub https://github.com/gap777/SchemaTron/issues/9#issuecomment-88933190.

gap777 commented 9 years ago

Andy, I'd like to help and didn't mean to close the issue. I started looking into it, and don't have any insights yet. Let's take this offline. Email me directly on gmail using my first letter of first name and my last name.

gap777 commented 9 years ago

Andy,

It looks like the XRouter Schematron is not properly handling xsl:variables. I'm looking into how this should be handled.

Good catch!

I'll let you know as soon as I have a fix in hand.

Gary

gap777 commented 9 years ago

Andy,

I'm guessing here, so if you find more definitive answers, please share them with me so I might learn as well.

I think the problem is that this project supports ISO/IEC 19757-3:2006 available here, which is an international standard to be revised.

The NEMSIS schematron appears to be targeting features proposed in ISO/IEC DIS 19757-3 available here which has been voted upon, but not approved, published, reviewed, etc.

I suggest the creation of an XSL-based schematron in .NET using XmlPrime -- the XSL-based reference implementation of schematron (for xslt2) can be compiled (using XmlPrime's Xslt class) and then evaluated over-and-over for each document instance. This will give you much faster program performance than calling out to a xslt2 program (like saxon's), or even using XmlPrime's xslt.exe. You can return the results in SVRL, and then convert these to in-memory error objects to aid in development, testing, debugging, etc.

I can assist you with this, if you like. I think it would be a wonderful asset for the .NET developer community.

My regrets that XRouter Schematron isn't able to support the features required by the Query Language Bindings for XSLT2 listed in ISO/IEC DIS 19757-3.