0
XSL로 생성 된 HTML 문서에서 컨텐트 식별자 테이블을 생성하고 싶습니다. 에XSLT에서 html TOC 식별자를 생성하는 방법은 무엇입니까?
<?xml version="1.0" encoding="utf-8"?>
<h1>Heading 1</h1>
<h4>Heading 4</h4>
<h2>Heading 2</h2>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<h2>Heading 2</h2>
감사 :
<?xml version="1.0" encoding="utf-8"?>
<section>
<header>Heading 1</header>
<section>
<section>
<section>
<header>Heading 4</header>
</section>
</section>
</section>
<section>
<header>Heading 2</header>
<section>
<section>
<section>
<header>Heading 5</header>
</section>
</section>
</section>
<section>
<header>Heading 3</header>
</section>
</section>
<section>
<header>Heading 2</header>
</section>
</section>
가 이미 생성 할 수 있어요 :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="header">
<xsl:variable name="level" select="count(ancestor-or-self::section)"/>
<xsl:element name="h{$level}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
을하지만에 추가 TOC 식별자를 추가 할 필요가 다음과 같은 형식에서
have :
<?xml version="1.0" encoding="utf-8"?>
<a name="toc1"></a><h1>Heading 1</h1>
<a name="toc1_0_0_1"></a><h4>Heading 4</h4>
<a name="toc1_1"><h2>Heading 2</h2>
<a name="toc1_1_0_0_1"><h5>Heading 5</h5>
<a name="toc1_1_0_0_1_1"><h6>Heading 6</h6>
<a name="toc1_2"><h2>Heading 2</h2>
순수 XSLT 처리가 가능합니까?