Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xslt 模板调用正在进入另一个模板_Xslt - Fatal编程技术网

Xslt 模板调用正在进入另一个模板

Xslt 模板调用正在进入另一个模板,xslt,Xslt,我有以下XML数据 <para><content-style font-style="bold">1/4 4.—</content-style>(1) In these Rules, unless the context otherwise requires, the following expressions have the meanings hereby respectively assigned to them, namely: <ord

我有以下XML数据

    <para><content-style font-style="bold">1/4 4.—</content-style>(1) In these Rules, unless the context otherwise requires, the following expressions have the meanings hereby respectively assigned to them, namely:
<orderedlist type="manual">
<item><para>“attend” includes the appearance by any person using electronic, mechanical or other means permitted by the Court;</para></item>
<item><para>“bailiff” includes the registrar, any clerk or other officer of the Court charged with the duties of a bailiff in the Subordinate Courts;</para></item>
<item><para>“Civil Procedure Convention” means the conventions set out in Appendix C to these Rules and includes any convention, treaty or agreement of any description or any provision thereof between different States relating to civil procedure in the court;</para></item>
<item><para>“folio” means 100 words, each figure being counted as one word;</para></item>
<item><para>“Form” means a form set out in Appendix A to these Rules, and a form so numbered in the Appendix;</para></item>
<item><para>“Judge” means a judge of the High Court or District Judge and includes, in cases where he is empowered to act, a Magistrate or the Registrar, as the case may require;</para></item>
<item><para>“officer” means an officer of the Supreme Court or Subordinate Courts;</para></item>
<item><para>“originating process” means a writ of summons or an originating summons;</para></item>
<item><para>“originating summons” means every summons for the commencement of proceedings other than a writ of summons;</para></item>
<item><para>“pleading” does not include an originating summons or preliminary act;</para></item>
<item><para>“receiver” includes a manager or consignee;</para></item>
<item><para>“Registry” means the Registry of the Supreme Court or the Registry of the Subordinate Courts, as the case may be, and references to the Registrar shall be construed accordingly;</para></item>
<item><para>“scheduled territories” has the meaning assigned to it by the Exchange Control Act (Chapter 99);</para></item>
<item><para>“Sheriff” includes a bailiff of the Subordinate Courts;</para></item>
<item><para>“sign”, in relation to the signing of documents by the Registrar, includes the affixing of a facsimile signature;</para></item>
<item><para>“solicitor” has the same meaning as in the Legal Profession Act (Chapter 161);</para></item>
<item><para>“summons” means every summons in a pending cause or matter.</para></item>
<item><para>“working day” means any day other than a Saturday, Sunday or public holiday;</para></item>
<item><para>“writ” means a writ of summons.</para></item>
</orderedlist></para>
1/44.-(1) 在本规则中,除非上下文另有要求,否则以下词语具有本规则分别赋予它们的含义,即:
“出席”包括任何人使用电子、机械或法院允许的其他方式出席;
“执达主任”包括司法常务官、任何书记员或其他在下级法院负责执达主任职责的法院官员;
“民事诉讼程序公约”是指本规则附录C中规定的公约,包括不同国家之间关于法院民事诉讼程序的任何类型的公约、条约或协议或其中的任何规定;
“对开本”指100个字,每个数字作为一个字计算;
“表格”是指本规则附录a中规定的表格,以及附录中编号的表格;
“法官”系指高等法院法官或区域法院法官,在其有权行事的情况下,包括裁判官或司法常务官(视情况而定);
“官员”指最高法院或下级法院的官员;
“原诉程序”是指传票或原诉传票;
“原诉传票”是指除传票以外的所有启动法律程序的传票;
“诉状”不包括原诉传票或初步行动;
“接收人”包括管理人或收货人;
“书记官处”指最高法院书记官处或下级法院书记官处(视情况而定),提及书记官长应据此解释;
“表列领土”具有《外汇管制法》(第99章)赋予的含义;
“治安官”包括下级法院的一名治安官;
“签署”,就注册官签署文件而言,包括附上传真签名;
“律师”的含义与《法律职业法》(第161章)中的含义相同;
“传票”是指未决诉讼或事项中的每份传票。
“工作日”是指周六、周日或公共假日以外的任何一天;
“令状”指传票令状。
这里有一个
para
orderedlist
,当我运行我的模板时,orderedlist进入了para,即
orderedlist
内容进入了
para
中,在调用了
orderedlist
模板之后,我很困惑为什么会发生这种情况

