제목에서 설명한 것처럼 XML 형제 요소에서 중복 된 특성 데이터를 확인하는 방법을 찾고 싶습니다.형제 요소에 여러 속성이있는 중복 된 데이터 확인 - Schematron
나는 비슷한 질문을 이미 알고있다. [여기] Check for duplicated attribute data in sibling elements - Schematron과 나는 그것을 시험해 보았다. 나를 위해 일하지 않았다.
제 상황은 여러 속성으로 확인하는 것입니다.
<root>
<test ZDX="a" XH="1" ps="sdf"/>
<test ZDX="a" XH="2" ps="dfg"/>
<test ZDX="a" XH="3" ps="hfgh"/>
<test ZDX="a" XH="2" ps="ertewr"/><!--same with the 2nd line-->
</root>
나는
ZDX
과
XH
속성과 고유 할
<test>
요소가 필요합니다. 테스트의 모든 형제 요소는
ZDX
및
XH
특성이 동시에 다른 테스트와 같을 수 없거나 SchemaTron 유효성 검사 오류가 발생하는 것을 만족해야합니다.
난이 방법을 시도
,
<rule context="/root/test">
<assert test="count(self::test) = count(self::test[not(@ZDX=preceding-sibling::test/@ZDX and @XH=preceding-sibling::test/@XH)])">
test is not unique
</assert>
</rule>
은 위의 상황에 잘 작동하지만 마지막 test
요소에
<root>
<test ZDX="a" XH="1" ps="sdf"/>
<test ZDX="a" XH="2" ps="dfg"/>
<test ZDX="a" XH="3" ps="hfgh"/>
<test ZDX="a" XH="4" ps="ertewr"/>
<test ZDX="b" XH="5" ps="ndmfj"/>
<test ZDX="b" XH="6" ps="yuoi"/>
<test ZDX="b" XH="4" ps="qwrew"/><!--conflict with the 4th line-->
</root>
아래 상황에 작동하지의 XH="4"
유효성 검사를 발사합니다 , 내가 마지막 줄을 바꾼다면 <test ZDX="b" XH="4" ps="qwrew"/>
에서 <test ZDX="b" XH="7" ps="qwrew"/>
으로 바뀌며, 유일하게 변하기 때문에 유효성 검사가 실행되지 않습니다.
그래서, 어떻게 하나의 Schematron Test 문구에서 ZDX
과 XH
을 모두 확인할 수 있습니까?