2014-10-03 5 views
1

a.xml의 요소 중 하위 요소 (섹션)를 모두 xi : include가 포함 된 b.xml에 포함하려고합니다. 두 XML 파일 모두 유효한 docbook 5 파일입니다.xpointer element() scheme이있는 자식 요소 포함

a.xml

<chapter xml:id="TheChapter"> 
    <section> 
     <title>section 1</title> 
    </section> 
    <section> 
     <title>section 2</title> 
    </section> 
    <section> 
     <title>section 3</title> 
    </section> 
</chapter> 

b.xml

<section> 
     <xi:include href="a.xml" xpointer="element(/TheChapter/*)"/> 
</section> 

내가 오류를보고 XMLMind을 사용하고 있습니다.

cannot parse inclusion directive: cannot parse XPointer "element(/TheChapter/*)": "/TheChapter/*", XPointer element() scheme syntax error 

element() 스키마를 올바르게 사용하고 있지 않습니까?

답변

3

element() 구성표의 사용법이 올바르지 않습니다.

  • ID를 통해 요소를 식별하는 표현식의 첫 번째 부분은 슬래시로 시작하면 안됩니다.
  • 와일드 카드 (*)는 사용할 수 없습니다. "자식 순서"는 슬래시와 숫자 만 포함 할 수 있습니다.

    element(TheChapter/1) 
    

    는 그것은 TheChapter ID에 의해 식별되는 요소의 첫번째 아이를 선택한다 :

이 올바른 표현이다. 원하는 것은 element() 구성표를 사용하여 수행 할 수 없습니다.

xpointer(id('TheChapter')/*) 

xpointer() 방식은 W3C 추천 된 적이 (그것은 여전히 ​​초안의) 그리고 광범위하게 구현되지 않습니다


당신은 xpointer() 방식을 사용할 수 있습니다.

XMLmind XML 편집기는 xpointer()의 하위 집합을 지원합니다. 다음은 좀 더 자세한 내용이 담긴 우편 목록입니다 : http://permalink.gmane.org/gmane.editors.xxe.general/10220.

0

다음 사용은 잘 작동 :

<xi:include href="a.xml" xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('TheChapter')/db:section)"/> 

또는

<xi:include href="a.xml" xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('TheChapter')/*)"/>