Schematron xpath fail only once
Questions about XML that are not covered by the other forums should go here.
Schematron xpath fail only once
Hello,
How to stop schematron to break the loop if the context fails the first time.
How to avoid looping the context across the xml so restrict displaying same error message multiple times(as we know if one fails rest will follow).
Thanks
How to stop schematron to break the loop if the context fails the first time.
How to avoid looping the context across the xml so restrict displaying same error message multiple times(as we know if one fails rest will follow).
Thanks
Re: Schematron xpath fail only once
Hello,
I don't know exactly your use case, maybe you can give me an example of an XML document and a Schematron rule, to understand better the situation.
I think you can add the rule on a parent context, and then change the assert to fail if one of the rules is not true.
Best Regards,
Octavian
I don't know exactly your use case, maybe you can give me an example of an XML document and a Schematron rule, to understand better the situation.
I think you can add the rule on a parent context, and then change the assert to fail if one of the rules is not true.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Schematron xpath fail only once
Hello,
Below is the example posted
<xml>
<topic id="1">
<test>10</test>
</topic>
<topic id="2">
<test>10</test>
</topic>
<topic id="3">
<test>10</test>
</topic>
</xml>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern>
<rule context="//topic/test">
<assert test=". > 5">
Value greater than 5
</assert>
</rule>
</pattern>
</schema>
Since the context will be looped thrice and will fail all the three times, can we stop looping through the entire xml if it fails the first time.
Hope this example helps to understand the context
Thanks
Below is the example posted
<xml>
<topic id="1">
<test>10</test>
</topic>
<topic id="2">
<test>10</test>
</topic>
<topic id="3">
<test>10</test>
</topic>
</xml>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern>
<rule context="//topic/test">
<assert test=". > 5">
Value greater than 5
</assert>
</rule>
</pattern>
</schema>
Since the context will be looped thrice and will fail all the three times, can we stop looping through the entire xml if it fails the first time.
Hope this example helps to understand the context
Thanks
Re: Schematron xpath fail only once
Hello,
I think the schema should be something like this:
Best Regards,
Octavian
I think the schema should be something like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern>
<rule context="xml">
<let name="test" value="topic/test[number(text()) > 5]"/>
<report test="$test" subject="$test[1]">
Value greater than 5
</report>
</rule>
</pattern>
</schema
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.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