중간 요소는 어떻게 계산합니까? 이 문제에 대한 해결책은 this question과 관련이 있다고 생각합니다.xlst를 사용하여 중간 요소를 계산하십시오.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/root">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="row">
<xsl:choose>
<!--these are the indented ones-->
<xsl:when test="cell/@padding">
<xsl:number
value="count(preceding-sibling::row[child::cell[1][@padding]]) + 1"
format="a. "/>
</xsl:when>
<xsl:otherwise>
<xsl:number
value="count(preceding-sibling::row[child::cell[1][not(@padding)]]) + 1"
format="1. "/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="cell/text()"/>
</xsl:template>
</xsl:stylesheet>
나는이 결과를 받고 있어요 : 내가 좋아하는 것이 무엇
1. Title
a. Chapter
b. Chapter
c. Chapter
2. Title
d. Chapter
3. Title
e. Chapter
f. Chapter
4. Title
g. Chapter
가지고하는 것입니다 이런 변환을 적용,
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row>
<cell>Title</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
<cell>example additional cell</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
</row>
<row>
<cell>Title</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
</row>
<row>
<cell>Title</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
</row>
<row>
<cell>Title</cell>
</row>
<row>
<cell padding='true'>Chapter</cell>
</row>
</root>
그리고 : 나는 이런 식으로 뭔가를했다 가정하면 "하위"항목의 번호 매기기가 다시 시작됩니다. 나는 이전의 요소를 되돌아 보는 것을 멈추려면 축을 어떻게 바꾸는 지 알 수 없다.
"챕터"를 계산하려고했습니다. 그래서 :
1. Title
a. Chapter
b. Chapter
c. Chapter
2. Title
a. Chapter
3. Title
a. Chapter
b. Chapter
4. Title
a. Chapter
당신이 원하는 출력을 게시하고 "하위"항목이 입력에 무엇을 설명해주십시오. –