0
我有兩個元素,我必須從中選擇一個獨特的同時循環使用鍵,但是變得空而不是一個。請參考下面如何從循環中生成唯一的ID
<xsl:key name="Keyunique" match="//schedules/test/Operatorvalue" use="//schedules/test/Operatorvalue/@Operatorvalue" />
<xsl:template name="Buildairline">
<xsl:for-each select="//schedules/test">
<xsl:for-each select="key('Keyunique', //schedules/test/Operatorvalue/@Operatorvalue)[1]">
<Row Action="ADD">
<xsl:value-of select="current()/Operatorvalue" />|<xsl:value-of select="current()/OperatorDesc" />|test|<xsl:value-of select="current()/operatordesc2" />
</Row>
</xsl:for-each>
</xsl:for-each>
</Rows>
</xsl:template>
下面是XML
<schedules>
<test>
<Operatorvalue>value1</Operatorvalue>
<OperatorDesc>valuedesc</OperatorDesc>
<OperatorDesc2>valuedesc2</OperatorDesc2>
</test>
<test>
<Operatorvalue>value1</Operatorvalue>
<OperatorDesc>valuedesc</OperatorDesc>
<OperatorDesc2>valuedesc2</OperatorDesc2>
</test>
<test>
<Operatorvalue>value2</Operatorvalue>
<OperatorDesc>valuedesc2</OperatorDesc>
<OperatorDesc2>valuedesc3</OperatorDesc2>
</test>
<schedules>
預計輸出
Row value1|valuedesc|valuedesc2
Row value2|valuedesc2|valuedesc3
請發佈您的預期輸出。 –