我试图对某些数字进行排序,但我遇到了一些问题。
例如:
...
<ToolStnNo>
10
</ToolStnNo>
...
<ToolStnNo>
12
</ToolStnNo>
...
<ToolStnNo>
3
</ToolStnNo>
...
<ToolStnNo>
11
</ToolStnNo>
...
<ToolStnNo>
2
</ToolStnNo>
...
<ToolStnNo>
4
</ToolStnNo>
...
<ToolStnNo>
1
</ToolStnNo>
...
<ToolStnNo>
6
</ToolStnNo>
...
<ToolStnNo>
5
</ToolStnNo>
...
<ToolStnNo>
8
</ToolStnNo>
...
<ToolStnNo>
7
</ToolStnNo>
...
我得到的结果表是:
10 --- > This 10 dont be here
1
2
3
4
5
6
7
8
11
12
13
右边是:
1
2
3
4
5
6
7
8
10 --- > This 10 should be here
11
12
13
<xsl:for-each select="MillSetupSheetAttr">
<xsl:for-each select="MillOperation">
<xsl:sort select="rep_Tool/@ToolStnNo" data-type="number"/>
<tr>
<td><font><xsl:value-of select="rep_Tool/@ToolStnNo"/></font></td>
</tr>
</xsl:for-each>
</xsl:for-each>
注意:xml文档相关部分的实际结构是:
<MillSetupSheetAttr>
<MillOperation>
<rep_Tool ToolStnNo="10" .../>
</MillOperation>
<MillOperation>
<rep_Tool ToolStnNo="1" .../>
</MillOperation>
<MillOperation>
<rep_Tool ToolStnNo="2" .../>
</MillOperation>
</MillSetupSheetAttr>