2013-12-09 4 views
1

특정 xml 데이터 요소는 다음 조건 중 하나와 일치해야합니다.XPath : 중첩 된/복합 조건

1).이 속성은 @when 속성과 다른 것은 없습니다.

2.) 그것은 @ is-iso 속성을 가지며 그 밖의 것은 없습니다.

3) @ notBefore-iso 속성과 @ notAfter-iso 속성은 모두 있지만 @when도 @ when-iso 속성도 없습니다.

내가 schematron을 사용하여 테스트하려고하지만 일치하는 xpath 표현식을 만들지 못했습니다.

나는
<assert test="@when or @when-iso or (not(@when) and not(@when-iso) and @notBefore-iso and @notAfter-iso)"> 

을 시도하지만 작동하지 않습니다. 분명히 괄호 안의 내용은 단순히 무시됩니다. 그렇다면 어떻게 복잡한/중첩 된 조건식을 만들 수 있습니까?

답변

3

귀하의 경우에 작동합니다 예 :

<assert test="(@when and count(@*)=1) or (@when-iso and count(@*)=1) or (@notBefore-iso and @notAfter-iso and count(@*)=2)"/>