-- 作者:jianfeng008cn
-- 发布时间:4/27/2006 5:43:00 PM
-- [求助]本人要使用xsl格式化输出xml到html 跪求帮助 急!!!
我想用xsl把生成的xml文件格式化输出到浏览器,但是目前xsl写好以后,xml一引用该xsl就什么也显示不了了,时间紧迫,希望高手 指点指点 非常感谢! 油箱shenjf@zjcds.com -----------xml内容文件如下 <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="testXML.xsl"?> <Menu name="jcsj"> <Params> <report> <name>reportName</name> <property name="ParamFieldName1" type="string/int/timestamp" view="combox/list/input..." dsType="1"> <sql>select code,describe from table1</sql> <map code="code1" value="value1"></map> <map code="code2" value="value2"></map> <map code="code3" value="value3"></map> </property> </report> <cube> <name>cubeName</name> <property name="text" type="string" view="text" dsType="1"> <sql>select code,describe from table1</sql> <map code="code1" value="value1"></map> <map code="code2" value="value2"></map> <map code="code3" value="value3"></map> </property> </cube> </Params> </Menu> -----------xsl内容文件如下 <?xml version="1.0" encoding="GB2312"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="document"> <html><body><TABLE border="1" cellspacing="0" color="#FF33FF"><TH>参数名称</TH><TH>请输入参数的值</TH> <xsl:apply-templates select="menu_cube_property"/></TABLE></body></html> </xsl:template> <xsl:template match="menu_cube_property"> <xsl:for-each select="Menu/Params/cube"> <tr> <td><xsl:value-of select="name"/></td> <xsl:for-each select="Menu/Params/cube/property"> <xsl:choose> <xsl:when match=".[view='text']"><TD><xsl:apply-templates select="text"/></TD></xsl:when> <xsl:when match=".[view='select']"><TD><xsl:apply-templates select="select"/></TD></xsl:when> <xsl:when match=".[view='radio']"><TD><xsl:apply-templates select="radio"/></TD></xsl:when> <xsl:when match=".[view='checkbox']"><TD><xsl:apply-templates select="checkbox"/></TD></xsl:when> <xsl:otherwise><td></td></xsl:otherwise> </xsl:choose> </xsl:for-each> </tr> </xsl:for-each> </xsl:template> <xsl:template match="text"></xsl:template> <xsl:template match="select"><SELECT NAME="select" multiple="True"><option value="x">sina</option><option value="y">yahoo</option></SELECT></xsl:template> <xsl:template match="radio"></xsl:template> <xsl:template match="checkbox"></xsl:template> </xsl:stylesheet>
|