Questions tagged [schematron]

Schematron is a structural, rule-based validation language for XML documents. It uses XPath and XSLT to validate rules most other schemas can not.

Schematron is a rule-based validation language for XML documents. Schematron allows one to model complex relationships in XML content and to formulate rules that most other schema languages do not support. Schematron is not often used alone but is usually used along with another schema language. In this case, the other language is used to validate the grammar of the XML model and schematron is used to validate business rules.

One of its most powerful mechanisms is sch:assertion, that allows the author of the schema to assert arbitrary XPath expressions and report any content where this assertion failed. To date, XML Schema 1.1 is the only other schema language that supports assertions (while DTD, XML Schema 1.0 and RNG do not).

Although implementations exist that work directly with schematron schemas, the canonical model is to first transform the schema into an style sheet using stylesheets available at the schematron home page which can then be used to validate the input document by transforming it into Schematron Validation Report Language (SVRL), a language used for reporting the results of a schematron validation. Many of the implementations that work directly with schematron follow this canonical model internally.

An additional and highly positive feature of schematron is that the schema writer is free to write their own validation messages. This allows schematron to generate very clear explanatory error messages, a feature missing from other schema languages.

It was invented by Rick Jelliffe and is an ISO Standard. In addition to the main language, the same ISO standard defines the SVRL language used for reporting results of validations.

For a more thorough introduction to Schematron Erik Siegel's book "Schematron: A language for validating XML" might help.

255 questions
0
votes
0 answers

Can embedded Schematron see XSD types?

I have a simple schema that describes a component based subsystem of a game engine. Certain component types have restrictions on the combinations they can be found in. For example, the system defines a base type Selectable, which is in turn extended…
Selali Adobor
  • 2,060
  • 18
  • 30
0
votes
1 answer

Testing for matching file names in Schematron

I have an XML document with a list of xml, pdf, and tif files. I need to test via Schematron that each xml has a matching pdf file, and vice versa. My XML: foo.xml foo.pdf
user2093335
  • 197
  • 1
  • 2
  • 12
0
votes
1 answer

How to use phloc schematron-pure with Document -schema-definition

This question concerns phloc-schematron, a library for ISO Schematron validation. I am creating schematron-files on the fly, so I have them available as document (or as string of course) I cannot find a constructor for SchematronResourcePure that…
Bert Verhees
  • 1,057
  • 3
  • 14
  • 25
0
votes
1 answer

Cross platform xml validation with input parameters

I am trying to write a cross platform validator for a SAML Assertion against the SAML spec. I need a multiplatform XML validator that can take parameters to be used to compare to attributes in the XML. For example send in senderID to validate that…
Stefan Rasmusson
  • 5,445
  • 3
  • 21
  • 48
0
votes
1 answer

How to create an XSLT stylesheet

I have access to Schematron xsl files and a Schematron sch file. How can I transform this into an XSLT stylesheet using C# ? xsl + sch --> [??? XSLT Processor ??? ] --> xslt stylesheet
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
0
votes
1 answer

Schematron Assert Rule Fails while setting context

I am attempting to use NMatrix's Schematron to validate XML in C#. If I leave the "f" namespace out of the namespace-manager (nsManager), I get the exception: Undeclared namespace prefix - f when this code is executed. CompiledXPathExpression…
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
0
votes
1 answer

Validating an XML file with multiple schematron files

I have an XML file to be validated using Schematron. This file is a long file. So in order to make the job easier, I made separate Schematron rule files. Each Schematron file validates different section of the XML file. If the XML file is…
dino
  • 40
  • 7
0
votes
2 answers

Schematron: Element within mixed-type element only with other content

My XML Data should look like this: ...text... ...some content... ...text...
cis
  • 1,259
  • 15
  • 48
0
votes
1 answer

Schematron is unable to validate XML?

I am using Oxygen to validate my XML against a Schematron. For some reason (and I do not see where my mistake is) the XML is not getting validated / Oxygen throws an error. Why? Here is my XML text:
Maciej Cygan
  • 5,351
  • 5
  • 38
  • 72
0
votes
2 answers

Check for duplicated attribute data in sibling elements - Schematron

I'm trying to write a check in Schematron that will ensure no elements contain duplicated attribute data. These elements are at a specific location in the XML document, I have the XPATH that locates them. For example: should fail because it has…
Ryan Ternier
  • 8,714
  • 4
  • 46
  • 69
0
votes
1 answer

System function matches does not work in Oxygen schematron validation

I'm using OXygen XML Developer 15 to run a XML file validation against schematron. I'm getting errors on the system function "matches" on lines such as the following I…
chaoshangfei
  • 205
  • 4
  • 12
0
votes
1 answer

XML Schematron Validaton

this xml file Only Text Child node Child node Mixed content and this xsd file
bkiyak
  • 1
  • 2
0
votes
2 answers

Schematron test for text of content node (up to a certain position)

I want to write a Schematron rule which tests that the value within is either the current year, last year, or next year. The problem is that the value could contain a year range, for instance: 2013-2014. I only want to test the first four digits…
user2093335
  • 197
  • 1
  • 2
  • 12
0
votes
1 answer

How to convert xml to schematron

Can anyone please explain me how to convert the xml file to schematron file for validation? I am working on oracle soa and I wasn't able to figure out how.
cartman
  • 203
  • 3
  • 14
0
votes
1 answer

Saxon produces empty XML from Schematron

I am trying to compile Schematron file through the XSLT file (iso_svrl_for_xslt2.xsl) with help of Saxon9HE as described here and there. Here I am calling Saxon with 3 arguments: -o:schema-compiled.xsl is the output file (XSLT…
Jugo
  • 66
  • 8
1 2 3
16
17