Schematron issue validating conrefs
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 11
- Joined: Mon Mar 03, 2014 5:11 pm
- Location: Shawnee, KS
Schematron issue validating conrefs
We are currently validating note types, among other things, in our .dita files through Oxygen (v14.2). And all seems to work well, except when trying to validate notes that are conrefs. The validation appears to ignore or not check the conrefs.
Is there something I need to add to my existing validation for conrefs?
Currently we are using:
Any help would be much appreciated!
Thanks,
Is there something I need to add to my existing validation for conrefs?
Currently we are using:
Code: Select all
<pattern id="note">
<rule context="*[contains(@class, ' topic/note ')]">
<assert test="descendant::*[contains(@class, ' topic/note ')][@type='note' or @type='tip' or @type='caution']" role="warning">
Note element type must be note, tip, or caution.
</assert>
</rule>
</pattern>
Thanks,
Bryan
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: Schematron issue validating conrefs
Hi Bryan
not sure about your problem with conref (from my experience, schematron validation applies to conrefs as well). But assuming you simply want to check that the attribute of a note element contains one of the valid values, your code is wrong: It checks for the existence of an additional note element as child of the original one.
This code should work (It does for me with Oxygen 16.0):
And the xpath could also be simplified to
Regards,
Patrik
not sure about your problem with conref (from my experience, schematron validation applies to conrefs as well). But assuming you simply want to check that the attribute of a note element contains one of the valid values, your code is wrong: It checks for the existence of an additional note element as child of the original one.
This code should work (It does for me with Oxygen 16.0):
Code: Select all
<pattern id="note">
<rule context="*[contains(@class, ' topic/note ')]">
<assert test="@type='note' or @type='tip' or @type='caution'" role="warning">
Note element type must be note, tip, or caution.
</assert>
</rule>
</pattern>
Code: Select all
<assert test="@type = ('note', 'tip', 'caution')" role="warning">
Patrik
-
- Posts: 9449
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron issue validating conrefs
Hi Bryan, Patrik,
Schematron validation is applied on the DITA/XML document as it is, without expanding the conrefs before the validation.
So you can either skip for validation elements which have the conref attribute set on them or you could try to resolve the conref yourself, to load the target document as a nodeset using the Schematron function document and to locate in it the element with the proper ID specified, then to validate that element's content. So it's a bit of work to do. There is a Schematron stylesheet in:
OXYGEN_INSTALL_DIR\frameworks\dita\resources\dita-1.2-for-xslt2-links-checker.sch
which tries to check if an xref points to a valid element ID, that could be a starting point for you.
Regards,
Radu
Schematron validation is applied on the DITA/XML document as it is, without expanding the conrefs before the validation.
So you can either skip for validation elements which have the conref attribute set on them or you could try to resolve the conref yourself, to load the target document as a nodeset using the Schematron function document and to locate in it the element with the proper ID specified, then to validate that element's content. So it's a bit of work to do. There is a Schematron stylesheet in:
OXYGEN_INSTALL_DIR\frameworks\dita\resources\dita-1.2-for-xslt2-links-checker.sch
which tries to check if an xref points to a valid element ID, that could be a starting point for you.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: Schematron issue validating conrefs
I checked again and can confirm that for me the schematron validation doesn't apply to (standard-)conrefs as well. We just have a special use-case for a "copy-conref" where the referenced content is (automatically) copied into the document. And there - of course - the content is validated as well.
Regards,
Patrik
Regards,
Patrik
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