Unique combination of element / attribute value in schematron
Posted: Mon Aug 07, 2017 7:41 pm
Hi,
I have a problem that seems to be quite common, but none of the examples I found, actually works for me. The rule needs to say that the combination of element and attribute value must beunique. There can be only one instance of a name per language, but the name can be the same for different languages:
The rule I created is the following:
But it always gives an error, so there must be something wrong with it.
Could you give me some suggestion?
Thank you,
Ewa
I have a problem that seems to be quite common, but none of the examples I found, actually works for me. The rule needs to say that the combination of element and attribute value must beunique. There can be only one instance of a name per language, but the name can be the same for different languages:
Code: Select all
<brandName>
<languageSpecificBrandName language='en'>name1</languageSpecificBrandName>
<languageSpecificBrandName language='fr'>name2</languageSpecificBrandName>
<languageSpecificBrandName language='de'>name2</languageSpecificBrandName>
</brandName>
Code: Select all
<sch:rule context="//brandName">
<sch:assert test="count(languageSpecificBrandName/@languageCode[.=current()])=1">Error</sch:assert>
</sch:rule>
Could you give me some suggestion?
Thank you,
Ewa