Schematron problem
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 3
- Joined: Wed Sep 22, 2010 12:27 pm
Schematron problem
heyho,
have a XML like:
I use Schematron Validation and want to test, if DeviceTest-name attribute is unique. Means no other DeviceTest-name and no other parent-name should have the same string.
In schematron i wrote following:
This Schematron works for the test if another DeviceTest has the same name. But i can't figure out why the second test allways leads to an error. what's wrong here?
Greetz
m0ps
have a XML like:
Code: Select all
<DNgV>
<DeviceTest name="test1" type="Test" spec="harddisc">
<parent name="ptest1" type="Test" spec="pci">
<parent name="pptest1" type="Test" spec="pci">
...
In schematron i wrote following:
Code: Select all
<iso:pattern id="uniqueness.DInvDeviceTest">
<iso:rule context="//dnv:DeviceTest/@name">
<iso:assert test="count(//dnv:DeviceTest/@name[. = current()]) = 1">
Attribute is not unique in 'DeviceTest'
</iso:assert>
<iso:assert test="count(//dnv:parent/@name[. = current()]) = 1">
Attribute is not unique 'parent/DeviceTest'
</iso:assert>
</iso:rule>
</iso:pattern>
Greetz
m0ps
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Schematron problem
Post by sorin_ristache »
Hello,
Regards,
Sorin
For a unique DeviceTest/@name value you need to test in the second assert that there is no parent element with the same name attribute as the one matched by the context attribute:m0ps wrote:I use Schematron Validation and want to test, if DeviceTest-name attribute is unique. Means no other DeviceTest-name and no other parent-name should have the same string.
Code: Select all
<assert test="count(//dnv:parent/@name[. = current()]) = 0">
Attribute is not unique 'parent/DeviceTest'
</assert>
Sorin
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