这是一个 XML 示例:
<OUT>
<Header>
<LineType>H</LineType>
<DocumentType>OUT</DocumentType>
<ClientCode>177</ClientCode>
<OrderNumber>SP03038181</OrderNumber>
<PayerINN>2636052865</PayerINN>
<TotalItems>3</TotalItems>
</Header>
<Line>
<LineType>I</LineType>
<Unit>PCE</Unit>
<OrderNumber>SP03038181</OrderNumber>
<Party>A289217</Party>
<field>20171031</field>
</Line>
<Line>
<LineType>I</LineType>
<OrderNumber>SP03038181</OrderNumber>
<Party>0911082</Party>
<field>20150731</field>
</Line>
<Header>
<LineType>H</LineType>
<DocumentType>OUT</DocumentType>
<ClientCode>177</ClientCode>
<OrderNumber>SP03038322</OrderNumber>
</Header>
<Line>
<LineType>I</LineType>
<OrderNumber>SP03038322</OrderNumber>
<Party>Z10208</Party>
<field>20141231</field>
</Line>
</OUT>
这是 xslt 代码:
<xsl:for-each select="*/Header">
<part>
<header></header>
<content>
<OUT>
<xsl:copy-of select="."/>
<xsl:copy-of select="../Line[OrderNumber = ./OrderNumber]"/>
</OUT>
</content>
</part>
</xsl:for-each>
问题是我无法Line
从当前节点复制具有相同订单号的所有Header
节点。
<xsl:copy-of select="../Line[OrderNumber = ./OrderNumber]"/>
不起作用,它会复制所有Line
节点。