2017-11-13 9 views
0

"book"(루트) 요소의 속성 값 "id"를 확인해야합니다.스키마 별 속성 값 확인 XSD

"id"값이 세 개의 0으로 끝나면 (id = "****** - 000") 다른 속성 "book-type"은 "book"이어야하며 그렇지 않으면 "chapter"이어야합니다.

<book id="201019894-000" book-type="book" xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
<book-meta> 
<title-group>... 

은 스키마 (XSD)에서 위의 조건을 확인할 수있는 가능성이 있나요 :

여기 내 XML의 모습입니다.

나를 인도 해주십시오 ..

감사

답변

0

는 XSD 1.0에서 수행 할 수 없습니다.

는 주장과 같은

<xs:assert test="if (ends-with(@id, '-000') then @book-type='book' else @book-type='chapter'"/> 
하여이 작업을 수행 할 수 XSD 1.1