[XSLT] 遍历所有节点的XSLT
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" version="2.0"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <table border="1" cellspacing="0" height="100%" width="100%"> <xsl:for-each select="./*"> <tr> <th class="k-header" style="width:80"> <xsl:value-of select="local-name()"/> </th> <td> <xsl:call-template name="SubItem"/> </td> </tr> </xsl:for-each> </table> </xsl:template> <xsl:template name="SubItem"> <xsl:if test="count(./*)=0"> <xsl:value-of select="."/> </xsl:if> <xsl:if test="count(./*)>0"> <table border="1" cellspacing="0" height="100%" width="100%"> <xsl:for-each select="./*"> <tr> <th class="k-header" style="width:80"> <xsl:value-of select="local-name()"/> </th> <td> <xsl:call-template name="SubItem"/> </td> </tr> </xsl:for-each> </table> </xsl:if> </xsl:template> </xsl:stylesheet>