避免在图题的链接,以及如何(Avoid link on the figure caption as

2019-10-19 07:54发布

在我输入XML我没有这个数据,图像和许多地方的交联的文本。 当我尝试使用标签进行编码交联,但它的标题文字也交联。 但是,我需要除了在标题文字编写到处交联。

<par class="para">In addition to the core publications, there is also a complementary set of ITIL publications providing guidance specific to industry sectors, organization types, operating models and technology architectures on `Figure 1.1`.</par>

        <par class="figurecaption">Figure 1.1  The ITIL service lifecycle</par>
        <par class="image">gr000001</par>

我的XSLT代码去

<xsl:template match="text()" exclude-result-prefixes="html">
<xsl:analyze-string select="." regex="(Chapter|Figure|Table|Appendix)\s(\d+|[A-Z])(\.)?(\d+)?|(www.[^ ]+)|(http://[^ ]+)|(Section|section)\s(\d)\.(\d+)(\.)?(\d+|\d)?(\.)?(\d)?" flags="x">
<xsl:matching-substring>        
<a><xsl:attribute name="href">

.....

它产生的结果

<p>In addition to the core publications, there is also a complementary set of ITIL publications providing guidance specific to industry sectors, organization types, operating models and technology architectures on `<a href="chapter1.html#Fig1">Figure 1.1</a>`.</p>

    <p><a href="chapter1.html#Fig1">Figure 1.1</a>  The ITIL service lifecycle</p>
    <img src="gr000001"/>

但是我需要

<p>In addition to the core publications, there is also a complementary set of ITIL publications providing guidance specific to industry sectors, organization types, operating models and technology architectures on `<a href="chapter1.html#Fig1">Figure 1.1</a>`.</p>

<p>`Figure 1.1`  The ITIL service lifecycle</p>
        <img src="gr000001"/>

任何想法?

Answer 1:

我并不完全相信你的要求,但如何:

<xsl:template match="text()[parent::par/@class='para']">

这样一来, par其中元件@class='figurecaption'被排除在串分析。

如果需要的话,你就可以写这个数字字幕文字匹配的第二模板,并分别对其进行操作:

<xsl:template match="text()[parent::par/@class='figurecaption']">


文章来源: Avoid link on the figure caption as well How
标签: xslt xslt-2.0