首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何避免图形标题上的链接

如何避免图形标题上的链接
EN

Stack Overflow用户
提问于 2014-02-11 17:47:48
回答 1查看 47关注 0票数 1

在我的输入xml中,我有许多地方的图形、图像和它的交叉链接文本。当我尝试使用标签编写交叉链接时,它也会在标题文本上进行交叉链接。但是,除了标题文本,我需要在任何地方编写交叉链接。

代码语言:javascript
复制
<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代码是

代码语言:javascript
复制
<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">

.

它会产生结果

代码语言:javascript
复制
<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"/>

但是,我需要

代码语言:javascript
复制
<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"/>

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2014-02-11 18:02:28

我不完全确定你在问什么,但是:

代码语言:javascript
复制
<xsl:template match="text()[parent::par/@class='para']">

这样,@class='figurecaption'所在的par元素就会被排除在字符串分析之外。

如果需要,您可以编写与插图标题的文本相匹配的第二个模板,并对其进行单独操作:

代码语言:javascript
复制
<xsl:template match="text()[parent::par/@class='figurecaption']">
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21698287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档