从将 Crystal 报告导出到 XML 的 xsl 中消除重复值

Eliminate duplicate values from xsl exporting Crystal report to XML

我有一份 crystal 报告,其中创建了以下 XML 用于导入。 (xml 编码新手)

<Text Name="Text8"><TextValue>ORI</TextValue>
</Text>
<Field Name="BBPCTITEM1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0BBP_CTITEM]}"><FormattedValue>10</FormattedValue><Value>10</Value></Field>
<Field Name="Measures00O2TFHPXGNUD31J0EUMEK7NMValue1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[Measures]-[00O2TFHPXGNUD31J0EUMEK7NM]-Value}"><FormattedValue>50,000.00</FormattedValue><Value>50000.00</Value></Field>
<Field Name="ZCFCONTR8ZCFCONTR1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[ZCF_CONTR]-[8ZCF_CONTR]}"><FormattedValue>40000715</FormattedValue><Value>40000715</Value></Field>
<Field Name="ZCFCONTRZCFCOSTDT2ZCFCONTRZCFCOSTDT1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[ZCF_CONTR__ZCFCOSTDT]-[2ZCF_CONTR__ZCFCOSTDT]}"><FormattedValue>01/01/2013</FormattedValue><Value>01/01/2013</Value></Field>
<Field Name="GTBSTKD1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0GT_BSTKD]}"><FormattedValue>#</FormattedValue><Value>#</Value></Field>
<Field Name="PLANT20PLANT1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0PLANT]-[20PLANT]}"><FormattedValue>5000</FormattedValue><Value>5000</Value></Field>
<Field Name="SOLDTO20SOLDTO1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0SOLD_TO]-[20SOLD_TO]}"><FormattedValue>EX0003</FormattedValue><Value>EX0003</Value></Field>
<Field Name="Measures00O2TFHPXGNUD31J0EUMEK7NMUnit1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[Measures]-[00O2TFHPXGNUD31J0EUMEK7NM]-Unit}"><FormattedValue>TON</FormattedValue><Value>TON</Value></Field>
<Field Name="MATERIAL20MATERIAL1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0MATERIAL]-[20MATERIAL]}"><FormattedValue>20001</FormattedValue><Value>20001</Value></Field>
<Field Name="SHIPTYPE10SHIPTYPE1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0SHIP_TYPE]-[10SHIP_TYPE]}"><FormattedValue>Vessel</FormattedValue><Value>Vessel</Value></Field>
<Field Name="INCOTERMS20INCOTERMS1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0INCOTERMS]-[20INCOTERMS]}"><FormattedValue>DEL</FormattedValue><Value>DEL</Value></Field>
<Field Name="SHIPTO20SHIPTO1" FieldName="{ZCFSDMC03_ZOTC_ZCFSDMC03_Q006.[0SHIP_TO]-[20SHIP_TO]}"><FormattedValue>206516</FormattedValue><Value>206516</Value></Field>
</Section>
</Details>

格式是 return 格式化值和值。我如何创建一个 xsl 模板 return 每个详细信息字段只有一个值?

我试过这个:

<xsl:template match="Details" >





    <xsl:for-each select="Details">
                <xsl:value-of select="Section/Field[@Name='ZCFCONTR8ZCFCONTR1']"/>
                <xsl:value-of select="Section/Field[@Name='BBPCTITEM1']"/>
                <xsl:value-of select="Section/Field[@Name='Measures00O2TFHPXGNUD31J0EUMEK7NM']"/>
                <xsl:value-of select="Section/Field[@Name='Measures00O2TFHPXGNUD31J0EUMEK7NMUnit1']"/>
                <xsl:value-of select="Section/Field[@Name='GTBSTKD1']"/>
                <xsl:value-of select="Section/Field[@Name='ZCFCONTRZCFCOSTDT1']"/>
                <xsl:value-of select="Section/Field[@Name='SOLDTO20SOLDTO1']"/>
                <xsl:value-of select="Section/Field[@Name='MATERIAL20MATERIAL1']"/>
                <xsl:value-of select="Section/Field[@Name='SHIPTYPE1']"/>
                <xsl:value-of select="Section/Field[@Name='INCOTERMS1']"/>
                <xsl:value-of select="Section/Field[@Name='PLANT20PLANT1']"/>
                <xsl:value-of select="Section/Field[@Name='SHIPTO20SHIPTO1']"/>


            </xsl:for-each>





</xsl:template>

但得到相同的结果。

在此先感谢您的帮助。

乔维奥雷克

尝试更改:

<xsl:value-of select="Section/Field[@Name='ZCFCONTR8ZCFCONTR1']"/>

至:

<xsl:value-of select="Section/Field[@Name='ZCFCONTR8ZCFCONTR1']/Value"/>

等等