在xslt中的同一节点内对记录进行排序 [英] Sorting records within the same node in xslt

查看:87
本文介绍了在xslt中的同一节点内对记录进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何基于index属性对该产品节点内的记录进行排序?
谁能在xslt中建议样式表?

 <?  xml    版本  ="    编码  ="  utf-8" ? <  产品 > 
  <  产品    ="   1" 索引  > 10"  >  <  /product  > 
  <  产品    ="   1" 索引  > 4"  >  <  /product  > 
  <  产品    ="   1" 索引  > 5"  >  <  /product  > 
  <  产品    ="   1" 索引   1" >  <  /product  > 
  <  产品    ="   1" 索引  > 3"  >  <  /product  > 
  <  产品    ="   1" 索引   2" >  <  /product  > 
<  /products  >                                                         pre> 

解决方案

您可以为此使用xsl:sort:
在这里查看更多信息和示例:
http://www.w3schools.com/xsl/el_sort.asp [<?xml version="1.0" encoding="utf-8" ?> <products> <product counter="1" index="10"></product> <product counter="1" index="4"></product> <product counter="1" index="5"></product> <product counter="1" index="1"></product> <product counter="1" index="3"></product> <product counter="1" index="2"></product> </products>

You can use xsl:sort for that:
Have a look here for more info and an example:
http://www.w3schools.com/xsl/el_sort.asp[^]

Good luck!


这篇关于在xslt中的同一节点内对记录进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