我对 XSLT 转换非常陌生。我必须将 FPML 消息转换为更简单的 XML,这将删除 href 和 ID 类型的属性。(我的目标系统不理解这种类型的复杂 XML)
所以我的输入 XML 的一部分是这样的
<fpml:partyTradeInformation>
<fpml:partyReference href="Party1"/>
<fpml:accountReference href="Book1"/>
</fpml:partyTradeInformation>
and in same xml at bottom is the Party1 reference
<party id="Party1">
<fpml:partyId partyIdScheme="urn:abc:party-id:EMX-LOH">What is the partyName for PQR?</fpml:partyId>
<fpml:partyId partyIdScheme="urn:abc:party-id:PO_ID">PO19</fpml:partyId>
<fpml:partyId partyIdScheme="urn:abc:party-id:PO">PO19</fpml:partyId>
<fpml:partyId partyIdScheme="urn:abc:party-id:TREATS_ID">MNO</fpml:partyId>
<fpml:partyName>What is the partyName for PQR?</fpml:partyName>
</party>
Now first i have to transform my party1 to like below which I am able to do
<Party1>
<EMX-LOH>What is the partyName for ABC?</EMX-LOH>
<PO_ID>PO19</PO_ID><PO>PO19</PO>
<PO>PO19</PO>
<TREATS_ID>XYZ</TREATS_ID>
<partyName xmlns="">What is the partyName for ABC?</partyName>
</Party1>
But then i have to also replace my <fpml:partyReference href="Party1"/> like
<partyReference>
<party>
<Party1>
<EMX-LOH>What is the partyName for ABC?</EMX-LOH>
<PO_ID>PO19</PO_ID><PO>PO19</PO>
<PO>PO19</PO>
<TREATS_ID>XYZ</TREATS_ID>
<partyName xmlns="">What is the partyName for ABC?</partyName>
</Party1>
</party>
</partyReference >
如何在 href 实例中复制转换后的 Party1 元素集?此外,当我尝试对作为 XSLT 转换元素的 Party1 进行模板匹配时,解析器无法识别它。但是当我匹配元素方(这是原始方)时,解析器能够识别它。