0
我有下面的XML得到XSL中重复值:对于标签,而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="A9">
<ProductType name="Swap">
</ProductType>
</acctTypGrp>
<acctTypGrp name="P">
<ProductType name="Swap">
</ProductType>
<ProductType name="FRA">
</ProductType>
</acctTypGrp>
</CM>
</reportNameGrp>
</Report>
和我已经写了XML转换的XSL,我已经写了下面
<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"
xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<!-- Main Template starts from here -->
<xsl:template match="/eur:Report">
<Eurexflows>
<xsl:call-template name="EurexreportNameGrp_block">
<xsl:with-param name="CMaccounttypeGroup" select="/eur:Report/eur:reportNameGrp/eur:CM/eur:acctTypGrp" />
</xsl:call-template>
</Eurexflows>
</xsl:template>
<!-- Main tempalte ends -->
<!-- sub templates starts -->
<xsl:template name="EurexreportNameGrp_block">
<xsl:param name="CMaccounttypeGroup" />
<xsl:for-each select="$CMaccounttypeGroup">
<EurexMessageObject>
<name>
<xsl:value-of select="@name" />
</name>
<ProductType>
<xsl:value-of select="$CMaccounttypeGroup/eur:ProductType/@name" />
<xsl:call-template name="generateData">
<xsl:with-param name="data" select="."/>
</xsl:call-template>
</ProductType>
</EurexMessageObject>
</xsl:for-each>
</xsl:template>
<xsl:template name="generateData">
<xsl:param name="data" />
<xsl:for-each select="$data/eur:ProductType">
<xsl:value-of select="./@name" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
的XSLT
但在XSL转换我收到的XML格式如下
<Eurexflows xmlns:eur="http://www.eurexchange.com/EurexIRSFullInventoryReport"
xmlns:fpml="http://www.fpml.org/FpML-5/confirmation">
<EurexMessageObject>
<name>A9</name>
<ProductType>SwapSwap</ProductType>
</EurexMessageObject>
<EurexMessageObject>
<name>P</name>
<ProductType>SwapSwapFRA</ProductType>
</EurexMessageObject>
</Eurexflows>
,但我想在此F XML ORMAT,
<Eurexflows xmlns:eur="http://www.eurexchange.com/EurexIRSFullInventoryReport"
xmlns:fpml="http://www.fpml.org/FpML-5/confirmation">
<EurexMessageObject>
<name>A9</name>
<ProductType>Swap</ProductType>
</EurexMessageObject>
<EurexMessageObject>
<name>P</name>
<ProductType>Swap</ProductType>
</EurexMessageObject>
<EurexMessageObject>
<name>P</name>
<ProductType>FRA</ProductType>
</EurexMessageObject>
</Eurexflows>
请avise如何改造后达到上述XML,也请告知我需要在XSL做必要的修改,特别是在我的generateData template..please提醒人们