-
Notifications
You must be signed in to change notification settings - Fork 6
Schematron support appears to not work #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Current Status of Schematron ValidationIf I recall correctly, the Schematron validation was disabled some time ago in the absence of any user feedback. If you open a Schematron file, you will find that the only Schematron specific support is syntax-highlighting of XPath in attributes like The documentation for the extension does not I believe claim Schematron support. There is admittedly code in place for Schematron but it is incomplete. I believe I paused work on this because at DeltaXignia we require many XSLT 3.0 features and therefore use non-standard extensions to Schematron which caused spurious errors (for us) in the Schematron files. Schematron Version?If I do re-implement Schematron validation, do you have a version that you would prefer? I see that SchXSLT extends the ISO Schematron standard (which is not publicly available). An XML Schema for Schematron would be most helpful to bring the validation up to date, but not essential. The schSchema.ts TypeScript file was auto-generated from an old Schematron XML Schema but I don't recall where I sourced this from, it was quite possibly an indirect source. Do you know where I can locate an authoritative version of the XML Schema? |
There's an unofficial schema copy at https://github.com/Schematron/schema The authoritative source is, of course, the ISO standard (plus errata). Happily, the schema in the standard says that you can copy, and even modify, it. I found the Schematron mentions in the code, so had assumed that it would work. |
Thanks for that Schematron Schema link, it will prove useful to verify the data I have. I still have long-term ambitions to support validating the Schematron standard, hence I didn't remove the code I had already written. I had to cut short this work though when I switched to another feature and then haven't got around to returning to this. I'm coding daily in XSLT 3.0 or 4.0, so this is where the focus for this project tends to lie. On the other hand, it is a relatively quick win to exploit the existing code for other standards that include XSLT/XPath features like Schematron. |
Sorry to be a distraction, but can you say what would be needed to re-enable the Schematron support? |
That's fine, I'm very happy to get feedback and questions. I'll check the code history to see where/when I disabled Schematron validation support. If memory serves, it was still very much a work in progress. |
I've found where Schematron validation is disabled: In xsltSymbolProvider.ts there's the following code, starting on line 205: if (this.collection && this.docType !== DocumentTypes.SCH) {
let importDiagnostics: vscode.Diagnostic[] = [];
importErrors.forEach((importError) => {
importDiagnostics.push(XsltTokenDiagnostics.createImportDiagnostic(importError));
});
let allDiagnostics = importDiagnostics.concat(diagnostics);
if (allDiagnostics.length > 0) {
this.collection.set(document.uri, allDiagnostics);
} else {
this.collection.clear();
};
} For a Schematron file, the condition on line 205 evaluates to false because of the expression: this.docType !== DocumentTypes.SCH Removing this expression give us just: if (this.collection) {
...
} Running the extension with this modified code results in me getting lots of validation errors within our non-standard schematron. XPath expressions in the Schematron file reference variables and functions that are within XSLT files included using So, with the code changed, there's some validation, but the implementation seems to be at quite an early stage. |
Thanks. Can you make a branch for this and then we'll see if I or anyone else can do anything with it? |
Thanks for the branch. |
I'm currently working on the 'issue-144' branch, unfortunately the It anyone else works on Schematron validation, it may be better to merge the 'issue-144' branch onto the |
I have renamed elements and attributes in
test.sch
from the Git repository to make them invalid, and VS Code does not complain.How is the Schematron support supposed to work?
The text was updated successfully, but these errors were encountered: