我已经创建了用于在 xml 下排序的 xslt。输出似乎没有根据 AccountNumber 进行排序。不知道我的错误是什么。
<TXLife xmlns="http://ACORD.org/Standards/Life/2">
<TXLifeRequest>
<FundCode>LTRT00</FundCode>
<AccountDescription>CWA – +U</AccountDescription>
<CurrencyTypeCode>840</CurrencyTypeCode>
<TransExeDate>2013-04-20</TransExeDate>
<AccountNumber>34142</AccountNumber>
<PaymentAmt>300.000000000</PaymentAmt>
<ReversalInd>0</ReversalInd>
</TXLifeRequest>
<TXLifeRequest>
<FundCode>LTRW00</FundCode>
<AccountDescription>CWA – +U</AccountDescription>
<CurrencyTypeCode>124</CurrencyTypeCode>
<TransExeDate>2013-04-20</TransExeDate>
<AccountNumber>14142</AccountNumber>
<PaymentAmt>250.000000000</PaymentAmt>
<ReversalInd>0</ReversalInd>
</TXLifeRequest>
</TXLife>
XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://ACORD.org/Standards/Life/2">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="@ns:*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="/ns:TXLife/ns:TXLifeRequest">
<xsl:sort select="ns:AccountNumber" order="ascending" data-type="number"/>
</xsl:for-each>
<xsl:apply-templates select="*"></xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
输出 :
<?xml version="1.0" encoding="utf-8"?>
<TXLife xmlns="http://ACORD.org/Standards/Life/2">
<TXLifeRequest>
<FundCode>LTRT00</FundCode>
<AccountDescription>CWA – +U</AccountDescription>
<CurrencyTypeCode>840</CurrencyTypeCode>
<TransExeDate>2013-04-20</TransExeDate>
<AccountNumber>34142</AccountNumber>
<PaymentAmt>300.000000000</PaymentAmt>
<ReversalInd>0</ReversalInd>
</TXLifeRequest>
<TXLifeRequest>
<FundCode>LTRW00</FundCode>
<AccountDescription>CWA – +U</AccountDescription>
<CurrencyTypeCode>124</CurrencyTypeCode>
<TransExeDate>2013-04-20</TransExeDate>
<AccountNumber>14142</AccountNumber>
<PaymentAmt>250.000000000</PaymentAmt>
<ReversalInd>0</ReversalInd>
</TXLifeRequest>
</TXLife>
不确定我在 xslt 中缺少什么。我尝试使用 data-type="text" 但输出仍未排序。