Combined Relax NG + Schematron
Are you missing a feature? Request its implementation here.
-
- Posts: 80
- Joined: Fri Apr 23, 2004 5:24 pm
- Location: Durham, NC, USA
Combined Relax NG + Schematron
I'd like to try out some Relax NG with emebedded Schematron -- it looks like a great alternative to WXS. I'm new to both Relax NG and Schematron, though, so I'm still trying to figure out how to best set up oXygen to make document validation easy.
I see from James Clark's website that Jing has support for (?embedded ?separate) Schematron constraints in addition to Relax NG.
Can you give some tips on how to set up (Jing inside) the oXygen environment to make embedded embedded Schematron constraints function in a convenient way?
Thanks, John
I see from James Clark's website that Jing has support for (?embedded ?separate) Schematron constraints in addition to Relax NG.
Can you give some tips on how to set up (Jing inside) the oXygen environment to make embedded embedded Schematron constraints function in a convenient way?
Thanks, John
-
- Posts: 80
- Joined: Fri Apr 23, 2004 5:24 pm
- Location: Durham, NC, USA
I actually did make a bit of progress on this, which might be of interest to others. From Topologi's website I downloaded their freeware Schema Validator (which is a really nice utility, btw, and very much worth having). Eddie Robertsson wrote a nice little xsl named RNG2Schtrn to extract embedded schematron from rng, which is included in that download.
A nice new (?) feature of the transformation scenarios dialog in oxygen 4.0 is that it lets you chain xslt's. So I put RNG2Schtrn as my first transform (I'm assuming Eddie R. wouldn't mind), then chained that to my copy of schematron-basic.xsl and specified saving the output of that transform (which is the compiled validation transform) in the same folder as the open file.
So now, if I "one-button" apply the transformation scenario to an .rng file that contains embedded Schematron, I get a saved version of the compiled schematron validator xslt in the same folder as the .rng.
To do the schematron validation, I still have to manually open the validator and apply it to the instance document, but it still is a little more automated.
A nice new (?) feature of the transformation scenarios dialog in oxygen 4.0 is that it lets you chain xslt's. So I put RNG2Schtrn as my first transform (I'm assuming Eddie R. wouldn't mind), then chained that to my copy of schematron-basic.xsl and specified saving the output of that transform (which is the compiled validation transform) in the same folder as the open file.
So now, if I "one-button" apply the transformation scenario to an .rng file that contains embedded Schematron, I get a saved version of the compiled schematron validator xslt in the same folder as the .rng.
To do the schematron validation, I still have to manually open the validator and apply it to the instance document, but it still is a little more automated.
-
- Posts: 80
- Joined: Fri Apr 23, 2004 5:24 pm
- Location: Durham, NC, USA
Okay, I now have a pretty good setup for doing validation of RNG with embedded Schematron inside the oXygen 4.0 environment. Here's what I did, see if you like my system:
(1) Create a folder ../oXygen4.0/Schematron.
(2) Into that folder, put the following files (see below for sources): RNG2Schtrn.xsl, skeleton1-5.xsl, schematron-basic.xsl. (You can get Eddie Robertsson's RNG2Schtrn.xsl from the topologi site, in the Schema Validator freeware download. The other two files are part of the Schematron package you can get from http://xml.ascc.net/schematron/1.5/. If you want to use the schematron 1.6 beta, you can get that from topologi's site. In that case use skeleton1-6.xsl plus ISOprepro.xsl; change the <include> in schematron-basic.xsl to reference skeleton1-6 instead of 1-5.)
(3) Create a transformation scenario for .rng files named "Compile RNG-embedded Schematron", as follows: XSL URL=RNG2Schtrn.xsl; cascade stylesheet(1) is schematron-basic.xsl. (If you are using 1.6, then cascade stylesheet(1) is ISOprepro.xsl and cascade stylesheet(2) is the as-modified schematron-basic.xsl.) As the output, specify Save as = ${cfd}\${cfn}.sch
(4) Create a transformation scenario for .xml files named "Validate against Schematron", as follows: XSL URL=${cfd}\${cfn}.sch. For output, specify Save as=${cfd}\SchematronResult.txt
(5) Make sure your .rng with embedded schematron constraints uses the embedding syntax suggested by Eddie Robertsson in his recent xml.com article (http://www.xml.com/pub/a/2004/02/11/relaxtron.html)
(6) Put you rng schema with embedded schematron in the same folder as your instance documents to be validated.
(7) When you have the schema the way you like it, run the "Compile RNG-embedded Schematron" transformation scenario on it.
(8) Open your instance document in the editor. Do the structure validation in the usual way by selecting "Validate document".
(9) If the structure validation is okay, apply the schematron validation by invoking the transformation scenario "Valdiate against schematron". Result messages will be shown in the result pane below the editor pane, and will also be saved to the text file SchematronResult.txt in the same folder as the instance.
Try it, see if it works for you, and have fun. Let me know if problems.
John
(1) Create a folder ../oXygen4.0/Schematron.
(2) Into that folder, put the following files (see below for sources): RNG2Schtrn.xsl, skeleton1-5.xsl, schematron-basic.xsl. (You can get Eddie Robertsson's RNG2Schtrn.xsl from the topologi site, in the Schema Validator freeware download. The other two files are part of the Schematron package you can get from http://xml.ascc.net/schematron/1.5/. If you want to use the schematron 1.6 beta, you can get that from topologi's site. In that case use skeleton1-6.xsl plus ISOprepro.xsl; change the <include> in schematron-basic.xsl to reference skeleton1-6 instead of 1-5.)
(3) Create a transformation scenario for .rng files named "Compile RNG-embedded Schematron", as follows: XSL URL=RNG2Schtrn.xsl; cascade stylesheet(1) is schematron-basic.xsl. (If you are using 1.6, then cascade stylesheet(1) is ISOprepro.xsl and cascade stylesheet(2) is the as-modified schematron-basic.xsl.) As the output, specify Save as = ${cfd}\${cfn}.sch
(4) Create a transformation scenario for .xml files named "Validate against Schematron", as follows: XSL URL=${cfd}\${cfn}.sch. For output, specify Save as=${cfd}\SchematronResult.txt
(5) Make sure your .rng with embedded schematron constraints uses the embedding syntax suggested by Eddie Robertsson in his recent xml.com article (http://www.xml.com/pub/a/2004/02/11/relaxtron.html)
(6) Put you rng schema with embedded schematron in the same folder as your instance documents to be validated.
(7) When you have the schema the way you like it, run the "Compile RNG-embedded Schematron" transformation scenario on it.
(8) Open your instance document in the editor. Do the structure validation in the usual way by selecting "Validate document".
(9) If the structure validation is okay, apply the schematron validation by invoking the transformation scenario "Valdiate against schematron". Result messages will be shown in the result pane below the editor pane, and will also be saved to the text file SchematronResult.txt in the same folder as the instance.
Try it, see if it works for you, and have fun. Let me know if problems.
John
Post by stefan »
Support for Schematron has been added starting with version 5.1.
There is a new article on Documentation page (http://www.oxygenxml.com/documentation.html) about how to validate XML documents against Schematron.
There is a new article on Documentation page (http://www.oxygenxml.com/documentation.html) about how to validate XML documents against Schematron.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service