존재 여부에 관계없이 4 가지 질문을 작성하고 싶습니다. 지금까지는 3 가지 의견을 모두 검색하는 "NTE_NotesAndCommentsSegment_2/NTE_3_Comment"를 선택했습니다. 그러나 나는 그것이 질문 4 문제는 존재하지 않는 밖으로 쓰기 "질문 1" (문자열 값)XSLT 선택 항목에 "값"이 포함 된 경우
을 포함하는 경우 NTE_3_Comment
을 선택
에 문제가 있어요.
또한
SETID
의 올바른 번호를 출력해야합니다.
참고 : 질문에 실제로 숫자가 들어 있지 않습니다. ID를 사용하여 출력을 정렬하고 있습니다.
입력 XML :
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>1</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 1 ? Answer 1</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>1</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 2 ? Answer 2</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>1</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 3? Answer 3</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
예상 출력 XML : 나는 날이 솔루션에 내 접근 방식을 변경할 수 있습니다 제안을 찾고 있어요
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>1</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 1 ? Answer 1</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>2</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 2 ? Answer 2</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>3</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 3 ? Answer 3</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>4</NTE_1_SetIdNotesAndComments>
<NTE_2_SourceOfComment></NTE_2_SourceOfComment>
<NTE_3_Comment>Question 4 ? *Blank* </NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
. 미리 감사드립니다.
해결책 : @ O.R.Mapper 제안에 감사드립니다. 네 가지 질문 모두는 질문의 존재 여부와 상관없이 항상 작성됩니다. 소스에 질문이 없으면 답은 공백으로 표시됩니다.
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>1</NTE_1_SetIdNotesAndComments>
<NTE_3_Comment>Question 1 ?<xsl:value-of select="substring-after(//NTE_NotesAndCommentsSegment_2/NTE_3_Comment[starts-with(text(),'Question 1')],'?')"/>
</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>2</NTE_1_SetIdNotesAndComments>
<NTE_3_Comment>Question 2 ?<xsl:value-of select="substring-after(//NTE_NotesAndCommentsSegment_2/NTE_3_Comment[starts-with(text(),'Question 2')],'?')"/>
</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>3</NTE_1_SetIdNotesAndComments>
<NTE_3_Comment>Question 3 ?<xsl:value-of select="substring-after(//NTE_NotesAndCommentsSegment_2/NTE_3_Comment[starts-with(text(),'Question 3')],'?')"/>
</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
<NTE_NotesAndCommentsSegment_2>
<NTE_1_SetIdNotesAndComments>4</NTE_1_SetIdNotesAndComments>
<NTE_3_Comment>Question 4 ? <xsl:value-of select="substring-after(//NTE_NotesAndCommentsSegment_2/NTE_3_Comment[starts-with(text(),'Question 4')],'?')"/>
</NTE_3_Comment>
</NTE_NotesAndCommentsSegment_2>
당신은 "선택 NTE_3_Comment 무엇을 의미합니까 질문 1이 들어있는 곳은 어디입니까? " –
특정 문자열을 찾고 있습니다. 이 예제에서 나는 "질문 1"을 찾고있을 것입니다. –
이 정보는 BizTalk 맵과 관련되어 있으므로 원본 및 대상 스키마 (파트)를 추가하면 도움이 될 수 있습니다. 원본'NTE_1_SetIdNotesAndComments'는 실제로 항상 '1' 값을 갖고 있습니까? – Filburt