使用IE 6.0(Firefox还不完全支持XSLT可惜 : < )浏览fractal.xml,就能够看到漂亮的分形图。fractal.xml
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” xhref=”http://blogger.org.cn/blog/fractal.xsl” mce_href=”http://blogger.org.cn/blog/fractal.xsl”?>
<fractal depth=”6″ color=”orange” size=”3″/>
fractal.xsl
<?xml version=”1.0″?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform“>
<xsl:template match=”fractal”>
<xsl:param name=”depth” select=”@depth”/>
<table border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td>
<xsl:call-template name=”iterate”>
<xsl:with-param name=”depth” select=”$depth”/>
</xsl:call-template>
</td>
</tr>
<tr>
<td>
<xsl:call-template name=”iterate”>
<xsl:with-param name=”depth” select=”$depth”/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name=”iterate”>
<xsl:with-param name=”depth” select=”$depth”/>
</xsl:call-template>
</td>
</tr>
</table>
</xsl:template>
<xsl:template name=”iterate”>
<xsl:param name=”depth”/>
<xsl:choose>
<xsl:when test=”$depth > 0″>
<xsl:apply-templates select=”.”>
<xsl:with-param name=”depth” select=”$depth+(-1)”/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<table cellpadding=”0″ cellspacing=”0″ border=”0″ height=”{@size}” width=”http://blogger.org.cn/blog/{@size}”>
<tr><td bgcolor=”http://blogger.org.cn/blog/
{@color}”></td></tr>
</table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>