我有一個嵌套列表,因此我希望標籤也可以嵌套。帶有數字標籤的嵌套列表
這是我的代碼:
<!-- For first list -->
<xsl:template name="list1-label">
<xsl:number format="1."/>
</xsl:template>
<!-- The nestled list -->
<xsl:template name="list2-label">
<xsl:number format="1.1."/>
</xsl:template>
在最後一個模板( 1.1)我想是相對父項,在這種情況下,第一個數字; 「3」。
下面是XML結構:
<list1>
<item>Test</item>
<item>Test</item>
<list2>
<item>Test</item>
<item>Test</item>
</list2>
<item>Test</item>
</list1>
這裏是輸出:
1. Test
2. Test
2.1. Test
2.2. Test
3. Test
提供樣品輸入。 –