-2

我有以下 XML 文档。

<?xml version="1.0" encoding="UTF-8"?>
<chapter num="A">
    <title>
        <content-style font-style="bold">PART 1 GENERAL PRINCIPLES</content-style>
    </title>
    <section level="sect1">
        <title>
            <content-style font-style="bold">Chapter 2: PREVENTING COMMERCIAL DISPUTES</content-style>
        </title>
        <section level="sect2" number-type="manual" num="1.">
            <title>INTRODUCTION</title>
            <para>
                <phrase>2.001</phrase> With increasing competition in the business environment and the need to provide value for money to customers, most, if not all businesses, cannot afford to continuously be engaged in the dispute resolution arena as though it were a part of their core business. If all the disputes of a business entity have to be litigated or arbitrated to the bitter end, then this will become a substantial drain on its financial resources and big distraction for its management. Prolonged engagement in litigation and arbitration will undoubtedly have a detrimental effect on the business.</para>
            <para>
                <phrase>2.002</phrase> Preventing or minimising disputes requires businesses to know and understand the people they are dealing with and they will also need to ensure that the governing contracts are clearly and carefully drafted in order to safeguard the rights of both parties. The parties need to devote resources to train their employees to carefully and skilfully monitor the performance of the contracts and to maintain proper and adequate documentary records. This requires financial investment which some businesses are unable or reluctant to budget for. However, those businesses which have a keen awareness of the need to prevent or minimise disputes and are willing to provide the financial investment to attain this will find that, with a manageable preventative dispute resolution philosophy in place, this will, in the long term, be cost-effective and above all, create an environment that preserves close working relationships.</para>
        </section>
        <section level="sect2" number-type="manual" num="2.">
            <title>SELECTING A COUNTERPARTY</title>
            <para>
                <phrase>2.003</phrase> Commercial disputes inevitably arise between two or more parties under a commercial contract. The attributes of the counterparty with which one contracts will therefore have an impact on whether disputes can be prevented or, even if not, whether disputes can be resolved in an efficient and cost-effective manner, which will ultimately benefit both parties.</para>
            <para>
                <phrase>2.004</phrase> Consideration should be given to certain aspects of the counterparty before a contract is entered into. These attributes of a contracting party can impact on whether the relationship is likely to go smoothly or whether it is going to be &#x201C;dispute prone&#x201D;.</para>
            <section level="sect2" number-type="manual" num="(a)">
                <title>Financial power</title>
                <para>
                    <phrase>2.005</phrase> A contracting party which has financial substance is, in general, more likely to be willing to abide by their contractual obligations, simply because they are relatively easy targets of a lawsuit. On the other hand, where one contracts with an insubstantial or &#x201C;fly-by-night&#x201D; party, there is a genuine concern that, once the contract becomes unprofitable or if something goes wrong, there is a bigger propensity for disputes to arise as a result of the latter seeking to avoid its obligations.</para>
            </section>
            <section level="sect2" number-type="manual" num="(b)">
                <title>Market reputation</title>
                <para>
                    <phrase>2.006</phrase> A contracting party which has a market reputation it wishes to safeguard is likely to be more careful in the type of disputes it would be likely to get involved in. Listed companies or those which have a public image to preserve are, in general, more likely to avoid litigating every claim irrespective of size (unless such claims, if not litigated, are liable to open up floodgates) to minimise the bad publicity associated with being in the courts too often, or giving the impression to potential future contracting parties that they are litigious and difficult to deal with.</para>
            </section>
            <section level="sect2" number-type="manual" num="(c)">
                <title>Location and culture</title>
                <para>
                    <phrase>2.007</phrase> This is a sensitive topic and therefore there will be no specific references. However, a discussion of this type would be incomplete without acknowledging the fact that businesses or projects in certain parts of the world are more prone to conflicts or natural disasters and are more likely to end up in disputes than those in more &#x201C;peaceful&#x201D; parts of the world. Certain cultures tend also to be more litigious than others, and when contracting with parties of certain cultural backgrounds that focus less on mutual tolerance and co-operation, there will be more expectation of disputes.</para>
            </section>
            <section level="sect2" number-type="manual" num="(d)">
                <title>Focus/investment on risk prevention</title>
                <para>
                    <phrase>2.008</phrase> Certain contracting parties, more often seen in developed countries, have a better awareness of the law and the need to invest in risk prevention in order to minimise the probability of disputes. &#x201C;Investments&#x201D; in this regard include spending money to vet their business partners, including investigating their financial status and their market reputation, and allowing their legal department a sufficient budget to properly review draft contracts, assist with negotiations and to keep fully up-to-date with the latest legal developments.</para>
            </section>
        </section>
        <section level="sect2" number-type="manual" num="3.">
            <title>CONTRACT NEGOTIATION AND DRAFTING</title>
            <para>
                <phrase>2.009</phrase> There are two basic ways in which conflicts can be avoided without the need for the use of dispute resolution mechanisms. The first is the use of negotiation skills to negotiate a contract that affords the best terms and conditions possible, covering all or most foreseeable contingencies. Having clear and favourable provisions in a contract puts a party in a better position, especially when it is sought to resolve disputes at their source, without the need to revert to the dispute resolution mechanisms provided for in the contract. This, without a doubt, is the cheapest and most effective means of avoiding disputes or resolving possible disputes. The importance of contract negotiations should not be lightly dismissed.</para>
            <para>
                <phrase>2.010</phrase> The second is having a clearly drafted contract that is well thought out and planned and serves everyone&#x2019;s interests. Often a hastily drafted contract that is put together at the last minute results in uncertainty and vagueness of terms which could potentially create disputes. The inclusion of appropriate clauses (for example, clauses that cover force majeure or hardship) provide for changing conditions that may render the contract impossible to perform are of major importance. The drafting of such clauses is relatively technical in nature and requires the skills of a competent drafter of commercial contracts to ensure that they are manageable from a commercial standpoint.</para>
            <para>
                <phrase>2.011</phrase> An area to be aware of is the use of standard form contracts and adopting such forms within the existing framework of the contract. Although there are a variety of such standard form contracts available in the market place to be referred to, care must be taken, as these forms are only a guide to assist in the drafting of a contract that suits individual needs. Consulting legal counsel for advice is beneficial, especially when the contract touches on issues such as jurisdiction, which can often be difficult concepts for a lay person to understand.</para>
            <para>
                <phrase>2.012</phrase> The drafting of specialist contracts such as those in the construction, insurance, commodity and maritime fields requires a great deal of industry knowledge and experience to ensure that suitable wording is used to minimise the chances of disputes. However, regardless of the type of contract involved, there are certain provisions which are generic in nature, and the inclusion of which will generally (although not always) minimise the scope of the disputes between the parties, and are usually good to have. These provisions are often referred to as boilerplate clauses.</para>
            <para>
                <phrase>2.013</phrase> The importance of boilerplate clauses is often overlooked as the parties tend to focus on the commercial terms of the contract, such as the cost of the goods or services being provided. Failure to include appropriate boilerplate clauses may prevent a party from effectively enforcing its rights under the contract and offer an escape route to the defaulting party from its liabilities.</para>
            </section>
            </section>
            </chapter>

