8,906
社区成员
发帖
与我相关
我的任务
分享
<?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: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">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<xsl:text disable-output-escaping="yes" ><![CDATA[</tr><tr>]]></xsl:text>
<td>
<xsl:value-of select="name" />
</td>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of select="name" />
</td>
</xsl:otherwise>
</xsl:choose>
</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>
<?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>
<xsl:sort select="id" data-type="number" order="ascending" />