8,906
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="a.xsl"?>
<NewDataSet>
<Table>
<BoardId>1</BoardId>
<ParentID>-1</ParentID><BoardType>论坛一 </BoardType>
<CreateTime>2008-10-29T15:37:36.967+08:00 </CreateTime>
</Table>
<Table>
<BoardId>2</BoardId>
<ParentID>-1</ParentID><BoardType>论坛二 </BoardType>
<CreateTime>2008-10-29T15:37:36.98+08:00 </CreateTime>
</Table>
<Table>
<BoardId>3</BoardId>
<ParentID>1</ParentID><BoardType>测试产品论坛版面一 </BoardType>
<CreateTime>2008-10-29T15:37:36.98+08:00 </CreateTime>
</Table>
<Table>
<BoardId>5</BoardId>
<ParentID>1</ParentID><BoardType>测试产品论坛版面一 </BoardType>
<CreateTime>2008-10-29T15:37:36.98+08:00 </CreateTime>
</Table>
<Table>
<BoardId>4</BoardId>
<ParentID>2</ParentID>
<BoardType>测试版面一二 </BoardType>
<CreateTime>2008-10-29T15:37:36.98+08:00 </CreateTime>
</Table>
</NewDataSet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="/NewDataSet/Table[ParentID = '-1']">
<div style="border:1px solid red">
<div style="border:1px solid #0f0;padding-left:20px">
<xsl:value-of select="BoardType"/>
</div>
<xsl:call-template name="ch">
<xsl:with-param name="childBoard" select="BoardId"></xsl:with-param>
</xsl:call-template>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template name="ch">
<xsl:param name="childBoard"></xsl:param>
<xsl:for-each select="/NewDataSet/Table[ParentID = $childBoard]">
<div style="border:1px solid #0ff;padding-left:20px">
<xsl:value-of select="BoardType"/>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>