当我应用下面的xslt,节中的计数器(取为)时,每次找到一个带有num中数字的新节时,计数器将重置为1但如果num的值类似于(a),(b) .. 它正在继续,我想要的是,计数器永远不应该重置为 1。请帮助我实现这一点。

XSLT

<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">&lt;!DOCTYPE&gt;</xsl:text>
        <html>
            <head>
                <xsl:text disable-output-escaping="yes"><![CDATA[</meta>]]></xsl:text>
                <title>
                    <xsl:value-of select="substring-after(chapter/section/title,':')"/>
                </title>
                <link rel="stylesheet" href="er:#css" type="text/css"/><xsl:text disable-output-escaping="yes"><![CDATA[</link>]]></xsl:text>
            </head>
            <body>
                <xsl:apply-templates/>

                <section class="tr_footnotes">
                <hr/>
                    <xsl:apply-templates select="//footnote" mode="footnote"/>
                </section>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="chapter">
        <section class="tr_chapter">
            <div class="chapter">
            <xsl:variable name="l">
            <xsl:value-of select="substring(substring-after(section/title,' '),1,1)"/>
            </xsl:variable>
                <a name="AHK_CH_0{$l}"/>

                <div class="chapter-title">
                <xsl:variable name="titl">
                <xsl:value-of select="substring-after(section/title,':')"/>
                </xsl:variable>
                    <span class="chapter-num">
                        <xsl:value-of select="concat('Chapter ',$l,' ')"/>
                    </span>
                    <xsl:value-of select="$titl"/>

                </div>
    <div class="para align-center">
    <span class="font-style-italic">
    <xsl:value-of select="document('AHK-authors.xml')/chapters/chapter[@no=$l]"/>



    </span>
    </div>
    <div class="para align-right"><span class="format-smallcaps">Para</span>.</div>
                <div class="toc">
                    <div class="toc-part">
                        <table class="toc-div">
                            <tbody>
                                <tr>
                                    <td>
                                        <xsl:for-each select="current()/section/section|current()/section/section/section[contains(@num, '(')]|current()/section/section/section/section[contains(@num, '(')]">
                                            <xsl:call-template name="IndexItem">
                                            </xsl:call-template>
                                        </xsl:for-each>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <xsl:apply-templates select="section/section"/>
            </div>
        </section>
    </xsl:template>

    <xsl:template match="chapter/para">
        <div class="para align-right">
            <span class="format-smallcaps">Para</span>.
        </div>
        <xsl:apply-templates select="section"/>
    </xsl:template>

    <xsl:template name="fig" match="figure">
        <div class="figure">
        <div class="figure-title">
        <xsl:value-of select="current()/title"/>
        </div>
            <xsl:variable name="numb">
            <xsl:value-of select="substring-after(graphic/@href,'_')"/>
            </xsl:variable>
        <xsl:variable name="figCon">
            <xsl:value-of select="concat('er:#page-',$numb)"/>
        </xsl:variable>

        <img class="graphic" src="{$figCon}" alt=""/>
        </div>

    </xsl:template>


    <xsl:template name="IndexItem">
    <xsl:if test="not(contains(@level,'sect1'))"><!--changed fron @num to sect2-->
        <xsl:variable name="tocpg">
            <xsl:value-of select="concat('#P',descendant::para/phrase[1]/text())"/>
        </xsl:variable>
        <xsl:variable name="tocpgtag" select="translate($tocpg,'.', '-')"/>
        <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
        <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
        <xsl:variable name="text" select="current()/title/text()"/>
        <xsl:variable name="Brac">
            <xsl:choose>
                <xsl:when test="contains(current()/@num,'(')">
                    <xsl:value-of select="2"/>
                </xsl:when>
                <xsl:otherwise>
                                    <xsl:value-of select="1"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="d">
        <xsl:value-of select="concat('toc-item-',$ThisDocument//ntw:nums[@num=$Brac]/@word,'-level')"/>




        </xsl:variable>
        <table class="{$d}">
            <tbody>
                <tr>
                    <td class="toc-item-num">
                        <xsl:value-of select="@num"/>
                    </td>
                    <td class="toc-title">
                        <xsl:value-of select="concat(substring($text,1,1), translate(substring($text,2), $uppercase, $smallcase))"/>
                    </td>
                    <td class="toc-pg">
                        <a href="{$tocpgtag}">
                            <xsl:value-of select="descendant::para/phrase[1]/text()"/>
                        </a>
                    </td>
                </tr>
            </tbody>
        </table>
        </xsl:if>
    </xsl:template>
    <!-- Index Templates Complete -->
    <!-- Paragraph templates -->
    <xsl:template name="section" match="section">
        <!-- Variables-->
        <xsl:variable name="classname">
            <!--Get name attribute of current node -->
            <xsl:value-of select="concat('section-',parent::section/@level)"/>
        </xsl:variable>
        <xsl:variable name="chapternumber">
            <!-- Get num attribute of parent node -->
            <xsl:variable name="StrL">
            <xsl:value-of select="string-length(substring(substring-after(ancestor::chapter/section/title,'Chapter '),1,1))"/>
            </xsl:variable>
            <xsl:choose>
                <xsl:when test="$StrL>1">
                <xsl:value-of select="substring(substring-after(ancestor::chapter/section/title,'Chapter '),1,1)"/>
