我对XSLT转换很陌生。 (我的目标系统不理解这种复杂的XML)XSLT转换通过复制另一个元素来替换href元素的一部分
因此,我的输入的一部分XML(我的目标系统不理解这种类型的复杂的XML)我不得不将一个FPML消息转换为更简单的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元素集? 另外,当我尝试为Party1这是XSLT转换元素做模板匹配时,解析器无法识别它。但是,当我匹配元素派对(这是原始派对)时,解析器能够识别它。
你的问题不清楚。请发布[mcve],包括XML,当前的XSLT和期望的输出。 - 我想你想学习如何使用[key](https://www.w3.org/TR/xslt/#key)。 –