研究一下下面的程序:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="ele">tt</xsl:param><xsl:template match="/"><script language="JavaScript"><xsl:comment><![CDATA[ var ci = 0;var bi = 0;var lastcolor = "";var colors = new Array("black", "blue", "red");var barcolors = new Array("#B0E0B0", "#B0B0F0", "#F0B0B0", "white");function GetColor() { return colors[ci++];}function GetBarColor() { lastcolor = barcolors[bi++]; return lastcolor;}function GetLastBarColor() { return lastcolor;}function GetCategory(node){ var sa = node.text; return sa;}var first = true;var nodename = "";function GetName(node){ nodename = node.getAttribute("type"); first = true; return nodename;}// This function exists to pad the chart with zeros to make sure the // lines do not left align themselves.var lastnode = "";function GetValue(node){ var result = first ? "0" : ""; var child = node.selectSingleNode(nodename); if (child) { if (child.text != "") { first = false; result = child.text; } } return result;}</xsl:script>]]></xsl:comment></script><xsl:for-each select="/List/Schema/ElementType/element"><br></br><xsl:eval>x.GetName(this)</xsl:eval><br> '$ele'<xsl:for-each select="/List/Data"><xsl:eval>GetValue(this)</xsl:eval>,</xsl:for-each></br></xsl:for-each></xsl:template></xsl:stylesheet>