匹配后如何合并 2 xml 个文件?
How can I combine 2 xml files after matching them?
第一个 XML 文件
<post>
<ParentProductID>0</ParentProductID>
<id>24109</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<Content><![CDATA[<b>Ürün Adı :</b><br> 1423 Saten Gecelik Sabahlık Takım]]></Content>
<SKU>4966522373865</SKU>
<ProductType>variable</ProductType>
<BedenGrup>L|M|S</BedenGrup>
<BoyutGrup></BoyutGrup>
<Marka></Marka>
<Cinsiyet></Cinsiyet>
<RenkGrup>Yeşil</RenkGrup>
<Stock>749</Stock>
<kategoriler><![CDATA[Kadın>İç Giyim>Gecelik]]></kategoriler>
<resim>https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423.jpeg|https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423-695.jpeg</resim>
<RegularPrice></RegularPrice>
<SalePrice></SalePrice>
</post>
第二个XML文件
<post>
<ParentProductID>24109</ParentProductID>
<id>24110</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<SKU>4966522373965</SKU>
<ProductType>variable</ProductType>
<Bedenrn>L</Bedenrn>
<Cinsiyetrn></Cinsiyetrn>
<Renkrn>Yeşil</Renkrn>
<RegularPrice>203.55</RegularPrice>
<SalePrice>150.07</SalePrice>
<Price>150.07</Price>
<Stock>250</Stock>
<ImageURL></ImageURL>
<rnkategorileri><![CDATA[Kadın>İç Giyim>Gecelik]]></rnkategorileri>
<rnetiketleri></rnetiketleri>
</post>
<post>
<ParentProductID>24109</ParentProductID>
<id>24111</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<SKU>4966522374065</SKU>
<ProductType>variable</ProductType>
<Bedenrn>M</Bedenrn>
<Cinsiyetrn></Cinsiyetrn>
<Renkrn>Yeşil</Renkrn>
<RegularPrice>203.55</RegularPrice>
<SalePrice>150.07</SalePrice>
<Price>150.07</Price>
<Stock>249</Stock>
<ImageURL></ImageURL>
<rnkategorileri><![CDATA[Kadın>İç Giyim>Gecelik]]></rnkategorileri>
<rnetiketleri></rnetiketleri>
</post>
我想要 XML 文件(将 ID 与父产品 ID 匹配)
<post>
<ParentProductID>0</ParentProductID>
<id>24109</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<Content><![CDATA[<b>Ürün Adı :</b><br> 1423 Saten Gecelik Sabahlık Takım]]></Content>
<SKU>4966522373865</SKU>
<Stock>749</Stock>
<kategoriler><![CDATA[Kadın>İç Giyim>Gecelik]]></kategoriler>
<resim1>https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423.jpeg</resim1><resim2>https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423-695.jpeg</resim2>
<RegularPrice>203.55</RegularPrice>
<SalePrice>150.07</SalePrice>
<varyants>
<varyant>
<bedenrn>M</bedenrn>
<Renkrn>Yeşil</Renkrn>
<Stock>249</Stock>
</varyant>
<varyant>
<bedenrn>L</bedenrn>
<Renkrn>Yeşil</Renkrn>
<Stock>249</Stock>
</varyant>
</varyants>
</post>
我尝试使用 OXYGEN XML 程序合并这两个 xml 文件,但未能成功。在互联网上研究后,我看到了 XLS 代码,但我对这个主题了解不多。我必须合并两个 XML 文件。感谢您的帮助。
XSLT 是完成这项工作的合适工具;花一点时间阅读 XSLT 是值得的,如果您遇到困难,您可以再次提出问题,说明您到底了解了多少。或者,如果您简化示例,使只有六个元素而不是 40 个左右,并且如果您解释合并规则是什么而不是让读者从您的示例中对规则进行逆向工程,那么有人可能会做好准备为您编写代码,然后您可以将其推断为您的实际问题。
请注意,XSLT 有多个版本。对于像这样的合并和分组问题,XSLT 2.0+ 更强大,但一些商品 XSLT 处理器只支持 XSLT 1.0。
第一个 XML 文件
<post>
<ParentProductID>0</ParentProductID>
<id>24109</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<Content><![CDATA[<b>Ürün Adı :</b><br> 1423 Saten Gecelik Sabahlık Takım]]></Content>
<SKU>4966522373865</SKU>
<ProductType>variable</ProductType>
<BedenGrup>L|M|S</BedenGrup>
<BoyutGrup></BoyutGrup>
<Marka></Marka>
<Cinsiyet></Cinsiyet>
<RenkGrup>Yeşil</RenkGrup>
<Stock>749</Stock>
<kategoriler><![CDATA[Kadın>İç Giyim>Gecelik]]></kategoriler>
<resim>https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423.jpeg|https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423-695.jpeg</resim>
<RegularPrice></RegularPrice>
<SalePrice></SalePrice>
</post>
第二个XML文件
<post>
<ParentProductID>24109</ParentProductID>
<id>24110</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<SKU>4966522373965</SKU>
<ProductType>variable</ProductType>
<Bedenrn>L</Bedenrn>
<Cinsiyetrn></Cinsiyetrn>
<Renkrn>Yeşil</Renkrn>
<RegularPrice>203.55</RegularPrice>
<SalePrice>150.07</SalePrice>
<Price>150.07</Price>
<Stock>250</Stock>
<ImageURL></ImageURL>
<rnkategorileri><![CDATA[Kadın>İç Giyim>Gecelik]]></rnkategorileri>
<rnetiketleri></rnetiketleri>
</post>
<post>
<ParentProductID>24109</ParentProductID>
<id>24111</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<SKU>4966522374065</SKU>
<ProductType>variable</ProductType>
<Bedenrn>M</Bedenrn>
<Cinsiyetrn></Cinsiyetrn>
<Renkrn>Yeşil</Renkrn>
<RegularPrice>203.55</RegularPrice>
<SalePrice>150.07</SalePrice>
<Price>150.07</Price>
<Stock>249</Stock>
<ImageURL></ImageURL>
<rnkategorileri><![CDATA[Kadın>İç Giyim>Gecelik]]></rnkategorileri>
<rnetiketleri></rnetiketleri>
</post>
我想要 XML 文件(将 ID 与父产品 ID 匹配)
<post>
<ParentProductID>0</ParentProductID>
<id>24109</id>
<Title>1423 Saten Gecelik Sabahlık Takım</Title>
<Content><![CDATA[<b>Ürün Adı :</b><br> 1423 Saten Gecelik Sabahlık Takım]]></Content>
<SKU>4966522373865</SKU>
<Stock>749</Stock>
<kategoriler><![CDATA[Kadın>İç Giyim>Gecelik]]></kategoriler>
<resim1>https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423.jpeg</resim1><resim2>https://gooxyz.com/wp-content/uploads/2021/03/sistina-1423-695.jpeg</resim2>
<RegularPrice>203.55</RegularPrice>
<SalePrice>150.07</SalePrice>
<varyants>
<varyant>
<bedenrn>M</bedenrn>
<Renkrn>Yeşil</Renkrn>
<Stock>249</Stock>
</varyant>
<varyant>
<bedenrn>L</bedenrn>
<Renkrn>Yeşil</Renkrn>
<Stock>249</Stock>
</varyant>
</varyants>
</post>
我尝试使用 OXYGEN XML 程序合并这两个 xml 文件,但未能成功。在互联网上研究后,我看到了 XLS 代码,但我对这个主题了解不多。我必须合并两个 XML 文件。感谢您的帮助。
XSLT 是完成这项工作的合适工具;花一点时间阅读 XSLT 是值得的,如果您遇到困难,您可以再次提出问题,说明您到底了解了多少。或者,如果您简化示例,使只有六个元素而不是 40 个左右,并且如果您解释合并规则是什么而不是让读者从您的示例中对规则进行逆向工程,那么有人可能会做好准备为您编写代码,然后您可以将其推断为您的实际问题。
请注意,XSLT 有多个版本。对于像这样的合并和分组问题,XSLT 2.0+ 更强大,但一些商品 XSLT 处理器只支持 XSLT 1.0。