用xsl实现自动编号 实现不了 怎么回事
<?xml version="1.0" encoding="UTF-8"?>
<xml-stylesheet type="text/xsl" href="li6-19.xsl">
<items>
<item>xsl:template</item>
<item>xsl:apply-template</item>
<item>xsl:element</item>
<item>xsl:attribute</item>
<item>xsl:value-of</item>
</items>
</xml-stylesheet>
xsl代码如下:
<xsl:template match="/">
<html>
<head>
<title>item list</title>
<style>
<body>{display:block;
background:#c0c0c0;
width:300px;}
</body>
</style>
</head>
<body>
<xsl:for-each select="items/item">
<xsl:number value="position()" format="1) "/>
<xsl:apply-templates/>
<br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
------解决方案--------------------
你写错了吧。
XML如下:
- XML code
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="a.xslt"?> <items> <item>xsl:template</item> <item>xsl:apply-template</item> <item>xsl:element</item> <item>xsl:attribute</item> <item>xsl:value-of</item> </items>