这是问题,请让我知道如何解决这个问题


谢谢

您没有向我们显示您想要的结果,但根据您的匹配模式,您当前似乎希望在
内容样式
上应用模板,但您的
调用模板
处理
para
元素的字符串值

因此,我将代码更改如下:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output indent="yes"/>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>



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

<xsl:apply-templates select="./node()[1][self::page]" mode="first"/>

      <div>
<xsl:choose>
    <xsl:when test="./@align">
<xsl:attribute name="class">
                            <xsl:text>para align-</xsl:text>
                            <xsl:value-of select="./@align"/>
                        </xsl:attribute>    
                        </xsl:when>
                        <xsl:otherwise>
                        <xsl:attribute name="class">
                            <xsl:text>para</xsl:text>

                        </xsl:attribute>    

                        </xsl:otherwise>
</xsl:choose>
<xsl:choose>

            <xsl:when test="contains(./content-style[1],'/')">

            <div class="para">

             <xsl:apply-templates/>
       </div>
            </xsl:when>

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



    </xsl:template>

   <xsl:template match="text()">

    <xsl:analyze-string select="." regex="(([Cc]hapter)\s(\d+))">

      <xsl:matching-substring>

          <xsl:value-of select="."/>

      </xsl:matching-substring>

          <xsl:non-matching-substring>

          <xsl:analyze-string select="."  regex="http://[^ ]+">
          <xsl:matching-substring>
         <a href="{.}">
                            <xsl:value-of select="."/>
                                    </a>

          </xsl:matching-substring>
          <xsl:non-matching-substring>

            <xsl:value-of select="."/>
          </xsl:non-matching-substring>

        </xsl:analyze-string>
      </xsl:non-matching-substring>
    </xsl:analyze-string>
  </xsl:template>




    <xsl:template match="para/content-style[1]">

<xsl:analyze-string select="." regex="([0-9]+)/([0-9]+)/([0-9]+)">
<xsl:matching-substring>
<span class="phrase">
         <a name="{concat('P',regex-group(1),'-',regex-group(2),'-',regex-group(3))}"/>

    <xsl:value-of select="."></xsl:value-of>
</span>
</xsl:matching-substring>
<xsl:non-matching-substring>
 <xsl:analyze-string select="." regex="([0-9]+)/([0-9]+)">
<xsl:matching-substring>
<span class="phrase">
         <a name="{concat('P',regex-group(1),'-',regex-group(2))}"/>
    <xsl:value-of select="."></xsl:value-of>
</span>
</xsl:matching-substring>
<xsl:non-matching-substring>

    <xsl:value-of select="."></xsl:value-of>

</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:non-matching-substring>
</xsl:analyze-string>    
</xsl:template>


 <xsl:template name="orderedlist" match="orderedlist">
        <ol class="eng-orderedlist orderedlist">
            <xsl:apply-templates/>
        </ol>
    </xsl:template>


<xsl:template match="item">
<!--<xsl:apply-templates select="./para[1]/node()[1][self::page]" mode="first"/>-->
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="item/para">

<li class="item">
<xsl:variable name="strl">
<xsl:value-of select="string-length(../@num)"/>
</xsl:variable>

      <xsl:for-each select=".">
      <xsl:apply-templates select="./node()[1][self::page]" mode="first"/>
      <div class="para">
      <xsl:choose>

<xsl:when test="name(../../parent::*[1]) = 'section' and $strl &gt; '2' and not(preceding-sibling::para)">

    <xsl:apply-templates select="../@num" mode="next"/>


</xsl:when>
<xsl:otherwise>

<xsl:if test="not(preceding-sibling::para)">
<span class="item-num">
<xsl:value-of select="../@num"/>
</span>
</xsl:if>
</xsl:otherwise>



</xsl:choose>

       <xsl:apply-templates select="child::node()[not(self::para)]"/>
    </div>
</xsl:for-each>
    </li>

</xsl:template>






<xsl:template mode="next" match="@num">



 <xsl:analyze-string select="." regex="([0-9]+)\.([0-9]+)\.([0-9]+)">
<xsl:matching-substring>
         <a name="{concat('P',regex-group(1),'-',regex-group(2),'-',regex-group(3))}"/>
    <span class="phrase">
    <xsl:value-of select="."></xsl:value-of>
    </span>  
