我有下面的xml。
和下面的xslt。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntw="Number2Word.uri" exclude-result-prefixes="ntw">
<xsl:variable name="ThisDocument" select="document('')"/>
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
<html>
<head>
<title>
<xsl:value-of select="concat('Appendix ', substring-before(substring-after(part/chapter/title, ' '),' '))"></xsl:value-of>
</title>
<link rel="stylesheet" href="C:\Documents and Settings\u0138039\Desktop\XML COnversion\Book 5\Book-5(original)\assets\main.css" type="text/css"/>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="part/chapter/title">
<xsl:variable name="check">
<xsl:value-of select="string-length(substring-before(substring-after(.,' '),' '))"/>
</xsl:variable>
<section class="tr_chapter">
<div class="cha_app chapter">
<xsl:choose>
<xsl:when test="$check=1">
<a name="{concat('CHA_APP_0', substring-before(substring-after(., ' '),' '))}" class="tr_toc_anchor"> </a>
</xsl:when>
<xsl:otherwise>
<a name="{concat('CHA_APP_', substring-before(substring-after(., ' '),' '))}" class="tr_toc_anchor"> </a>
</xsl:otherwise>
</xsl:choose>
<div class="chapter-title">
<xsl:value-of select="concat('Appendix ', substring-before(substring-after(., ' '),' '))"></xsl:value-of>
</div>
<div class="chapter-subtitle">
<xsl:value-of select="substring-after(substring-after(.,' '),' ')"></xsl:value-of>
</div>
<div class="chapter-subtitle">
<xsl:value-of select="following-sibling::subtitle"/>
</div>
<xsl:apply-templates select="following-sibling::section"/>
</div>
</section>
</xsl:template>
<xsl:template match="section">
<div class="section-sect1">
<a name="{concat('APP_01-SEC-',substring-before(substring-after(./title,' '), ' '))}">
</a>
<div class="section-title">
<xsl:value-of select="concat('Chapter ',substring-before(substring-after(./title,' '),' '),' ')"/>
<xsl:text disable-output-escaping="yes"><br/></xsl:text>
<xsl:value-of select="substring-after(substring-after(./title,' '),' ')"/>
</div>
<xsl:apply-templates select="child::node()[not(self::title)]"/>
</div>
</xsl:template>
<xsl:template match="para">
<div class="para">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template name="orderedlist" match="orderedlist">
<ol class="eng-orderedlist orderedlist">
<xsl:apply-templates/>
</ol>
</xsl:template>
<xsl:template name="orderitem" match="item">
<li class="item">
<xsl:apply-templates/>
</li>
</xsl:template>
<xsl:template name="orderitempara" match="item/para">
<xsl:choose>
<xsl:when test="parent::item/@num">
<div class="para">
<xsl:choose>
<xsl:when test="position()=1">
<span class="item-num">
<xsl:if test="position()=1">
<xsl:value-of select="parent::item[1]/@num"/>
</xsl:if>
</span>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</div> </xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="content-style">
<xsl:choose>
<xsl:when test="@format='smallcaps'">
<xsl:value-of select="translate(normalize-space(.),'ABCDEFGHIJKLMNOPQRSTUVWXZ','abcdefghijklmnopqrstuvwxyz')"/>
</xsl:when>
<xsl:when test="@format='superscript'">
</xsl:when>
<xsl:otherwise>
<xsl:variable name="fontStyle">
<xsl:value-of select="concat('font-style-',@font-style)"/>
</xsl:variable>
<span class="{$fontStyle}">
<xsl:apply-templates/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
当我在我的 xml 上运行这个 xslt 时。有内容重复,虽然我没有使用任何循环。我真的很困惑,无法理解我哪里出错了。请告诉我。
您可以使用此文字搜索“为保障经济纠纷得到公正、及时仲裁,保护,制定本法”
谢谢