如何对当前xml进行排序以显示Html1,Html2 ..的内容,具体取决于它们的优先级1,precedence2 ..和xml是..
需要根据他们的优先级显示htmls ..请建议..
<params>
<param>
<name>html3</name>
<value>Sun Flowers</value>
</param>
<param>
<name>precedence2</name>
<value>15</value>
</param>
<param>
<name>html4</name>
<value>Vera Wang flowers</value>
</param>
<param>
<name>html2</name>
<value>Rose flowers</value>
</param>
<param>
<name>precedence3</name>
<value>20</value>
</param>
<param>
<name>precedence4</name>
<value>25</value>
</param>
<param>
<name>html1</name>
<value>Fairtrade Flowers</value>
</param>
<param>
<name>precedence1</name>
<value>10</value>
</param>
</params>
答案 0 :(得分:0)
您可以使用:
<xsl:sort select="substring-after(name, 'precedence')" data-type="number" order="ascending"/>
要将没有优先权的参数推到最后,请执行:
<xsl:sort select="starts-with(name, 'precedence')" data-type="text" order="descending"/>
<xsl:sort select="substring-after(name, 'precedence')" data-type="number" order="ascending"/>