</xsl:matching-substring>
<xsl:non-matching-substring>
 <xsl:analyze-string select="." regex="([0-9]+)\.([0-9]+)">
<xsl:matching-substring>
         <a name="{concat('P',regex-group(1),'-',regex-group(2))}"/>
    <span class="phrase">
    <xsl:value-of select="."></xsl:value-of>
    </span>  
</xsl:matching-substring>
<xsl:non-matching-substring>

    <xsl:value-of select="."></xsl:value-of>

</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:non-matching-substring>
</xsl:analyze-string>


<!--   <xsl:apply-templates select="../para"/></div>
      </li>-->

</xsl:template>

<xsl:template match="page[not(preceding-sibling::node()[not(self::text()) or normalize-space()])]"/>






</xsl:transform>

对位对齐-
对位
哪个输出

<?xml version="1.0" encoding="UTF-8"?>
<root>
   <div class="para">
      <div class="para">
         <span class="phrase">
            <a name="P1-4"/>1/4</span> 4.—(1) In these Rules, unless the context otherwise requires, the following expressions have the meanings hereby respectively assigned to them, namely:
<ol class="eng-orderedlist orderedlist">
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“attend” includes the appearance by any person using electronic, mechanical or other means permitted by the Court;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“bailiff” includes the registrar, any clerk or other officer of the Court charged with the duties of a bailiff in the Subordinate Courts;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“Civil Procedure Convention” means the conventions set out in Appendix C to these Rules and includes any convention, treaty or agreement of any description or any provision thereof between different States relating to civil procedure in the court;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“folio” means 100 words, each figure being counted as one word;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“Form” means a form set out in Appendix A to these Rules, and a form so numbered in the Appendix;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“Judge” means a judge of the High Court or District Judge and includes, in cases where he is empowered to act, a Magistrate or the Registrar, as the case may require;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“officer” means an officer of the Supreme Court or Subordinate Courts;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“originating process” means a writ of summons or an originating summons;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“originating summons” means every summons for the commencement of proceedings other than a writ of summons;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“pleading” does not include an originating summons or preliminary act;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“receiver” includes a manager or consignee;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“Registry” means the Registry of the Supreme Court or the Registry of the Subordinate Courts, as the case may be, and references to the Registrar shall be construed accordingly;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“scheduled territories” has the meaning assigned to it by the Exchange Control Act (Chapter 99);</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“Sheriff” includes a bailiff of the Subordinate Courts;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“sign”, in relation to the signing of documents by the Registrar, includes the affixing of a facsimile signature;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“solicitor” has the same meaning as in the Legal Profession Act (Chapter 161);</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“summons” means every summons in a pending cause or matter.</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“working day” means any day other than a Saturday, Sunday or public holiday;</div>
            </li>
            <li class="item">
               <div class="para">
                  <span class="item-num"/>“writ” means a writ of summons.</div>
            </li>
         </ol>
      </div>
   </div>
</root>

1/4 4.—(1) 在本规则中,除非上下文另有要求,否则以下词语具有本规则分别赋予它们的含义,即:
  • “出席”包括任何人使用电子、机械或法院允许的其他方式出席;
  • “执达主任”包括司法常务官、任何书记员或其他在下级法院负责执达主任职责的法院官员;
  • “民事诉讼程序公约”是指本规则附录C中规定的公约,包括不同国家之间关于法院民事诉讼程序的任何类型的公约、条约或协议或其中的任何规定;
  • “对开本”指100个字,每个数字作为一个字计算;
  • “表格”是指本规则附录a中规定的表格,以及附录中编号的表格;
  • “法官”系指高等法院法官或区域法院法官,在其有权行事的情况下,包括裁判官或司法常务官(视情况而定);
  • “官员”指最高法院或下级法院的官员;
  • “原诉程序”是指传票或原诉传票;
  • “原诉传票”是指除传票以外的所有启动法律程序的传票;
  • “诉状”不包括原诉传票或初步行动;
  • “接收人”包括管理人或收货人;
  • “注册处”是指UPRI的注册处
        <div class="para">
         <xsl:call-template name="phrase"/><!--
    
         <xsl:variable name="content" select="generate-id(content-style[1])" />-->
         <xsl:apply-templates select="child::node()[not(self::content-style)]"/>
    
       <div class="para">
             <xsl:apply-templates/>
       </div>