</xsl:when>
            <xsl:otherwise> 
<xsl:value-of select="concat('0',substring(substring-after(ancestor::chapter/section/title,'Chapter '),1,1))"/>

        </xsl:otherwise>    
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="sectnum">
            <xsl:number format="1"/>
        </xsl:variable>
        <!--Create a string variable by concat string method  -->
        <xsl:variable name="sectionname">
            <xsl:value-of select="concat('CH_',$chapternumber,'-SEC-', $sectnum)"/>
        </xsl:variable>
        <!-- Template Content  -->
            <div class="{$classname}">
            <a name="{$sectionname}"> </a>
            <div class="section-title">
                <span class="section-num">
                    <xsl:value-of select="@num"/>
                    <xsl:text> </xsl:text>
                </span>
                <xsl:apply-templates select="title"/>
            </div>
            <xsl:apply-templates select="child::node()[not(self::title)]"/>
        </div>

    </xsl:template>

    <xsl:template name="para" match="section/para">


                <div class="para">
                <xsl:apply-templates select="phrase"/>
                    <span class="phrase">
                        <xsl:value-of select="current()/phrase"/>
                    </span>
                    <xsl:choose>
            <xsl:when test="contains(current()/text(),'Chapter')">
            <xsl:variable name="x">
<xsl:value-of select="substring(substring-before(current()/text(),'Chapter'),1)"/>
</xsl:variable>

