0
我有下面的XML:通过XSLT从块检索多个值在XML
<?xml version="1.0" encoding="UTF-8"?>
<Report xmlns:fpml="http://www.fpml.org/FpML-5/confirmation" xmlns="http://www.eurexchange.com/EurexIRSFullInventoryReport" name="CB202 Full Inventory Report">
<reportNameGrp>
<CM>
<acctTypGrp name="A4">
<ProductType name="Swap">
<currTypCod value="EUR">
</currTypCod>
<currTypCod value="GBP">
</currTypCod>
</ProductType>
</acctTypGrp>
<acctTypGrp name="A8">
<ProductType name="Swap">
<currTypCod value="CHF">
</currTypCod>
<currTypCod value="EUR">
</currTypCod>
<currTypCod value="GBP">
</currTypCod>
</ProductType>
</acctTypGrp>
</CM>
</reportNameGrp>
</Report>
为此,我用这个XSLT转换(基于https://stackoverflow.com/a/27458587/2564301):
<xsl:stylesheet version="1.0"
xmlns:fpml="http://www.fpml.org/FpML-5/confirmation" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:eur="http://www.eurexchange.com/EurexIRSFullInventoryReport">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes" omit-xml-declaration="yes" />
<xsl:template match="/eur:Report">
<Eurexflows>
<xsl:apply-templates
select="eur:reportNameGrp/eur:CM/eur:acctTypGrp/eur:ProductType" />
</Eurexflows>
</xsl:template>
<xsl:template match="eur:ProductType">
<EurexMessageObject>
<name>
<xsl:value-of select="../@name" />
</name>
<ProductType>
<xsl:value-of select="@name" />
</ProductType>
<value>
<xsl:value-of select="eur:currTypCod/@value" />
</value>
</EurexMessageObject>
</xsl:template>
</xsl:stylesheet>
现在我想我的输出XML如下:
<Eurexflows xmlns:eur="http://www.eurexchange.com/EurexIRSFullInventoryReport"
xmlns:fpml="http://www.fpml.org/FpML-5/confirmation">
<EurexMessageObject>
<name>A4</name>
<ProductType>Swap</ProductType>
<value>EUR,GBP</value>
</EurexMessageObject>
<EurexMessageObject>
<name>A8</name>
<ProductType>Swap</ProductType>
<value>CHF,EUR,GBP</value>
</EurexMessageObject>
</Eurexflows>
我需要在我的XSLT中对进行哪些更改标签?