如何实现XML+XSL排序

来源:互联网 发布:电梯劝烟 知乎 编辑:程序博客网 时间:2024/05/01 10:52
<?xml version="1.0" encoding="gb2312" ?><xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"><xsl:output method="html" /><xsl:param name="queryParam" select="''" /><xsl:template match="/data"><table border="1"><tbody><tr><td><table width="400" border="1"><tbody><xsl:apply-templates select="port"><xsl:sort select="id" order="ascending" /></xsl:apply-templates></tbody></table></td></tr></tbody></table></xsl:template><xsl:template match="port"><tr><td align="left" width="50"><xsl:value-of select="name"/></td><td><xsl:value-of select="id"/></td></tr></xsl:template></xsl:stylesheet><?xml version="1.0" encoding="GB2312"?><?xml-stylesheet type="text/xsl" href="sss.xsl"?><data><port><id>2 </id><name>a </name></port><port><id>1 </id><name>b </name></port><port><id>3 </id><name>c </name></port></data>
原创粉丝点击