【问题标题】:XSLT How do I remove the <span> elements inside of the <p> element?XSLT 如何删除 <p> 元素内的 <span> 元素?
【发布时间】:2016-07-28 17:24:56
【问题描述】:

假设我有一个包含如下段落块的文档:

<p>
One morning, when Gregor Samsa woke from troubled dreams, he found himself
transformed in his bed into a horrible vermin. He lay on his armour-like 
back, and if he lifted his head a little he could see his brown belly, 
slightly domed and divided by arches into stiff sections. The bedding was  
hardly able to cover it and seemed ready to slide off any moment.  
<span style="background-color:rgb(255, 255, 255); color:rgb(102, 102, 102)">
    <span next="added-diff-1" changeId="added-diff-0" previous="first-diff" id="added-diff-0" class="diff-html-added">
    Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.
    </span>
</span>
His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.
</p>

是否可以使用 XSLT 读取 p 元素但排除 span 标签和嵌套在段落内的 span 标签之间的内容?我该怎么做?

【问题讨论】:

    标签: html xml xslt


    【解决方案1】:

    使用身份转换模板加上模板&lt;xsl:template match="p//span"/&gt;。

    【讨论】:

      猜你喜欢
      • 2016-12-07
      • 2013-12-12
      • 2010-12-26
      • 1970-01-01
      • 2015-03-17
      • 2020-08-07
      • 1970-01-01
      • 2014-12-14
      • 1970-01-01
      相关资源
      最近更新 更多