当前位置: 代码迷 >> XML/SOAP >> xsl实现自动编号的有关问题 急 !
  详细解决方案

xsl实现自动编号的有关问题 急 !

热度:317   发布时间:2012-03-15 11:50:39.0
xsl实现自动编号的问题 急 在线等!!
用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> 
  相关解决方案