以下是我的xml文件中的代码段:
<citation citation-type="web">
<article-title>Dietary reference</article-title>.
<publisher-name>The Academy</publisher-name>.
<comment>Available from:
<ext-link ext-link-type="uri">http://www.fap.com/catalog.php?</ext-link>
</comment>.
<access-date>Accessed 2013</access-date>.
</citation>
我需要将其转换为以下内容:
<citation citation-type="web">
<article-title>Dietary reference</article-title>.
<publisher-name>The Academy</publisher-name>.
<comment>Available from:
<ext-link ext-link-type="uri">http://www.fap.com/catalog.php?</ext-link>
Accessed 2013</comment>.
</citation>
必须删除access-date
元素,但其内容应放在comment
元素内。但是,在执行此操作后,保留.
之后的</access-date>
。因此,</comment>
之后现在有两个完整的止损。由于.
位于access-date
元素之外,我暂时陷入困境,我无法消除它。任何形式的帮助都将得到真正的赞赏。感谢。
答案 0 :(得分:0)
根据您的评论,您只需添加一个空模板
<xsl:template match="citation/text()[preceding-sibling::node()[1][self::access-date] and normalize-space() = '.']"/>
确保不复制带有点.
的第二个文本节点。