<xsl:variable name="y">
<xsl:value-of select="substring(substring-after(current()/text(),'Chapter'),4)"/>
</xsl:variable>

<xsl:variable name="z">
<xsl:value-of select="normalize-space(substring-before(substring-after(current()/text(),'Chapter'),'.'))"/>
</xsl:variable>

<xsl:variable name="h">
<xsl:value-of select="string-length($z)"/>
</xsl:variable>
<xsl:value-of select="$x"/>
<xsl:choose>
<xsl:when test="$h =1">

<a href="{concat('er:#AHK_CH_0',$z,'/AHK_CH_0',$z)}">
<xsl:value-of select="concat('Chapter',$z)"/>
</a>
</xsl:when>
<xsl:otherwise>
<a href="{concat('er:#AHK_CH_',$z,'/AHK_CH_',$z)}">
<xsl:value-of select="concat('Chapter',$z)"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$y "/>
<xsl:apply-templates select="footnote"/>
<xsl:apply-templates select="current()/phrase/text()"/>
    </xsl:when>
                    <xsl:otherwise>     
                    <xsl:apply-templates select="child::node()[not(self::phrase)]"/>
                    </xsl:otherwise>
                    </xsl:choose>

                </div>

    </xsl:template>

    <xsl:template name="phrase" match="phrase">
        <xsl:variable name="phrase">
            <xsl:value-of select="concat('P',text())"/>
        </xsl:variable>
        <xsl:variable name="newphrase" select="translate($phrase,'.','-')"/>
        <a>
            <xsl:attribute name="name"><xsl:value-of select="$newphrase"></xsl:value-of></xsl:attribute>
        </a>
    </xsl:template>




    <!-- Table Templates  -->
    <xsl:template name="table" match="table">
            <table style="frame-{current()/@frame} width-{translate(current()/@width,'%','')}">
    <xsl:apply-templates/>
    </table>
    </xsl:template>


<xsl:template match="tgroup">
        <colgroup>
            <xsl:apply-templates select=".//colspec"/>
</colgroup>
<xsl:apply-templates select="child::node()[not(self::colspec)]"/>


</xsl:template> 

    <xsl:template name="tbody" match="tgroup/tbody">
        <tbody>
            <xsl:for-each select="current()/row">
                <xsl:call-template name="row"/>
            </xsl:for-each>
        </tbody>
    </xsl:template>
    <xsl:template name="thead" match="tgroup/thead">

        <xsl:for-each select="current()/row"><thead>


            <tr>
                <xsl:for-each select="current()/entry">
                    <xsl:call-template name="headentry"/>
                </xsl:for-each>
