在XSL中实现项目列表的例子

** 在XSL中实现项目列表的例子 **

** 孟宪会 **

Test.xml

 1<store>
 2<items>
 3<item>a</item>
 4<item>b</item>
 5<item>c</item>
 6</items>
 7<items>
 8<item>x</item>
 9<item>y</item>
10<item>z</item>
11</items>
12</store>

test.xsl

 1<xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform ">
 2<xsl:template match="items">
 3<h1>项目 : <xsl:number></xsl:number></h1>
 4<xsl:apply-templates></xsl:apply-templates>
 5</xsl:template>
 6<xsl:template match="item">
 7<h3>
 8<xsl:number count="items | item" format="[1.1] " level="multiple"></xsl:number>
 9<xsl:value-of select="."></xsl:value-of>
10</h3>
11</xsl:template>
12</xsl:stylesheet>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus