1. testxsl.xml:<?xml-stylesheet type="text/xsl" href="testxsl.xsl" ?>
<document>
<resume>
<Name>网</Name>
</resume>
<resume>
<Name>三</Name>
</resume>
<resume>
<Name>七</Name>
</resume>
<resume>
<Name>啊</Name>
</resume>
</document>
2. testxsl.xsl:<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template><xsl:template match="document">
<xsl:variable name="cols" select="7" />
<table border="1">
<xsl:for-each select="resume[(position() - 1) mod $cols = 0]">
<tr>
<td><xsl:value-of select="Name" /></td>
<xsl:for-each select="following-sibling::resume[position() < $cols ]">
<td><xsl:value-of select="Name" /></td>
</xsl:for-each> <!--ignore the following if you don't understand it begin -->
<xsl:variable name="sibcount" select="count(following-sibling::resume)" />
<xsl:if test="$sibcount < $cols - 1">
<xsl:for-each select="(document('')//namespace::*)[position() < $cols - $sibcount ]">
<td> </td>
</xsl:for-each>
</xsl:if>
<!--end -->
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
<document>
<resume>
<Name>网</Name>
</resume>
<resume>
<Name>三</Name>
</resume>
<resume>
<Name>七</Name>
</resume>
<resume>
<Name>啊</Name>
</resume>
</document>
2. testxsl.xsl:<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template><xsl:template match="document">
<xsl:variable name="cols" select="7" />
<table border="1">
<xsl:for-each select="resume[(position() - 1) mod $cols = 0]">
<tr>
<td><xsl:value-of select="Name" /></td>
<xsl:for-each select="following-sibling::resume[position() < $cols ]">
<td><xsl:value-of select="Name" /></td>
</xsl:for-each> <!--ignore the following if you don't understand it begin -->
<xsl:variable name="sibcount" select="count(following-sibling::resume)" />
<xsl:if test="$sibcount < $cols - 1">
<xsl:for-each select="(document('')//namespace::*)[position() < $cols - $sibcount ]">
<td> </td>
</xsl:for-each>
</xsl:if>
<!--end -->
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货