</tr>
            </thead>
        </xsl:for-each>
    </xsl:template>
    <xsl:template name="colspec" match="colspec">

        <col class="colnum-{current()/@colnum} colname-{current()/@colname} colwidth-{translate(current()/@colwidth,'%','')}"/>
    </xsl:template>
    <xsl:template name="row" match="tbody/row">
        <tr>
            <xsl:for-each select="current()/entry">
                <xsl:call-template name="entry"/>
            </xsl:for-each>
        </tr>
    </xsl:template>
    <xsl:template name="entry" match="entry">
        <xsl:variable name="count">
            <xsl:value-of select="count(preceding-sibling::* | following-sibling::*)"/>
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="$count &lt; 2">
                <xsl:if test="position()=1">
                    <td>
                        <div class="para align-center">
                            <xsl:value-of select="para[position()=1]"/>
                        </div>
                    </td>
                    <td>
                        <div class="para">
                            <xsl:value-of select="following-sibling::node()"/>
                        </div>
                    </td>
                </xsl:if>
            </xsl:when>
            <xsl:when test="$count &gt; 1">
                <td>
                    <div class="para">

                        <xsl:apply-templates/>
                    </div>
                </td>
            </xsl:when>
        </xsl:choose>
    </xsl:template>
    <xsl:template name="headentry">
        <th>
            <xsl:if test="translate(current()/@namest,'col','') != translate(current()/@nameend,'col','')">
                <xsl:variable name="colspan">
                    <xsl:value-of select="translate(current()/@nameend,'col','') - translate(current()/@namest,'col','') + 1"/>
                </xsl:variable>
                <xsl:attribute name="colspan"><xsl:value-of select="$colspan"></xsl:value-of></xsl:attribute>
            </xsl:if>
            <div class="para">
                <xsl:value-of select="current()/para/text()"/>
                <xsl:apply-templates/>
            </div>
        </th>
    </xsl:template>
    <!-- Table Templates complete  -->


    <!--List templates -->

    <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">



        <div class="para">


                <span class="item-num">
                <xsl:if test="position()=1">
                    <xsl:value-of select="parent::item[1]/@num"/>
                    <xsl:text> </xsl:text>
                    </xsl:if>
                    </span>
                    <xsl:apply-templates/>



            </div>

    </xsl:template>
    <!--List templates Complete -->
    <!-- Paragraph templates Complete -->
    <!-- Footnote Templates-->
    <xsl:template match="footnote">
        <sup>
            <a>
                <xsl:attribute name="name"><xsl:text>f</xsl:text><xsl:number level="any" count="footnote" format="1"/></xsl:attribute>
                <xsl:attribute name="href"><xsl:text>#ftn.</xsl:text><xsl:number level="any" count="footnote" format="1"/></xsl:attribute>
                <xsl:attribute name="class"><xsl:text>tr_ftn</xsl:text></xsl:attribute>
                <xsl:number level="any" count="footnote" format="1"/>
            </a>
        </sup>
    </xsl:template>
    <xsl:template match="footnote" mode="footnote">
    <div class="tr_footnote">
        <div class="footnote">
        <sup>

                <a>
                    <xsl:attribute name="name"><xsl:text>ftn.</xsl:text><xsl:number level="any" count="footnote" format="1"/></xsl:attribute>
                    <xsl:attribute name="href"><xsl:text>#f</xsl:text><xsl:number level="any" count="footnote" format="1"/></xsl:attribute>
                    <xsl:attribute name="class"><xsl:text>tr_ftn</xsl:text></xsl:attribute>
                    <xsl:number level="any" count="footnote" format="1"/>
                </a>
            </sup>
            <div class="a">
                 <xsl:variable name="new">
                    <xsl:value-of select="current()"/>
                 </xsl:variable>
                 <xsl:variable name="new1">
                    <xsl:value-of select="substring(substring-after(current(),'paragraph'),2,5)"/>
                 </xsl:variable>
                 <xsl:variable name="roo">
                <xsl:value-of select="substring(//@num,2)"/>
                </xsl:variable>
                 <xsl:variable name="befTex">
                 <xsl:value-of select="substring-before(current(),'paragraph')"/>
                 </xsl:variable>
                 <xsl:variable name="before">
                 <xsl:value-of select="substring-before($new1,'.')"/>
                 </xsl:variable>
                 <xsl:variable name="after">
                 <xsl:value-of select="substring(substring-after($new1,'.'),1,3)"/>
                 </xsl:variable>
                 <xsl:variable name="centTex">
                <xsl:value-of select="substring(substring-after(current(),$after),1)"/>
                </xsl:variable>


                <xsl:variable name="pCon">
                <xsl:value-of select="concat('paragraph',' ',$before,'.',$after)"/>
                </xsl:variable>

                    <xsl:variable name="tes">
                <xsl:if test="contains($centTex,'chapter')">
                <xsl:value-of select="concat(' ',substring(substring-before($centTex,'chapter'),2))"/> 
                </xsl:if>
                </xsl:variable>
                <xsl:variable name="ChapNu">
                <xsl:value-of select="normalize-space(substring(substring-after(current(),'chapter'),1,2))"/>
                </xsl:variable>

                <xsl:variable name="ChapNuC">
                <xsl:value-of select="concat('er:#BVI_CH_0',$ChapNu,'/BVI_CH_0',$ChapNu)"/>
                </xsl:variable>
                <xsl:variable name="curSel">
                <xsl:value-of select="concat('#P',$before,'-',$after)"/>
                </xsl:variable>
                <xsl:variable name="ChapCon">
                <xsl:value-of select="concat('chapter',' ',substring(substring-after(current(),'chapter'),2,1))"/>
                </xsl:variable>

                <xsl:variable name="conc1">
                <xsl:value-of select="concat('er:#BVI_CH_0',$before,'/P',$before,'-',$after)"/>
                </xsl:variable>
                <xsl:value-of select="$befTex"/>
                <xsl:choose>
                <xsl:when test="contains(substring(substring-after($new,'paragraph'),1,3),'.')">
                <xsl:choose>

                <xsl:when test="$before = $roo">
                <a href="{$curSel}">
                <xsl:value-of select="$pCon"/>
                </a>
                </xsl:when>
                <xsl:otherwise>
                <a href="{$conc1}">
                    <xsl:value-of select="$pCon"/>
                </a>
                 </xsl:otherwise>
                </xsl:choose>
                <xsl:value-of select="$tes"/>
                <xsl:if test="contains($centTex,'chapter')">
                <a href="{$ChapNuC}">
                <xsl:value-of select="$ChapCon"/>
                </a>
                </xsl:if>
                <xsl:text>.</xsl:text>
                </xsl:when>

                <xsl:otherwise>
                <xsl:apply-templates/>
                </xsl:otherwise>
                </xsl:choose>
        </div>

        </div>
        </div>
    </xsl:template>
    <xsl:template match="footnote/para/uri">

            <xsl:variable name="url1">
                        <xsl:value-of select="translate(@href, '&#x003C;','')" />
            </xsl:variable>
            <xsl:variable name="url2">
                        <xsl:value-of select="translate($url1, '&#x003E;','')" />
            </xsl:variable>
            <a href="{$url2}">
                        <xsl:value-of select="." />
            </a>


    </xsl:template>
    <!-- Footnote Templates Complete -->
    <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>
    <!-- Namespace ntw-->
    <ntw:nums num="1" word="first"/>
    <ntw:nums num="2" word="second"/>
    <ntw:nums num="3" word="third"/>
    <ntw:nums num="4" word="forth"/>
    <ntw:nums num="5" word="fifth"/>
    <ntw:nums num="6" word="sixth"/>
    <ntw:nums num="7" word="seventh"/>
    <ntw:nums num="8" word="eighth"/>
    <ntw:nums num="9" word="nighth"/>
    <ntw:nums num="10" word="tenth"/>
    <!-- Namespace ntw ends -->
</xsl:stylesheet>

谢谢

4

1 回答 1

1

我在下面的代码中将计数器值用作 1,但我需要使用下面第二个块中给出的代码。

<xsl:variable name="sectionname">
 <xsl:value-of select="concat('CH_',$chapternumber,'-SEC-', $sectnum)"/>
 </xsl:variable> 


     <xsl:variable name="sectnum">
       <xsl:for-each select="Current()">
        <xsl:value-of select="count(preceding-sibling::*)"/>
       </xsl:for-each/>
    </xsl:variable>

这将给出价值。

于 2013-04-14T15:59:43.973 回答