0
xslt를 배우고 있으므로 xml이 적합하지 않은 경우 변명하십시오. 여기 내 샘플 XML입니다.XSLT : 첫 번째 노드를 선택하고 그 텍스트를 바꾸기
<root>
<note>
<to>
<test>text</test>
<test1>ABC</test1>
</to>
<to>
<test>text</test>
<test1>content1</test1>
</to>
<to>
<test>text</test>
<test1>ABC</test1>
</to>
<to>
<test>text</test>
<test1>content1</test1>
</to>
</note>
<nodeabc>
<to>
<test>text</test>
<test1>ABC</test1>
</to>
</nodeabc>
</root>
"test1"노드가 text = content1 인 경우 첫 번째 노드 "test"의 텍스트를 변경하려고합니다.
예를 들어 을 입력해야합니다.
<root>
<note>
<to>
<test>text</test>
<test1>ABC</test1>
</to>
<to>
<test>text</test>
<test1>REPLACED</test1>
</to>
<to>
<test>text</test>
<test1>ABC</test1>
</to>
<to>
<test>text</test>
<test1>content1</test1>
</to>
</note>
<nodeabc>
<to>
<test>text</test>
<test1>ABC</test1>
</to>
</nodeabc>
</root>
나는 약간의 xslt를 시도했지만 아무 것도 작동하지 않는 것 같습니다. 해당 "test1"값이 content1 인 노드 "test"의 모든 텍스트 항목을 바꿉니다. XSLT
<xsl:template match="to/test[../test1='content1'][1]/text()">REPLACED
</xsl:template >
의
부분은 해결책이 될 수있는 안내하시기 바랍니다.
미리 감사드립니다.