RELAX NG with Embedded Schematron
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 116
- Joined: Fri Apr 08, 2011 7:58 am
RELAX NG with Embedded Schematron
Hi,
I'm trying to validate DITA topic by RELAX NG including Schematron.
But validating the scenario "Validate Relax NG with embedded Schematron" does not report any expected errors.
Could you take a look at this? I'm new to both RELAX NG and Schematron.
The steps are following:
1. Download the my DITA-OT plug-in.
https://onedrive.live.com/redir?resid=9 ... file%2czip
2. Copy "com.antennahouse.dita.dita13.doctypes" to dita-ot-2.2.3/plugins folder.
3. Run "ant -f integrator.xml" or "dita -install".
4. Open dita-ot-2.2.3/plugins/com.antennahouse.dita.dita13.doctypes/ah_dita13_doctypes.xpr by oXygen.
5. Open testdata/test-rng-task.xml. The relevant RNG file is doctypes/rng/technicalContent/rng/task.rng and base/rng/floatfigDomain.rng.
6. Validate test-rng-task.xml via "Validate Relax NG with embedded Schematron" schenario.
Regards,
Toshihiko Makita
I'm trying to validate DITA topic by RELAX NG including Schematron.
But validating the scenario "Validate Relax NG with embedded Schematron" does not report any expected errors.
Could you take a look at this? I'm new to both RELAX NG and Schematron.
Code: Select all
<define name="floatfig.element">
<element name="floatfig" dita:longName="Floating figure">
<a:documentation> The Floating Figure element (<floatfig>) represents
an figure to be rendered as a floating figure that fits left or right side. The contents are almost same as fig
without <floatfig-group>.
</a:documentation>
<sch:pattern name="Test constraints on the floatfig element">
<sch:rule context="floatfig">
<sch:assert test="(string(@float) ne 'none') and exists(child::floatfig-group)">floatfig-group should not appear if floatfig/@float ne 'none'</sch:assert>
<sch:assert test="true()">Schematron floatfig-group test</sch:assert>
</sch:rule>
</sch:pattern>
<ref name="floatfig.content"/>
<ref name="floatfig.attlist"/>
</element>
</define>
1. Download the my DITA-OT plug-in.
https://onedrive.live.com/redir?resid=9 ... file%2czip
2. Copy "com.antennahouse.dita.dita13.doctypes" to dita-ot-2.2.3/plugins folder.
3. Run "ant -f integrator.xml" or "dita -install".
4. Open dita-ot-2.2.3/plugins/com.antennahouse.dita.dita13.doctypes/ah_dita13_doctypes.xpr by oXygen.
5. Open testdata/test-rng-task.xml. The relevant RNG file is doctypes/rng/technicalContent/rng/task.rng and base/rng/floatfigDomain.rng.
6. Validate test-rng-task.xml via "Validate Relax NG with embedded Schematron" schenario.
Regards,
Toshihiko Makita
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: RELAX NG with Embedded Schematron
Hi Toshihiko,
Thanks for the samples.
This is a small bug in Oxygen, we use an XSLT stylesheet to gather all Schematron patterns from the Relax NG patterns and the XSLT stylesheet should also look in imports but in this case, if you look in the task.rng, it has a <div> in which the includes appear:
If you remove that <div> wrapper from around the includes, Oxygen will start applying the Schematron patterns you created on validation.
You have a small problem in your pattern, an sch:pattern does not have a @name attribute, it should have an @id attribute instead with an ID-type value.
We'll also fix this on our side, allow for looking for Schematron patterns also in RNGs included in <div> blocks.
Regards,
Radu
Thanks for the samples.
This is a small bug in Oxygen, we use an XSLT stylesheet to gather all Schematron patterns from the Relax NG patterns and the XSLT stylesheet should also look in imports but in this case, if you look in the task.rng, it has a <div> in which the includes appear:
Code: Select all
<div>
<a:documentation> MODULE INCLUSIONS </a:documentation>
.....
You have a small problem in your pattern, an sch:pattern does not have a @name attribute, it should have an @id attribute instead with an ID-type value.
We'll also fix this on our side, allow for looking for Schematron patterns also in RNGs included in <div> blocks.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 116
- Joined: Fri Apr 08, 2011 7:58 am
Re: RELAX NG with Embedded Schematron
Hi Radu,
Thank you for your quick reply.
By the way do you have any Schematron books or resources that can be used for DITA RELAX NG schemas?
I have searched Amazon or others but no effective resources cannot be found.
If you have any recommendations, please let me know.
Regards,
Toshihiko Makita
Thank you for your quick reply.
Sorry it's my mistake.You have a small problem in your pattern, an sch:pattern does not have a @name attribute, it should have an @id attribute instead with an ID-type value.
By the way do you have any Schematron books or resources that can be used for DITA RELAX NG schemas?
I have searched Amazon or others but no effective resources cannot be found.
If you have any recommendations, please let me know.
Regards,
Toshihiko Makita
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: RELAX NG with Embedded Schematron
Hi,
You could try this book from O'Reilly:
http://shop.oreilly.com/product/9780596527716.do
Ideally you would first develop the Schematron as a standalone file (because Oxygen offers better content completion and validation when doing this) and when it is final you can copy its patterns to the RNG or keep it as a separate Schematron file and refer to it directly from the DITA topic.
Regards,
Radu
You could try this book from O'Reilly:
http://shop.oreilly.com/product/9780596527716.do
Ideally you would first develop the Schematron as a standalone file (because Oxygen offers better content completion and validation when doing this) and when it is final you can copy its patterns to the RNG or keep it as a separate Schematron file and refer to it directly from the DITA topic.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 116
- Joined: Fri Apr 08, 2011 7:58 am
Re: RELAX NG with Embedded Schematron
Hi,
Thank you very much.
Regards,
Toshihiko Makita
I bought it!
Thank you very much.
Regards,
Toshihiko Makita
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
-
- Posts: 116
- Joined: Fri Apr 08, 2011 7:58 am
Re: RELAX NG with Embedded Schematron
I've confirmed that this bug is fixed in oXygen 18.0.This is a small bug in Oxygen, we use an XSLT stylesheet to gather all Schematron patterns from the Relax NG patterns and the XSLT stylesheet should also look in imports but in this case, if you look in the task.rng, it has a <div> in which the includes appear:
Thank you!
Regards,
Toshihiko Makita
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
-
- Posts: 116
- Joined: Fri Apr 08, 2011 7:58 am
Re: RELAX NG with Embedded Schematron
Hi Radu,
> I've confirmed that this bug is fixed in oXygen 18.0.
Sorry, it's my mistake.
oXygen 18.0 output the following error message:
[testdata/test-rng-task.xml line 29]
```
<stepsection fo:prop="font-style:bold;">
<floatfig float="right">
<title>Title of this floating figure</title>
<image href="http://www.antenna.co.jp/images/test-float.jpg"></image>
<dl>
<dlentry>
<dt>1</dt>
<dd>Description of the figure</dd>
</dlentry>
</dl>
</floatfig>
</stepsection>
```
But this authoring is not error because Schematron coding is as follows:
[com.antennahouse.dita.dita13.doctypes\doctypes\rng\base\rng\floatfigDomain.rng line 103]
```
<sch:pattern id="Test_constraints_on_the_floatfig_element">
<sch:rule context="floatfig">
<sch:assert test="(string(@float) ne 'none') and exists(child::floatfig-group)">floatfig-group should not appear if floatfig/@float ne 'none'</sch:assert>
</sch:rule>
</sch:pattern>
```
So the error should be occurred in the following authoring:
[testdata/test-rng-task.xml line 44]
```
<stepsection>
<floatfig float="left">
<floatfig-group float="left">
<title>Title of this floating figure</title>
<image href="http://www.antenna.co.jp/images/test-fl ... g"></image>
<dl>
<dlentry>
<dt>1</dt>
<dd>Description of the figure</dd>
</dlentry>
</dl>
</floatfig-group>
<floatfig-group float="right">
<title>Title of this floating figure</title>
<image href="http://www.antenna.co.jp/images/test-fl ... g"></image>
<dl>
<dlentry>
<dt>1</dt>
<dd>Description of the figure</dd>
</dlentry>
</dl>
</floatfig-group>
</floatfig>
</stepsection>
```
Can you take a look this again?
The all of the test data is in GitHub repository.
https://github.com/AntennaHouse/ah-dita/
The steps to reproduce are:
1. Download com.antennahouse.dita.dita13.doctypes.
2. Copy this folder dita-ot-2.2.3\plugins.
3. Run "ant -f integrator".
4. Open dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\ah_dita13_doctypes.xpr by oXygen.
5. Open dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\testdata\test-rng-task.xml.
6. Validate it by Ctrl + shift + V.
Regards,
> I've confirmed that this bug is fixed in oXygen 18.0.
Sorry, it's my mistake.
oXygen 18.0 output the following error message:
But the relevant error point is not accurate. This error message indicates that following authoring is error:System ID: D:\DITA-OT\dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\testdata\test-rng-task.xml
Main validation file: D:\DITA-OT\dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\testdata\test-rng-task.xml
Scenario name: Validate Relax NG schema with embedded Schematron - current file
Schema: D:\DITA-OT\dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\doctypes\rng\technicalContent\rng\task.rng
Engine name: ISO Schematron
Severity: error
Description: floatfig-group should not appear if floatfig/@float ne 'none'
Start location: 29:41
[testdata/test-rng-task.xml line 29]
```
<stepsection fo:prop="font-style:bold;">
<floatfig float="right">
<title>Title of this floating figure</title>
<image href="http://www.antenna.co.jp/images/test-float.jpg"></image>
<dl>
<dlentry>
<dt>1</dt>
<dd>Description of the figure</dd>
</dlentry>
</dl>
</floatfig>
</stepsection>
```
But this authoring is not error because Schematron coding is as follows:
[com.antennahouse.dita.dita13.doctypes\doctypes\rng\base\rng\floatfigDomain.rng line 103]
```
<sch:pattern id="Test_constraints_on_the_floatfig_element">
<sch:rule context="floatfig">
<sch:assert test="(string(@float) ne 'none') and exists(child::floatfig-group)">floatfig-group should not appear if floatfig/@float ne 'none'</sch:assert>
</sch:rule>
</sch:pattern>
```
So the error should be occurred in the following authoring:
[testdata/test-rng-task.xml line 44]
```
<stepsection>
<floatfig float="left">
<floatfig-group float="left">
<title>Title of this floating figure</title>
<image href="http://www.antenna.co.jp/images/test-fl ... g"></image>
<dl>
<dlentry>
<dt>1</dt>
<dd>Description of the figure</dd>
</dlentry>
</dl>
</floatfig-group>
<floatfig-group float="right">
<title>Title of this floating figure</title>
<image href="http://www.antenna.co.jp/images/test-fl ... g"></image>
<dl>
<dlentry>
<dt>1</dt>
<dd>Description of the figure</dd>
</dlentry>
</dl>
</floatfig-group>
</floatfig>
</stepsection>
```
Can you take a look this again?
The all of the test data is in GitHub repository.
https://github.com/AntennaHouse/ah-dita/
The steps to reproduce are:
1. Download com.antennahouse.dita.dita13.doctypes.
2. Copy this folder dita-ot-2.2.3\plugins.
3. Run "ant -f integrator".
4. Open dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\ah_dita13_doctypes.xpr by oXygen.
5. Open dita-ot-2.2.3\plugins\com.antennahouse.dita.dita13.doctypes\testdata\test-rng-task.xml.
6. Validate it by Ctrl + shift + V.
Regards,
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: RELAX NG with Embedded Schematron
Hello,
If you want the error to be displayed on the "floatfig" element when the @float attribute is not "none" and you do not have the "floatfig-group" as child then you need to change the assert.
Instead of <sch:assert test="(string(@float) ne 'none') and exists(child::floatfig-group)">
You should use: <sch:report test="(string(@float) ne 'none') and exists(child::floatfig-group)">
Best Regards,
Octavian
If you want the error to be displayed on the "floatfig" element when the @float attribute is not "none" and you do not have the "floatfig-group" as child then you need to change the assert.
Instead of <sch:assert test="(string(@float) ne 'none') and exists(child::floatfig-group)">
You should use: <sch:report test="(string(@float) ne 'none') and exists(child::floatfig-group)">
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 116
- Joined: Fri Apr 08, 2011 7:58 am
Re: RELAX NG with Embedded Schematron
Hi,
I misunderstood the role of "assert" and "report".
The former displays message when @test become false().
In contrast the latter displays message when @test become true().
This is my primary mistake.
Regards,
I misunderstood the role of "assert" and "report".
The former displays message when @test become false().
In contrast the latter displays message when @test become true().
This is my primary mistake.
Regards,
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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