【发布时间】:2020-05-16 09:02:53
【问题描述】:
请问可以用 XSLT 1.0 实现吗?
示例输入是
<Variable_Attributes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<Row>
<MATNR>3006921_CAR</MATNR>
<REFERENCE>
<uom>EA</uom>
<product_id>3006921_EA</product_id>
<quantity>6</quantity>
</REFERENCE>
</Row>
<Row>
<MATNR>3006921_CAR</MATNR>
<REFERENCE>
<uom>CAR</uom>
<product_id>3006921_EA</product_id>
<quantity>6</quantity>
</REFERENCE>
</Row>
</Variable_Attributes>
我想删除 <uom> 标签,并通过连接已删除 uom 标签的值来重命名父标签 <REFERENCE>。
所以上面会变成:
<Variable_Attributes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<Row>
<MATNR>3006921_CAR</MATNR>
<REFERENCE_EA>
<product_id>3006921_EA</product_id>
<quantity>6</quantity>
</REFERENCE_EA>
</Row>
<Row>
<MATNR>3006921_CAR</MATNR>
<REFERENCE_CAR>
<product_id>3006921_EA</product_id>
<quantity>6</quantity>
</REFERENCE_CAR>
</Row>
</Variable_Attributes>
最好的祝福
列侬
【问题讨论】: